More Story

pages/story-telling

`more-story.html`:

//wiki.ralfbarkow.ch/assets/pages/story-telling/more-story.html

`print this` ⇒

window.doprint = async function(event) { let html = [prolog] for (let item of instory) { try { let site = item.site let title = item.text.split(/\[\[|\]\]/)[1] let slug = frame.asSlug(title) let url = new URL(`http://${site}/${slug}.json`) console.log({site,title,slug}) let page = await fetch(url).then(res => res.json()) html.push(render(site,page).join("\n")) window.result.innerHTML += ' .' } catch (err) { window.result.innerHTML += ' x' console.error(err) } } frame.download(html.join("\n"),'preprint.html','text/html') }

[rgb@wiki:~/.wiki/127.0.0.1/assets/pages/story-telling]$ git diff diff --git a/pages/story-telling/more-story.html b/pages/story-telling/more-story.html index 6871731..7577c64 100644 --- a/pages/story-telling/more-story.html +++ b/pages/story-telling/more-story.html @@ -76,8 +76,9 @@ let site = item.site let title = item.text.split(/\[\[|\]\]/)[1] let slug = frame.asSlug(title) + let url = new URL(`http://${site}/${slug}.json`) console.log({site,title,slug}) - let page = await fetch(`//${site}/${slug}.json`).then(res => res.json()) + let page = await fetch(url).then(res => res.json()) html.push(render(site,page).join("\n")) window.result.innerHTML += ' .' } catch (err) { diff --git a/pages/story-telling/print-telling.html b/pages/story-telling/print-telling.html index 4e1bfa6..b259d18 100644 --- a/pages/story-telling/print-telling.html +++ b/pages/story-telling/print-telling.html @@ -53,7 +53,8 @@ let title = link(content.text) let site = content.site let slug = frame.asSlug(title) - let page = await fetch(`//${site}/${slug}.json`).then(res => res.json()) + let url = new URL(`http://${site}/${slug}.json`) + let page = await fetch(url).then(res => res.json()) html.push(...render(site, page)) window.result.innerHTML += ' .' } catch (err) { [rgb@wiki:~/.wiki/127.0.0.1/assets/pages/story-telling]$

Returns a TypeError: Failed to fetch at window.doprint (VM296 more-story.html:81:28) window.doprint @ VM296 more-story.html:86 await in window.doprint (async) onclick @ VM300 more-story.html:3 VM296 more-story.html:80

Check if a JavaScript string is a URL. stackoverflow

function isValidHttpUrl(string) { let url; try { url = new URL(string); } catch (_) { return false; } return url.protocol === "http:" || url.protocol === "https:"; }

Wiki extends its twenty year old namesake by providing an unbounded complement of markups of which only a few offer specific syntax for formatting text. The remaining markups configure plugins to show or do work we usually associate with applications.

> Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure resource '<URL>'. This request has been blocked; the content must be served over HTTPS. VM175 more-story.html:93 Mixed Content: The page at 'https://wiki.ralfbarkow.ch/view/welcome-visitors/view/2022-05-25/view/find-saved-tellings/view/search-for-tellings/view/more-telling-about-federated-wiki/view/more-more-telling-about-federated-wiki' was loaded over HTTPS, but requested an insecure resource 'http://about.fed.wiki/about-federated-wiki.json'. This request has been blocked; the content must be served over HTTPS.

What is Mixed Content Error… post

Serve http as local https?

https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content

How to access the JSON on HTTP from an HTTPS page? stackoverflow

Do wee need a function `request-insecure-json-resource`?

XHR GET https://wiki.ralfbarkow.ch/proxy/about.fed.wiki/system/sitemap.json [HTTP/2 200 OK 597ms]

XMLHttpRequestCORS Then search for resource in the sitemap.json ?!

Part of the work exploring making wiki-client protocol agnostic. When we server the origin over `https` browers restrict access to non-secure resources, so we **must** fetch any remote resources over a secure connection as well.

https://wiki.ralfbarkow.ch/proxy/jess.reimage.fed.wiki/jesss-story.json

print-telling

//wiki.ralfbarkow.ch/assets/pages/story-telling/print-telling.html