diff options
| author | Xe Iaso <me@christine.website> | 2023-09-30 10:36:37 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-30 10:36:37 -0400 |
| commit | ac6a3df0d18cc73524c0096d954a57d24cad5669 (patch) | |
| tree | 81474177d730440657f490ae29892d62392251ea /src/frontend/components | |
| parent | cbdea8ba3fca9a663778af71f8df5965aeb6c090 (diff) | |
| download | xesite-ac6a3df0d18cc73524c0096d954a57d24cad5669.tar.xz xesite-ac6a3df0d18cc73524c0096d954a57d24cad5669.zip | |
Xesite V4 (#723)
* scripts/ditherify: fix quoting
Signed-off-by: Xe Iaso <me@xeiaso.net>
* clean up some old files
Signed-off-by: Xe Iaso <me@xeiaso.net>
* import site into lume
Signed-off-by: Xe Iaso <me@xeiaso.net>
* initial go code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* move vods index to top level
Signed-off-by: Xe Iaso <me@xeiaso.net>
* remove the ads
Signed-off-by: Xe Iaso <me@xeiaso.net>
* internal/lume: metrics
Signed-off-by: Xe Iaso <me@xeiaso.net>
* delete old code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* load config into memory
Signed-off-by: Xe Iaso <me@xeiaso.net>
* autogenerate data from dhall config
Signed-off-by: Xe Iaso <me@xeiaso.net>
* various cleanups, import clackset logic
Signed-off-by: Xe Iaso <me@xeiaso.net>
* Update signalboost.dhall (#722)
Added myself, and also fixed someone’s typo
* Add Connor Edwards to signal boost (#721)
* add cache headers
Signed-off-by: Xe Iaso <me@xeiaso.net>
* move command to xesite folder
Signed-off-by: Xe Iaso <me@xeiaso.net>
* xesite: listen for GitHub webhook push events
Signed-off-by: Xe Iaso <me@xeiaso.net>
* xesite: 5 minute timeout for rebuilding the site
Signed-off-by: Xe Iaso <me@xeiaso.net>
* xesite: add rebuild metrics
Signed-off-by: Xe Iaso <me@xeiaso.net>
* xesite: update default variables
Signed-off-by: Xe Iaso <me@xeiaso.net>
* don't commit binaries oops lol
Signed-off-by: Xe Iaso <me@xeiaso.net>
* lume: make search have a light background
Signed-off-by: Xe Iaso <me@xeiaso.net>
* add a notfound page
Signed-off-by: Xe Iaso <me@xeiaso.net>
* fetch info from patreon API
Signed-off-by: Xe Iaso <me@xeiaso.net>
* create contact page
Signed-off-by: Xe Iaso <me@xeiaso.net>
* Toot embedding
Signed-off-by: Xe Iaso <me@xeiaso.net>
* attempt a docker image
Signed-off-by: Xe Iaso <me@xeiaso.net>
* lume: fix deno lock
Signed-off-by: Xe Iaso <me@xeiaso.net>
* add gokrazy post
Signed-off-by: Xe Iaso <me@xeiaso.net>
* cmd/xesite: go up before trying to connect to the saas proxy
Signed-off-by: Xe Iaso <me@xeiaso.net>
* blog: add Sine post/demo
Signed-off-by: Xe Iaso <me@xeiaso.net>
---------
Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: bri <284789+b-@users.noreply.github.com>
Co-authored-by: Connor Edwards <38229097+cedws@users.noreply.github.com>
Diffstat (limited to 'src/frontend/components')
| -rw-r--r-- | src/frontend/components/ConvSnippet.tsx | 45 | ||||
| -rw-r--r-- | src/frontend/components/MastodonShareButton.tsx | 77 | ||||
| -rw-r--r-- | src/frontend/components/NoFunAllowed.tsx | 22 | ||||
| -rw-r--r-- | src/frontend/components/Video.tsx | 40 | ||||
| -rw-r--r-- | src/frontend/components/WASITerm.tsx | 83 |
5 files changed, 0 insertions, 267 deletions
diff --git a/src/frontend/components/ConvSnippet.tsx b/src/frontend/components/ConvSnippet.tsx deleted file mode 100644 index 9644333..0000000 --- a/src/frontend/components/ConvSnippet.tsx +++ /dev/null @@ -1,45 +0,0 @@ -// @jsxImportSource xeact -// @jsxRuntime automatic - -export interface ConvSnippetProps { - name: string; - mood: string; - children: HTMLElement[]; -} - -const ConvSnippet = ({ name, mood, children }: ConvSnippetProps) => { - const nameLower = name.toLowerCase(); - name = name.replace(" ", "_"); - - return ( - <div class="conversation"> - <div class="conversation-standalone"> - <picture> - <source - type="image/avif" - srcset={`https://cdn.xeiaso.net/file/christine-static/stickers/${nameLower}/${mood}.avif`} - /> - <source - type="image/webp" - srcset={`https://cdn.xeiaso.net/file/christine-static/stickers/${nameLower}/${mood}.webp`} - /> - <img - style="max-height:4.5rem" - alt={`${name} is ${mood}`} - loading="lazy" - src={`https://cdn.xeiaso.net/file/christine-static/stickers/${nameLower}/${mood}.png`} - /> - </picture> - </div> - <div className="conversation-chat"> - {"<"} - <a href={`/characters#${nameLower}`}> - <b>{name}</b> - </a> - {">"} {children} - </div> - </div> - ); -}; - -export default ConvSnippet; diff --git a/src/frontend/components/MastodonShareButton.tsx b/src/frontend/components/MastodonShareButton.tsx deleted file mode 100644 index d809ee9..0000000 --- a/src/frontend/components/MastodonShareButton.tsx +++ /dev/null @@ -1,77 +0,0 @@ -// @jsxImportSource xeact -// @jsxRuntime automatic - -import { u, useState } from "xeact"; - -export interface MastodonShareButtonProps { - title: string; - url: string; - series?: string; - tags: string; -} - -export default function MastodonShareButton( - { title, url = u(), series, tags }: MastodonShareButtonProps, -) { - let defaultURL = localStorage["mastodon_instance"]; - - if (defaultURL == undefined) { - defaultURL = ""; - } - - const tootTemplate = `${title} - -${url} - -${series ? "#" + series + " " : ""}${ - tags ? tags.map((x) => "#" + x).join(" ") : "" - } @cadey@pony.social`; - - const [getURL, setURL] = useState(defaultURL); - const [getToot, setToot] = useState(tootTemplate); - - return ( - <div> - <details> - <summary>Share on Mastodon</summary> - <span>{"Instance URL (https://mastodon.example)"}</span> - <br /> - <input - type="text" - placeholder="https://pony.social" - value={defaultURL} - oninput={(e) => setURL(e.target.value)} - /> - <br /> - <textarea - rows={6} - cols={40} - oninput={(e) => setToot(e.target.value)} - > - {getToot()} - </textarea> - <br /> - <button - onclick={() => { - let instanceURL = getURL(); - - if (!instanceURL.startsWith("https://")) { - instanceURL = `https://${instanceURL}`; - } - - localStorage["mastodon_instance"] = instanceURL; - const text = getToot(); - const mastodonURL = u(instanceURL + "/share", { - text, - visibility: "public", - }); - console.log({ text, mastodonURL }); - window.open(mastodonURL, "_blank"); - }} - > - Share - </button> - </details> - </div> - ); -} diff --git a/src/frontend/components/NoFunAllowed.tsx b/src/frontend/components/NoFunAllowed.tsx deleted file mode 100644 index 9f5c5f5..0000000 --- a/src/frontend/components/NoFunAllowed.tsx +++ /dev/null @@ -1,22 +0,0 @@ -// @jsxImportSource xeact -// @jsxRuntime automatic - -import { c } from "xeact"; - -const onclick = () => { - Array.from(c("xeblog-slides-fluff")).forEach((el) => - el.classList.toggle("hidden") - ); -}; - -export default function NoFunAllowed() { - const button = ( - <button - class="" - onclick={() => onclick()} - > - No fun allowed - </button> - ); - return button; -} diff --git a/src/frontend/components/Video.tsx b/src/frontend/components/Video.tsx deleted file mode 100644 index 812e6bd..0000000 --- a/src/frontend/components/Video.tsx +++ /dev/null @@ -1,40 +0,0 @@ -// @jsxImportSource xeact -// @jsxRuntime automatic - -import Hls from "@hls.js"; - -export interface VideoProps { - path: string; -} - -export default function Video({ path }: VideoProps) { - const streamURL = - `https://cdn.xeiaso.net/file/christine-static/${path}/index.m3u8`; - const video = ( - <video style="width:100%" controls> - <source src={streamURL} type="application/vnd.apple.mpegurl" /> - <source - src="https://cdn.xeiaso.net/file/christine-static/blog/HLSBROKE.mp4" - type="video/mp4" - /> - </video> - ); - - if (Hls.isSupported()) { - const hls = new Hls(); - hls.on(Hls.Events.MEDIA_ATTACHED, () => { - console.log("video and hls.js are now bound together !"); - }); - hls.on(Hls.Events.MANIFEST_PARSED, (event, data) => { - console.log( - "manifest loaded, found " + data.levels.length + " quality level", - ); - }); - hls.loadSource(streamURL); - hls.attachMedia(video); - } else if (video.canPlayType("application/vnd.apple.mpegurl")) { - video.src = streamURL; - } - - return video; -} diff --git a/src/frontend/components/WASITerm.tsx b/src/frontend/components/WASITerm.tsx deleted file mode 100644 index 5f7e7f9..0000000 --- a/src/frontend/components/WASITerm.tsx +++ /dev/null @@ -1,83 +0,0 @@ -// @jsxImportSource xeact -// @jsxRuntime automatic - -import { t, x } from "xeact"; -import Terminal from "@xterm"; -import * as fitAdd from "@xterm/addon-fit"; -import { Fd, File, PreopenDirectory, WASI } from "@bjorn3/browser_wasi_shim"; - -class XtermStdio extends Fd { - term: Terminal; - - constructor(term: Terminal) { - super(); - this.term = term; - } - - fd_write(view8: Uint8Array, iovs: any) { - let nwritten = 0; - for (let iovec of iovs) { - console.log( - iovec.buf_len, - iovec.buf_len, - view8.slice(iovec.buf, iovec.buf + iovec.buf_len), - ); - let buffer = view8.slice(iovec.buf, iovec.buf + iovec.buf_len); - this.term.write(buffer); - nwritten += iovec.buf_len; - } - return { ret: 0, nwritten }; - } -} - -const loadExternalFile = async (path: string) => { - return new File(await (await (await fetch(path)).blob()).arrayBuffer()); -}; - -export interface WASITermProps { - href: string; - env: string[]; - args: string[]; -} - -export default function WASITerm({ href, env, args }: WASITermProps) { - const root = <div style="max-width:80ch;max-height:20ch"></div>; - - const term = new Terminal({ - convertEol: true, - fontFamily: "Iosevka Curly Iaso", - }); - - const fit = new fitAdd.default(); - term.loadAddon(fit); - fit.fit(); - - return ( - <div> - {root} - <button - onClick={async () => { - term.writeln(`\x1B[93mfetching ${href}...\x1B[0m`); - const wasm = await WebAssembly.compileStreaming(fetch(href)); - term.writeln("\x1B[93mdone, instantiating\x1B[0m"); - - const fds = [ - new XtermStdio(term), - new XtermStdio(term), - new XtermStdio(term), - new PreopenDirectory("/tmp", {}), - ]; - - let wasi = new WASI(args, env, fds); - term.clear(); - // let inst = await WebAssembly.instantiate(wasm, { - // "wasi_snapshot_preview1": wasi.wasiImport, - // }); - // wasi.start(inst); - }} - > - Run - </button> - </div> - ); -} |
