Merge pull request #105 from ProjectSegfault/dev‎‎​

Merge the captcha frontend to master now.
This commit is contained in:
Midou36O 2023-07-10 22:39:31 +01:00 committed by GitHub
commit baef551cac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 189 additions and 47 deletions

View File

@ -36,6 +36,7 @@
"@auth/core": "^0.2.5",
"@auth/sveltekit": "^0.1.12",
"joi": "^17.7.0",
"snarkdown": "^2.0.0"
"snarkdown": "^2.0.0",
"svelte-hcaptcha": "^0.1.1"
}
}

View File

@ -1,4 +1,4 @@
lockfileVersion: '6.1'
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
@ -17,6 +17,9 @@ dependencies:
snarkdown:
specifier: ^2.0.0
version: 2.0.0
svelte-hcaptcha:
specifier: ^0.1.1
version: 0.1.1
devDependencies:
'@iconify-json/ic':
@ -1667,6 +1670,10 @@ packages:
resolution: {integrity: sha512-/QmIqWGwzcfE82FAMuHBlKFwudW7Vcos60Ii8j/mJZ0H6kGAXwL5EGlcc8voBJMJv/i0QZmhp5b1ZX/XKg9NJQ==}
dev: true
/svelte-hcaptcha@0.1.1:
resolution: {integrity: sha512-iFF3HwfrCRciJnDs4Y9/rpP/BM2U/5zt+vh+9d4tALPAHVkcANiJIKqYuS835pIaTm6gt+xOzjfFI3cgiRI29A==}
dev: false
/svelte-hmr@0.15.1(svelte@3.55.1):
resolution: {integrity: sha512-BiKB4RZ8YSwRKCNVdNxK/GfY+r4Kjgp9jCLEy0DuqAKfmQtpL38cQK3afdpjw4sqSs4PLi3jIPJIFp259NkZtA==}
engines: {node: ^12.20 || ^14.13.1 || >= 16}

View File

@ -2,6 +2,12 @@
import type { PageData } from "./$types";
export let data: PageData;
let insturl: "short" | "long";
let toggle = () => {
insturl = insturl === "long" ? "short" : "long";
};
insturl = "long";
</script>
<div class="h1-no-lg flex flex-col sm:(flex-row items-center) gap-4 !mb-0">
@ -15,6 +21,22 @@
</div>
<div class="flex flex-col">
<button
on:click={toggle}
class="text-text flex items-center text-sm"
>
<div
class="i-ic:{insturl === 'long'
? 'baseline-toggle-off'
: 'baseline-toggle-on'} h-10 w-10"
/>
{#if insturl === "long"}
Long URL
{:else}
Short URL
{/if}
</button>
{#if insturl === "long"}
{#each data.instances as category}
<div class="flex flex-col">
<h2>{category.name}</h2>
@ -40,4 +62,31 @@
</div>
</div>
{/each}
{:else}
{#each data.instances as category}
<div class="flex flex-col">
<h2>{category.name}</h2>
<div class="flex flex-row flex-wrap gap-4">
{#each category.data as instance}
<a
href={instance.short_geo || instance.short_eu || instance.geo || instance.eu}
class="flex flex-row items-center gap-4 rounded bg-secondary p-4 w-110 no-underline text-text"
>
{#if instance.icon}
<img
src={instance.icon}
alt="{instance.name} logo"
class="h-20 rounded"
/>
{/if}
<div>
<span class="text-2xl">{instance.name}</span>
<p>{instance.description}</p>
</div>
</a>
{/each}
</div>
</div>
{/each}
{/if}
</div>

View File

@ -34,6 +34,21 @@
{#if instance.bp}
<a href={instance.bp}>Backup</a>
{/if}
{#if instance.short_geo}
<a href={instance.short_geo}>GeoDNS (Short URL)</a>
{/if}
{#if instance.short_eu}
<a href={instance.short_eu}>EU (Short URL)</a>
{/if}
{#if instance.short_us}
<a href={instance.short_us}>US (Short URL)</a>
{/if}
{#if instance.short_in}
<a href={instance.short_in}>IN (Short URL)</a>
{/if}
{#if instance.short_bp}
<a href={instance.short_bp}>Backup (Short URL)</a>
{/if}
{#if instance.tor}
<a href={instance.tor}>Tor</a>
{/if}

View File

@ -7,10 +7,15 @@ interface Instance {
name: string;
description: string;
geo?: string;
short_geo?: string;
eu?: string;
short_eu?: string;
us?: string;
short_us?: string;
in?: string;
short_in?: string;
bp?: string;
short_bp?: string;
tor?: string;
torBp?: string;
i2p?: string;
@ -26,9 +31,13 @@ const instances: Instances[] = [
name: "Invidious",
description: "A frontend for YouTube.",
eu: "https://invidious.projectsegfau.lt/",
us: "https://inv.us.projectsegfau.lt",
in: "https://inv.in.projectsegfau.lt",
bp: "https://inv.bp.projectsegfau.lt",
short_eu: "https://i.psf.lt/",
us: "https://inv.us.projectsegfau.lt/",
short_us: "https://i.us.psf.lt/",
in: "https://inv.in.projectsegfau.lt/",
short_in: "https://i.in.psf.lt/",
bp: "https://inv.bp.projectsegfau.lt/",
short_bp: "https://i.bp.psf.lt/",
tor: "http://inv.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
torBp: "http://invbp.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
i2p: "http://pjsfhqamc7k6htnumrvn4cwqqdoggeepj7u5viyimgnxg3gar72q.b32.i2p",
@ -39,17 +48,24 @@ const instances: Instances[] = [
name: "Piped",
description: "Another frontend for YouTube.",
eu: "https://piped.projectsegfau.lt/",
us: "https://piped.us.projectsegfau.lt",
in: "https://piped.in.projectsegfau.lt",
short_eu: "https://pi.psf.lt/",
us: "https://piped.us.projectsegfau.lt/",
short_us: "https://pi.us.psf.lt/",
in: "https://piped.in.projectsegfau.lt/",
short_in: "https://piped.in.projectsegfau.lt/",
icon: "/icons/piped.svg"
},
{
name: "Libreddit",
description: "A frontend for Reddit.",
geo: "https://libreddit.projectsegfau.lt/",
short_geo: "https://lr.psf.lt/",
eu: "https://libreddit.eu.projectsegfau.lt/",
us: "https://libreddit.us.projectsegfau.lt",
in: "https://libreddit.in.projectsegfau.lt",
short_eu: "https://lr.eu.psf.lt/",
us: "https://libreddit.us.projectsegfau.lt/",
short_us: "https://lr.us.psf.lt/",
in: "https://libreddit.in.projectsegfau.lt/",
short_in: "https://lr.in.psf.lt/",
tor: "http://libreddit.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
i2p: "http://pjsfkref7g66mji45kyccqnn5hmjtjp3cfodozabpyplj2rmv5sa.b32.i2p",
icon: "/icons/libreddit.png"
@ -58,9 +74,13 @@ const instances: Instances[] = [
name: "Nitter",
description: "A frontend for Twitter.",
geo: "https://nitter.projectsegfau.lt/",
short_geo: "https://n.psf.lt/",
eu: "https://nitter.eu.projectsegfau.lt/",
us: "https://nitter.us.projectsegfau.lt",
in: "https://nitter.in.projectsegfau.lt",
short_eu: "https://n.eu.psf.lt/",
us: "https://nitter.us.projectsegfau.lt/",
short_us: "https://n.us.psf.lt/",
in: "https://nitter.in.projectsegfau.lt/",
short_in: "https://n.in.psf.lt/",
tor: "http://nitter.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
i2p: "http://pjsfs4ukb6prmfx3qx3a5ef2cpcupkvcrxdh72kqn2rxc2cw4nka.b32.i2p",
icon: "/icons/nitter.png"
@ -68,10 +88,14 @@ const instances: Instances[] = [
{
name: "AnonymousOverflow",
description: "A frontend for StackOverflow.",
geo: "https://overflow.projectsegfau.lt",
eu: "https://overflow.eu.projectsegfau.lt",
us: "https://overflow.us.projectsegfau.lt",
in: "https://overflow.in.projectsegfau.lt",
geo: "https://overflow.projectsegfau.lt/",
short_geo: "https://o.psf.lt/",
eu: "https://overflow.eu.projectsegfau.lt/",
short_eu: "https://o.eu.psf.lt/",
us: "https://overflow.us.projectsegfau.lt/",
short_us: "https://o.us.psf.lt/",
in: "https://overflow.in.projectsegfau.lt/",
short_in: "https://o.in.psf.lt/",
tor: "http://overflow.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
icon: "/icons/anonymousoverflow.png"
},
@ -79,6 +103,7 @@ const instances: Instances[] = [
name: "Beatbump",
description: "A frontend for YouTube Music.",
geo: "https://bb.projectsegfau.lt/",
short_geo: "https://bb.projectsegfau.lt/",
eu: "https://bb.eu.projectsegfau.lt/",
us: "https://bb.us.projectsegfau.lt/",
in: "https://bb.in.projectsegfau.lt/",
@ -90,9 +115,13 @@ const instances: Instances[] = [
name: "BreezeWiki",
description: "A frontend for Fandom.",
geo: "https://bw.projectsegfau.lt/",
short_geo: "https://bw.psf.lt/",
eu: "https://bw.eu.projectsegfau.lt/",
short_eu: "https://bw.eu.psf.lt/",
us: "https://bw.us.projectsegfau.lt/",
short_us: "https://bw.us.psf.lt/",
in: "https://bw.in.projectsegfau.lt/",
short_in: "https://bw.in.psf.lt/",
tor: "http://breezewiki.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
i2p: "http://pjsfk4xvekoc7wx4pteevp3q2wy7jmzlem7rvl74nx33zkdr4vyq.b32.i2p",
icon: "/icons/breezewiki.svg"
@ -100,31 +129,28 @@ const instances: Instances[] = [
{
name: "GotHub",
description: "A frontend for GitHub.",
geo: "https://gothub.projectsegfau.lt",
eu: "https://gothub.eu.projectsegfau.lt",
us: "https://gothub.us.projectsegfau.lt",
in: "https://gothub.in.projectsegfau.lt",
geo: "https://gothub.projectsegfau.lt/",
short_geo: "https://gh.psf.lt/",
eu: "https://gothub.eu.projectsegfau.lt/",
short_eu: "https://gh.eu.psf.lt/",
us: "https://gothub.us.projectsegfau.lt/",
short_us: "https://gh.us.psf.lt/",
in: "https://gothub.in.projectsegfau.lt/",
short_in: "https://gh.in.psf.lt/",
tor: "http://gothub.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
icon: "/icons/gothub.svg"
},
{
name: "Librarian",
description: "A frontend for LBRY/Odysee.",
geo: "https://lbry.projectsegfau.lt/",
eu: "https://lbry.eu.projectsegfau.lt/",
us: "https://lbry.us.projectsegfau.lt/",
in: "https://lbry.in.projectsegfau.lt/",
tor: "http://lbry.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
i2p: "http://pjsf7uucpqf2crcmfo3nvwdmjhirxxjfyuvibdfp5x3af2ghqnaa.b32.i2p",
icon: "/icons/librarian.png"
},
{
name: "Rimgo",
description: "A frontend for Imgur.",
geo: "https://rimgo.projectsegfau.lt/",
short_geo: "https://rg.psf.lt/",
eu: "https://rimgo.eu.projectsegfau.lt/",
short_eu: "https://rg.eu.psf.lt/",
us: "https://rimgo.us.projectsegfau.lt/",
short_us: "https://rg.us.psf.lt/",
in: "https://rimgo.in.projectsegfau.lt/",
short_in: "https://rg.in.psf.lt/",
tor: "http://rimgo.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
icon: "/icons/rimgo.png"
},
@ -132,9 +158,13 @@ const instances: Instances[] = [
name: "Scribe",
description: "A frontend for Medium.",
geo: "https://scribe.projectsegfau.lt/",
short_geo: "https://sc.psf.lt/",
eu: "https://scribe.eu.projectsegfau.lt/",
short_eu: "https://sc.eu.psf.lt/",
us: "https://scribe.us.projectsegfau.lt/",
short_us: "https://sc.us.psf.lt/",
in: "https://scribe.in.projectsegfau.lt/",
short_in: "https://sc.in.psf.lt/",
tor: "http://scribe.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
i2p: "http://pjsflkkkcn33ahmzmpyq6idy2knkzh4atp7zaetqfsnenpyori6a.b32.i2p"
},
@ -142,9 +172,13 @@ const instances: Instances[] = [
name: "Teddit",
description: "Another frontend for Reddit.",
geo: "https://teddit.projectsegfau.lt/",
short_geo: "https://t.psf.lt/",
eu: "https://teddit.eu.projectsegfau.lt/",
short_eu: "https://t.eu.psf.lt/",
us: "https://teddit.us.projectsegfau.lt/",
short_us: "https://t.us.psf.lt/",
in: "https://teddit.in.projectsegfau.lt/",
short_in: "https://t.in.psf.lt/",
tor: "http://teddit.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
icon: "/icons/teddit.png"
},
@ -157,43 +191,52 @@ const instances: Instances[] = [
name: "Matrix",
description: "An open network for secure, decentralized communication.",
eu: "https://wiki.projectsegfau.lt/Matrix",
short_eu: "https://w.psf.lt/Matrix",
icon: "/icons/matrix.svg"
},
{
name: "Element",
description: "A feature-rich Matrix client.",
eu: "https://chat.projectsegfau.lt/",
short_eu: "https://el.psf.lt/",
icon: "/icons/element.svg"
},
{
name: "Hydrogen",
description: "A lightweight Matrix client.",
eu: "https://hydrogen.projectsegfau.lt/",
short_eu: "https://h2.psf.lt/",
icon: "/icons/hydrogen.svg"
},
{
name: "Cinny",
description: "An elegant Matrix client.",
eu: "https://cinny.projectsegfau.lt/",
short_eu: "https://cy.psf.lt/",
icon: "/icons/cinny.svg"
},
{
name: "XMPP",
description: "The universal messaging standard.",
eu: "https://wiki.projectsegfau.lt/XMPP",
short_eu: "https://w.psf.lt/XMPP",
icon: "/icons/xmpp.svg"
},
{
name: "XMPP Web",
description: "Lightweight web chat client for XMPP.",
eu: "https://xmpp-web.projectsegfau.lt/"
eu: "https://xmpp-web.projectsegfau.lt/",
short_eu: "https://x.psf.lt/"
},
{
name: "SearXNG",
description: "A private meta-search engine.",
eu: "https://search.projectsegfau.lt/",
us: "https://search.us.projectsegfau.lt",
in: "https://search.in.projectsegfau.lt",
short_eu: "https://s.psf.lt/",
us: "https://search.us.projectsegfau.lt/",
short_us: "https://s.us.psf.lt/",
in: "https://search.in.projectsegfau.lt/",
short_in: "https://s.in.psf.lt/",
tor: "http://search.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
i2p: "http://pjsfwklrellqoj275kzeu2tz4c3j5zktnqod56s7l5dc25ro3wgq.b32.i2p",
icon: "/icons/searxng.svg"
@ -202,6 +245,7 @@ const instances: Instances[] = [
name: "Gitea",
description: "A web interface for Git, alternative to GitHub.",
eu: "https://git.projectsegfau.lt/",
short_eu: "https://git.psf.lt/",
tor: "http://git.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
i2p: "http://pjsfdrtv2465bisenvzhfvdleznx4arlih2hlnrhpzugailnm7iq.b32.i2p",
icon: "/icons/gitea.svg"
@ -209,19 +253,22 @@ const instances: Instances[] = [
{
name: "Hedgedoc",
description: "Collaborative markdown notes.",
eu: "https://doc.projectsegfau.lt",
eu: "https://doc.projectsegfau.lt/",
short_eu: "https://d.psf.lt/",
icon: "/icons/hedgedoc.svg"
},
{
name: "Akkoma",
description: "Federated microblogging platform.",
eu: "https://social.projectsegfau.lt/",
short_eu: "https://ak.psf.lt/",
icon: "/icons/akkoma.png"
},
{
name: "Vikunja",
description: "A task management platform.",
eu: "https://todo.projectsegfau.lt/",
short_eu: "https://vi.psf.lt/",
tor: "http://todo.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
i2p: "http://pjsfivs2sxudfy65kojxqophc6vqjqdr6woczy6hzaxvxvbj3bkq.b32.i2p",
icon: "/icons/vikunja.png"
@ -229,26 +276,29 @@ const instances: Instances[] = [
{
name: "Jitsi",
description: "An open source video conferencing platform.",
eu: "https://jitsi.projectsegfau.lt",
eu: "https://jitsi.projectsegfau.lt/",
short_eu: "https://j.psf.lt/",
icon: "/icons/jitsi.svg"
},
{
name: "Vaultwarden",
description: "An open source password manager.",
eu: "https://pass.projectsegfau.lt",
eu: "https://pass.projectsegfau.lt/",
short_eu: "https://vw.psf.lt/",
tor: "http://pass.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
icon: "/icons/vaultwarden.svg"
},
{
name: "Plausible analytics",
description: "Analytics for our website.",
eu: "https://analytics.projectsegfau.lt/projectsegfau.lt",
eu: "https://analytics.projectsegfau.lt/",
icon: "/icons/plausible.png"
},
{
name: "Healthchecks",
description: "Simple and Effective Cron Job Monitoring.",
eu: "https://healthchecks.projectsegfau.lt",
eu: "https://healthchecks.projectsegfau.lt/",
short_eu: "https://hc.psf.lt/",
icon: "/icons/healthchecks.svg"
}
]
@ -259,19 +309,20 @@ const instances: Instances[] = [
{
name: "Pubnix",
description: "A Unix server open to the public with non-commercial recreational goals.",
eu: "https://p.projectsegfau.lt",
eu: "https://p.projectsegfau.lt/",
short_eu: "https://p.psf.lt/",
icon: "/icons/pubnix.png"
},
{
name: "Public Authentik",
description: "Authentik for signup to our services.",
eu: "https://auth.p.projectsegfau.lt",
eu: "https://auth.p.projectsegfau.lt/",
icon: "/icons/authentik.svg"
},
{
name: "Cockpit",
description: "WebUI for users to access the pubnix services.",
eu: "https://cockpit.p.projectsegfau.lt",
eu: "https://cockpit.p.projectsegfau.lt/",
icon: "/icons/cockpit.svg"
},
{
@ -282,7 +333,8 @@ const instances: Instances[] = [
{
name: "Gemini Proxy",
description: "Access Gemini sites from the web.",
eu: "https://geminiproxy.p.projectsegfau.lt",
eu: "https://geminiproxy.p.projectsegfau.lt/",
short_eu: "https://gp.p.psf.lt/"
}
]
},
@ -311,12 +363,14 @@ const instances: Instances[] = [
name: "SimpleLogin",
description: "An open source email alias creator/manager",
eu: "https://sl.projectsegfau.lt/",
short_eu: "https://sl.psf.lt/",
icon: "/icons/simplelogin.svg"
},
{
name: "MediaWiki",
description: "Our wiki.",
eu: "https://wiki.projectsegfau.lt/",
short_eu: "https://w.psf.lt/",
tor: "http://wiki.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion",
icon: "/icons/mediawiki.svg"
}

View File

@ -15,9 +15,7 @@ export const actions: Actions = {
const BodyTypeSchema = Joi.object({
username: Joi.string()
.required()
.pattern(
/^[a-z_][a-z0-9_]{0,20}$/
)
.pattern(/^[a-z_][a-z0-9_]{0,20}$/)
.message("Invalid username ([A-Za-z0-9_])"),
email: Joi.string().email().required(),
ssh: Joi.string()
@ -26,7 +24,10 @@ export const actions: Actions = {
/^(ssh-rsa|ssh-ed25519|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521) [A-Za-z0-9+/]+[=]{0,3}( [^@]+@[^@]+)?$/
)
.message("Invalid SSH key"),
ip: Joi.string().required().ip()
ip: Joi.string().required().ip(),
"h-captcha-response": Joi.string().required().messages({
"any.only": "Captcha is required."
})
});
formData.append("ip", getClientAddress());

View File

@ -1,7 +1,11 @@
<script lang="ts">
import type { ActionData, PageData } from "./$types";
import HCaptcha from "svelte-hcaptcha";
export let form: ActionData;
export let data: PageData;
let siteKey = "cb477b1b-6f87-43ee-aa79-71e3302fbb34";
//export const hcaptchaSiteKey = env.HCAPTCHA_SITE_KEY;
</script>
<h1>{data.title}</h1>
@ -43,6 +47,13 @@
rows="5"
required
/>
<div>
<label for="h-captcha-response"
><HCaptcha sitekey={siteKey} />
</label>
</div>
</div>
{#if form?.success}
@ -53,6 +64,10 @@
{form.message}
{/if}
<div style="display:block;" >
<input type="checkbox" style="display:inline-block;width: 1em;margin-right: 10px;" required><p style="display:inline-block;word-break: break-all;">I agree to the <a href="/legal/tos">Terms of Service</p>.
</div>
<button
type="submit"
class="transition-filter duration-200 hover:brightness-75"

View File

@ -22,7 +22,7 @@ export default defineConfig({
transformers: [transformerVariantGroup(), transformerDirectives()],
safelist: ["i-ic:outline-dark-mode", "i-ic:outline-light-mode"],
safelist: ["i-ic:outline-dark-mode", "i-ic:outline-light-mode", "i-ic:baseline-toggle-on", "i-ic:baseline-toggle-off"],
theme: {
fontFamily: {