Compare commits
No commits in common. "3cf9e024c09e30e36cdb02995ea7d448b850b821" and "0ccfdbb78e87b961f4ab336de3e771bed1cb9e9b" have entirely different histories.
3cf9e024c0
...
0ccfdbb78e
24 changed files with 29 additions and 220 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@yusurko/vigil",
|
"name": "@yusurko/vigil",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.1.0-dev47",
|
"version": "0.1.0-dev43",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
||||||
let { query }: {query?: string} = $props();
|
let { query = $bindable<string>() }: {query?: string} = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<input value={query} type="search" name="query" class="bigsearch" />
|
<input value={query} type="search" name="query" class="bigsearch" />
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
let { narrow = false, small = false, children } : { narrow?: boolean, small ?: boolean, children: any } = $props();
|
let { narrow = false, children } : { narrow?: boolean, children: any } = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="centered" class:narrow={narrow} class:small={small}>
|
<div class="centered" class:narrow={narrow}>
|
||||||
{@render children () }
|
{@render children () }
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.centered {text-align: center;}
|
.centered {text-align: center;}
|
||||||
.centered.narrow { max-width: 400px; margin: auto; }
|
.centered.narrow { max-width: 400px; margin: auto; }
|
||||||
.centered.small { font-size: smaller; }
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import Centered from "./Centered.svelte";
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Centered small={true}>
|
|
||||||
<p>© 2021-2025 Sakuragasaki46.</p>
|
|
||||||
<ul>
|
|
||||||
<li><a href="/about">About</a></li>
|
|
||||||
<li><a href="/terms">Terms</a></li>
|
|
||||||
<li><a href="/privacy">Privacy</a></li>
|
|
||||||
<li><a href="https://nekode.yusur.moe/yusur/freak" target="_blank">GitHub</a></li>
|
|
||||||
</ul>
|
|
||||||
</Centered>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
ul {
|
|
||||||
list-style: none;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: stretch;
|
|
||||||
max-width: 640px;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul > li {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -19,11 +19,12 @@
|
||||||
<style>
|
<style>
|
||||||
ul {
|
ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul > li {
|
ul > li {
|
||||||
margin: 3px 0;
|
margin-top: 3px;
|
||||||
|
margin-bottom: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.big {
|
p.big {
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,10 @@ let { id, title, content = "", votes, my_vote, comment_count } = post;
|
||||||
.post-frame {
|
.post-frame {
|
||||||
padding-inline-start: 2em;
|
padding-inline-start: 2em;
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 7em;
|
|
||||||
}
|
}
|
||||||
.message-stats {
|
.message-stats {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset-inline-start: -6px;
|
inset-inline-start: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 2em;
|
width: 2em;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -81,13 +81,12 @@ let { title, id, content = '', to, votes, my_vote, comment_count } = post;
|
||||||
}
|
}
|
||||||
.message-stats {
|
.message-stats {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset-inline-start: -6px;
|
inset-inline-start: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 2em;
|
width: 2em;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-inline-end: 6px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -27,7 +27,7 @@ let me = $derived(getMe());
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
position: fixed;
|
position: sticky;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,4 @@ let { post } : {post: PostEntry }= $props();
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
ul.post-meta > li { margin-inline-end: 9px; }
|
ul.post-meta > li { margin-inline-end: 9px; }
|
||||||
|
|
||||||
@media (max-width:799px) {
|
|
||||||
ul.post-meta {
|
|
||||||
font-size: .8em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -28,12 +28,12 @@ let mobiRightActive = $state(false);
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
". title ."
|
". title ."
|
||||||
"left center right";
|
"left center right";
|
||||||
padding: 1em 2em;
|
margin: 1em 2em;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-left { grid-area: left; padding-inline-end: 1em; }
|
.layout-left { grid-area: left; padding-right: 1em; }
|
||||||
.layout-right { grid-area: right; padding-inline-start: 1em; }
|
.layout-right { grid-area: right; padding-left: 1em; }
|
||||||
.layout-content { grid-area: center; }
|
.layout-content { grid-area: center; }
|
||||||
.layout-title { grid-area: title; text-align: center; font-size: 1.4em; }
|
.layout-title { grid-area: title; text-align: center; font-size: 1.4em; }
|
||||||
|
|
||||||
|
|
@ -86,8 +86,6 @@ let mobiRightActive = $state(false);
|
||||||
"center center center";
|
"center center center";
|
||||||
|
|
||||||
grid-template-columns: 2em auto 2em;
|
grid-template-columns: 2em auto 2em;
|
||||||
|
|
||||||
padding: 1em .5em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-left, .layout-right { display: none; }
|
.layout-left, .layout-right { display: none; }
|
||||||
|
|
@ -109,10 +107,6 @@ let mobiRightActive = $state(false);
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-content {
|
|
||||||
font-size: .9em;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import type { ServerHealth, UserEntry } from '$lib/backend';
|
||||||
import { getFlash } from 'sveltekit-flash-message';
|
import { getFlash } from 'sveltekit-flash-message';
|
||||||
import { page } from "$app/state";
|
import { page } from "$app/state";
|
||||||
import FlashMessage from '$lib/FlashMessage.svelte';
|
import FlashMessage from '$lib/FlashMessage.svelte';
|
||||||
import DesktopFooter from '$lib/DesktopFooter.svelte';
|
|
||||||
|
|
||||||
let { data, children } : {
|
let { data, children } : {
|
||||||
data: {me: UserEntry},
|
data: {me: UserEntry},
|
||||||
|
|
@ -54,8 +53,6 @@ let colorThemeCls = $derived(`color-scheme-${colorScheme} color-theme-${colorThe
|
||||||
{@render children()}
|
{@render children()}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<DesktopFooter />
|
|
||||||
|
|
||||||
<MobileFooter />
|
<MobileFooter />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
import { backend } from '$lib/backend.js';
|
|
||||||
import { redirect } from 'sveltekit-flash-message/server';
|
|
||||||
|
|
||||||
export const actions = {
|
|
||||||
|
|
||||||
async default (event) {
|
|
||||||
const { request }= event;
|
|
||||||
|
|
||||||
const data = await request.formData();
|
|
||||||
const guildName = ''+data.get('to');
|
|
||||||
const title = data.get('title');
|
|
||||||
const content = data.get('content');
|
|
||||||
const privacy = +(data.get('privacy') || 0);
|
|
||||||
|
|
||||||
const backend2 = await backend.withEvent(event).oath();
|
|
||||||
const resp = await backend2.submitJson(`guild/@${encodeURIComponent(guildName)}`, {
|
|
||||||
title, content, privacy
|
|
||||||
})
|
|
||||||
|
|
||||||
const { status } = resp;
|
|
||||||
const respData = await resp.json();
|
|
||||||
|
|
||||||
if ([200, 204].indexOf(status) < 0) {
|
|
||||||
// error
|
|
||||||
console.log(`/create: status ${status}`);
|
|
||||||
switch(status) {
|
|
||||||
case 403:
|
|
||||||
case 404:
|
|
||||||
redirect({
|
|
||||||
message: respData.error
|
|
||||||
}, event);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
redirect({message: `Unknown error (HTTP ${status})`}, event);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const { id: myId } = respData;
|
|
||||||
|
|
||||||
redirect(303, "/=" + myId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { enhance } from "$app/forms";
|
|
||||||
import Centered from "$lib/Centered.svelte";
|
import Centered from "$lib/Centered.svelte";
|
||||||
import EditPost from "$lib/EditPost.svelte";
|
import EditPost from "$lib/EditPost.svelte";
|
||||||
import { getMe } from "$lib/globals.svelte";
|
import { getMe } from "$lib/globals.svelte";
|
||||||
|
|
@ -13,15 +12,14 @@
|
||||||
let content = $state("");
|
let content = $state("");
|
||||||
let privacy = $state(0);
|
let privacy = $state(0);
|
||||||
let guildName = $state("");
|
let guildName = $state("");
|
||||||
//let guildInfo = $state(null);
|
|
||||||
|
|
||||||
let enablePost = $derived(!!content && !!guildName);
|
let enablePost = $derived(!!content && !!guildName && false);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
{#if me}
|
{#if me}
|
||||||
<SLayout title="New post">
|
<SLayout title="New post">
|
||||||
<form method="POST" class="card" use:enhance>
|
<form method="POST" class="card">
|
||||||
<p>Posting as <strong>@{me.username}</strong></p>
|
<p>Posting as <strong>@{me.username}</strong></p>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ export const actions = {
|
||||||
// login success
|
// login success
|
||||||
const { id: myId } = respData;
|
const { id: myId } = respData;
|
||||||
|
|
||||||
redirect(303, "/@" + myId);
|
redirect(303, "/user/" + myId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} satisfies Actions;
|
} satisfies Actions;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { SvelteShowdown } from "svelte-showdown";
|
|
||||||
|
|
||||||
let { data }: { data: {content: string} } = $props();
|
|
||||||
|
|
||||||
let { content } = data;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<article class="card">
|
|
||||||
<p class="faint">Privacy Policy</p>
|
|
||||||
|
|
||||||
<SvelteShowdown {content} />
|
|
||||||
</article>
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import { backend } from '$lib/backend.js';
|
|
||||||
import { error } from '@sveltejs/kit';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export async function load(event) {
|
|
||||||
|
|
||||||
const resp = await backend.withEvent(event).fetch('about/privacy');
|
|
||||||
|
|
||||||
if(resp.status === 404) {
|
|
||||||
error(404);
|
|
||||||
}
|
|
||||||
|
|
||||||
const respJ = await resp.json();
|
|
||||||
|
|
||||||
const { content } = respJ;
|
|
||||||
|
|
||||||
return { content };
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { SvelteShowdown } from "svelte-showdown";
|
|
||||||
|
|
||||||
let { data }: { data: {content: string} } = $props();
|
|
||||||
|
|
||||||
let { content } = data;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<article class="card">
|
|
||||||
<p class="faint">Community Guidelines</p>
|
|
||||||
|
|
||||||
<SvelteShowdown {content} />
|
|
||||||
</article>
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import { backend } from '$lib/backend.js';
|
|
||||||
import { error } from '@sveltejs/kit';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export async function load(event) {
|
|
||||||
|
|
||||||
const resp = await backend.withEvent(event).fetch('about/rules');
|
|
||||||
|
|
||||||
if(resp.status === 404) {
|
|
||||||
error(404);
|
|
||||||
}
|
|
||||||
|
|
||||||
const respJ = await resp.json();
|
|
||||||
|
|
||||||
const { content } = respJ;
|
|
||||||
|
|
||||||
return { content };
|
|
||||||
}
|
|
||||||
|
|
@ -32,9 +32,12 @@ export const actions = {
|
||||||
event.locals.results = results;
|
event.locals.results = results;
|
||||||
event.locals.query = query;
|
event.locals.query = query;
|
||||||
console.log(event.locals);
|
console.log(event.locals);
|
||||||
|
|
||||||
return { results, query };
|
|
||||||
}
|
}
|
||||||
} satisfies Actions;
|
} satisfies Actions;
|
||||||
|
|
||||||
|
export function load (event) {
|
||||||
|
const { results, query } = event.locals;
|
||||||
|
|
||||||
|
return { results, query };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,23 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { enhance } from "$app/forms";
|
import { enhance } from "$app/forms";
|
||||||
import type { PostEntry } from "$lib/backend";
|
|
||||||
import BigSearchInput from "$lib/BigSearchInput.svelte";
|
import BigSearchInput from "$lib/BigSearchInput.svelte";
|
||||||
import Feed from "$lib/Feed.svelte";
|
import Feed from "$lib/Feed.svelte";
|
||||||
import { RiSearchLine } from "svelte-remixicon";
|
import { RiSearchLine } from "svelte-remixicon";
|
||||||
|
import type { PageProps } from "./$types";
|
||||||
|
|
||||||
let { data }: {
|
let { data }: PageProps = $props();
|
||||||
data: {
|
console.log(data);
|
||||||
query: string,
|
|
||||||
results: PostEntry[]
|
|
||||||
}
|
|
||||||
} = $props();
|
|
||||||
let { query, results } = $derived(data);
|
let { query, results } = $derived(data);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form method="POST" use:enhance>
|
<form method="POST" use:enhance>
|
||||||
<ul class="row">
|
<ul class="row">
|
||||||
<BigSearchInput {query} />
|
<BigSearchInput bind:query />
|
||||||
<button type="submit" class="inline"><RiSearchLine /></button>
|
<button class="inline"><RiSearchLine /></button>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{#if query}
|
{#if query}
|
||||||
<Feed posts={results} />
|
<Feed posts={results} />
|
||||||
{:else}
|
|
||||||
<p>Search function is broken!</p>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { SvelteShowdown } from "svelte-showdown";
|
|
||||||
|
|
||||||
let { data }: { data: {content: string} } = $props();
|
|
||||||
|
|
||||||
let { content } = data;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<article class="card">
|
|
||||||
<p class="faint">Terms of Service</p>
|
|
||||||
|
|
||||||
<SvelteShowdown {content} />
|
|
||||||
</article>
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import { backend } from '$lib/backend.js';
|
|
||||||
import { error } from '@sveltejs/kit';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export async function load(event) {
|
|
||||||
|
|
||||||
const resp = await backend.withEvent(event).fetch('about/terms');
|
|
||||||
|
|
||||||
if(resp.status === 404) {
|
|
||||||
error(404);
|
|
||||||
}
|
|
||||||
|
|
||||||
const respJ = await resp.json();
|
|
||||||
|
|
||||||
const { content } = respJ;
|
|
||||||
|
|
||||||
return { content };
|
|
||||||
}
|
|
||||||
|
|
@ -11,6 +11,8 @@ export async function load(event) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const respJ = await resp.json();
|
const respJ = await resp.json();
|
||||||
|
|
||||||
let { users } = respJ;
|
let { users } = respJ;
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@ import { configDotenv } from 'dotenv';
|
||||||
|
|
||||||
configDotenv();
|
configDotenv();
|
||||||
|
|
||||||
console.info(`server name is ${process.env.SERVER_NAME}`);
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [sveltekit()],
|
plugins: [sveltekit()],
|
||||||
server: {
|
server: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue