aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/canaries
diff options
context:
space:
mode:
authorLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-01-22 22:11:53 +0100
committerLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-01-22 22:11:53 +0100
commit1bce06b615b44dbd5fd3d3c57d1ab6567451e680 (patch)
tree248bc20d826ec46434206188278507cd880526a3 /src/routes/canaries
parent2d5fc31cef4b3f5928fca7c6e0b2a0391541f210 (diff)
downloadmem-estrogen-zone-1bce06b615b44dbd5fd3d3c57d1ab6567451e680.tar.gz
mem-estrogen-zone-1bce06b615b44dbd5fd3d3c57d1ab6567451e680.tar.bz2
mem-estrogen-zone-1bce06b615b44dbd5fd3d3c57d1ab6567451e680.tar.lz
mem-estrogen-zone-1bce06b615b44dbd5fd3d3c57d1ab6567451e680.zip

feat: upstream links

Diffstat (limited to 'src/routes/canaries')
-rw-r--r--src/routes/canaries/+page.svelte14
-rw-r--r--src/routes/canaries/canaries.ts56
2 files changed, 49 insertions, 21 deletions
diff --git a/src/routes/canaries/+page.svelte b/src/routes/canaries/+page.svelte
index 1613831..c03a764 100644
--- a/src/routes/canaries/+page.svelte
+++ b/src/routes/canaries/+page.svelte
@@ -20,14 +20,14 @@
{#each canaries as canary}
<li class="list-disc ml-4">
{canary.signer}'s canary for {canary.name} (<a
- href={canary.url}
+ href={canary.upstream ?? canary.url}
target="_blank"
download="{canary.signer}:{canary.name}.sig"
class="opacity-90 hover:underline text-blue-400 hover:text-blue-300"
>download</a
>,
<a
- href={canary.url}
+ href={canary.upstream ?? canary.url}
target="_blank"
class="opacity-90 hover:underline text-blue-400 hover:text-blue-300"
>open in newtab</a
@@ -122,6 +122,16 @@
found, it turns a different shade of
<span class="bg-red-800 text-white">red</span>.</span
>
+ {#if canaries.find((v) => v.upstream)}
+ <span
+ class="upstream-btn opacity-60 hover:opacity-80 transition-all"
+ class:hidden={!browser}
+ ><br />
+ If there is an upstream button, it indicates that we are mirroring the
+ canary, rather than using the source canary, e.g. for CORS. You may want
+ to check it in the event of something looking wrong.</span
+ >
+ {/if}
</p>
</div>
</div>
diff --git a/src/routes/canaries/canaries.ts b/src/routes/canaries/canaries.ts
index d28baab..692abc2 100644
--- a/src/routes/canaries/canaries.ts
+++ b/src/routes/canaries/canaries.ts
@@ -2,15 +2,29 @@ import { browser } from "$app/environment";
import { validateSignature } from "./keystore";
export const canaries: Canary[] = [];
+export interface CanaryInterface {
+ name: string,
+ description: string,
+ signer: string,
+ url: string,
+ keyIdentifier: string,
+ contentType: string,
+ upstream?: string
+}
+export interface Canary extends CanaryInterface { }
+type _PreCanaryInterfaceEntries = {
+ [T in keyof CanaryInterface]: [T, CanaryInterface[T]]
+}
+type CanaryInterfaceEntry = _PreCanaryInterfaceEntries[keyof _PreCanaryInterfaceEntries]
export class Canary {
public constructor(
- public name: string,
- public description: string,
- public signer: string,
- public url: string,
- public keyIdentifier: string,
- public contentType: string = 'text/plain',
+ canary: CanaryInterface
) {
+ const entries = Object.entries(canary) as CanaryInterfaceEntry[];
+ for (const a of entries) {
+ // @ts-ignore we know the value will match in type
+ this[a[0]] = a[1];
+ }
canaries.push(this);
}
public forceContentType = false;
@@ -50,20 +64,24 @@ ${await res.text().catch(e => `Unknown (Unable to get text, ${JSON.stringify(e)}
}
}
new Canary(
- 'estrogen.zone',
- 'Services hosted around estrogen.zone and yuridick.gay',
- 'memdmp',
- '/canaries/memdmp:estrogen.zone',
- 'memdmp',
- 'text/plain; charset=utf-8'
+ {
+ name: 'estrogen.zone',
+ description: 'Services hosted around estrogen.zone and yuridick.gay',
+ signer: 'memdmp',
+ url: '/canaries/memdmp:estrogen.zone',
+ keyIdentifier: 'memdmp',
+ contentType: 'text/plain; charset=utf-8'
+ }
);
new Canary(
- 'kyun.host',
- 'The VPS provider "kyun.host"',
- 'napatha',
- '/canaries/napatha:kyun.host',
- // 'https://files.kyun.host/canary.txt',
- 'napatha',
- 'text/plain; charset=utf-8'
+ {
+ name: 'kyun.host',
+ description: 'The VPS provider "kyun.host"',
+ signer: 'napatha',
+ url: '/canaries/napatha:kyun.host',
+ keyIdentifier: 'napatha',
+ contentType: 'text/plain; charset=utf-8',
+ upstream: 'https://files.kyun.host/canary.txt'
+ }
);