Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ba7b137
Add mise dependencies watchwoman
dodok8 Jul 22, 2026
f69553e
Add solid-relay dependencies
dodok8 Jul 22, 2026
a76134d
Add solid-relay dependencies
dodok8 Jul 22, 2026
3b4d22a
Add graphql schema to .gitignore
dodok8 Jul 23, 2026
716cba1
Add index.db to .gitginore
dodok8 Jul 23, 2026
e35c47d
Update check files to ignore __gnerated__
dodok8 Jul 23, 2026
486c704
Remove watchwoman
dodok8 Jul 23, 2026
e4f9f96
Add Realy Config
dodok8 Jul 23, 2026
06dc489
Add allowed unpopular packages pglite-cli
dodok8 Jul 23, 2026
1c7f365
Update vite.config to bypass watchman
dodok8 Jul 23, 2026
94e8fe9
Set lateset to fixed version
dodok8 Jul 23, 2026
d25eed7
Turn off node/no-top-level-await rule
dodok8 Jul 23, 2026
bbc1a83
Update .gitignore to ignore generated ts file
dodok8 Jul 23, 2026
22039f1
Set graphql sever URI Configurable
dodok8 Jul 25, 2026
f145386
Seperate build:server command
dodok8 Jul 26, 2026
5ca6148
Delete HomeViewerQuery.graphql.ts
dodok8 Jul 26, 2026
bddf586
Ignore __generated__/
dodok8 Jul 26, 2026
1a83a06
Enable --noWatchman Option
dodok8 Jul 26, 2026
c992447
Disable oxc/no-async-await
dodok8 Jul 23, 2026
58c521d
Create sign-in.tsx
dodok8 Jul 23, 2026
db64f82
FIXME: Add allowlist
dodok8 Jul 23, 2026
d57ff99
Turn off eslint/max-lines-per-function rule
dodok8 Jul 23, 2026
99c86c3
Solve CORS Problem
dodok8 Jul 25, 2026
ec424ab
Add Sign-in Page
dodok8 Jul 23, 2026
03da846
Add confirm/slug page
dodok8 Jul 23, 2026
68859e5
Add drfed.css
dodok8 Jul 25, 2026
a5a8da9
Update Design of Sign-In Page
dodok8 Jul 25, 2026
8a4573b
Enable Temporal in @drfed/web
sij411 Jul 25, 2026
fbc3c4f
Add session
sij411 Jul 26, 2026
58c9f12
Authenticate Relay requests with session Cookie
sij411 Jul 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
branches: ["**"]
tags: ["*.*.*"]

env:
AUBE_ALLOWED_UNPOPULAR_PACKAGES: pglite-cli

jobs:
check:
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
.DS_Store
*.graphql
*.graphql.ts
__generated__/

.pgdata/

node_modules/
packages/*/dist/

index.db
3 changes: 2 additions & 1 deletion .oxfmtrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"**/dist/*.{cjs,d.cts,d.mts,d.ts,js,mjs}",
".agents/skills/",
".claude/skills/",
"plans/"
"plans/",
"**/__generated__/**"
]
}
4 changes: 4 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
{ "ignoreConsecutiveComments": true }
],
"eslint/curly": ["error", "multi-line"],
"node/no-top-level-await": "off",
"oxc/no-optional-chaining": "off",
"oxc/no-async-await": "off",
"eslint/eqeqeq": ["off", "smart"],
"eslint/func-style": ["off"],
"eslint/max-lines-per-function": "off",
"eslint/id-length": ["warn", { "exceptionPatterns": ["^_", "^[Tertv]$"] }],
"eslint/init-declarations": "off",
"eslint/max-params": ["warn", { "max": 4 }],
Expand Down
39 changes: 27 additions & 12 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ min_version = "2026.6.10"

[tools]
"aqua:dahlia/hongdown" = "0.4.3"
"github:nushell/nushell" = "latest"
"github:nushell/nushell" = "0.114.1"
node = "26"
"npm:@typescript/native-preview" = "7.0.0-dev.20260620.1"
"npm:oxlint" = "latest"
"npm:oxlint-tsgolint" = "latest"
"npm:pglite-cli" = "latest"
"npm:oxlint" = "1.75.0"
"npm:oxlint-tsgolint" = "7.0.2001"
"npm:pglite-cli" = "0.0.1"
oxfmt = "0.55.0"
pnpm = "11"

Expand All @@ -17,10 +17,26 @@ auto = true
[hooks]
postinstall = ["mise deps", "mise generate git-pre-commit --task check --write"]

[tasks.build]
description = "Build the project"
depends = ["build:web"]
silent = "stdout"

[tasks."build:server"]
description = "Build the project except web"
run = "pnpm --parallel -F @drfed/graphql -F @drfed/models -F @drfed/drfed build"
silent = "stdout"

[tasks."build:web"]
description = "Build SolidStart frontend server"
depends = [
{ task = "generate:graphql-schema", args = [
"--output-file",
"packages/web/schema.graphql",
] },
]
dir = "./packages/web"
run = "pnpm run build"
run = "pnpm exec relay-compiler --noWatchman && pnpm run build"

[tasks.check]
description = "Check all"
Expand Down Expand Up @@ -77,11 +93,6 @@ run = """
node scripts/add-license/main.mts
"""

[tasks.build]
description = "Build the project"
run = "pnpm run --parallel --recursive build"
silent = "stdout"

[tasks.test]
description = "Run tests"
depends = ["build"]
Expand Down Expand Up @@ -130,7 +141,7 @@ description = "Generate GraphQL schema"
usage = """
flag "-o --output-file <file>" help="The output file for the generated GraphQL schema. - for stdout. Defaults to -"
"""
depends = ["build"]
depends = ["build:server"]
run = """
#!/usr/bin/env nu
let output_file = (if "usage_output_file" in $env { $env.usage_output_file } else { "-" })
Expand All @@ -154,7 +165,11 @@ run = "node scripts/dev.mts"
raw_args = true
description = "Run SolidStart frontend server"
dir = "./packages/web"
run = "pnpm run dev"
run = """
#!/usr/bin/env nu
mise run generate:graphql-schema --output-file ./packages/web/schema.graphql
pnpm run dev
"""

[tasks."drfed-server"]
description = "Invoke drfed-server command"
Expand Down
13 changes: 12 additions & 1 deletion packages/graphql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export function createYogaServer(
): YogaServerInstance<ServerContext, UserContext> {
const options = fillOptions(_options);
return createYoga({
cors: {
origin: [...options.origins],
credentials: true,
},
async context(ctx) {
const anonymous = { db, request: ctx.request, ...options };
const accessToken = getAccessToken(ctx.request.headers);
Expand Down Expand Up @@ -92,7 +96,14 @@ function mockTransport() {
const fillOptions = (opt: YogaServerOptions): Required<YogaServerOptions> => ({
mailer: opt?.mailer ?? mockTransport(),
emailFrom: opt?.emailFrom ?? "noreply@drfed.org",
origins: opt?.origins ?? new Set(["https://drfed.org"]),
// FIXME: Properly parametrize the following allowlist:
origins:
opt?.origins ??
new Set([
"https://drfed.org",
"http://localhost:5173",
"http://0.0.0.0:5173",
]),
});

const getAccessToken = (headers: Headers) =>
Expand Down
1 change: 1 addition & 0 deletions packages/web/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_DRFED_URL=http://0.0.0.0:8888/graphql
1 change: 1 addition & 0 deletions packages/web/.oxlintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extends": ["../../.oxlintrc.json"],
"ignorePatterns": ["**/__generated__/**"],
"jsPlugins": ["eslint-plugin-solid"],
"env": {
"browser": true,
Expand Down
7 changes: 7 additions & 0 deletions packages/web/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
interface ImportMetaEnv {
readonly VITE_DRFED_URL: string;
}

interface ImportMeta {
readonly env: ImportMetaEnv;
}
8 changes: 7 additions & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@
"@solidjs/router": "^0.15.0",
"@solidjs/start": "2.0.0-alpha.2",
"@solidjs/vite-plugin-nitro-2": "^0.1.0",
"relay-runtime": "^21.0.1",
"solid-js": "^1.9.5",
"solid-relay": "1.0.0-beta.27",
"vite": "^7.0.0"
},
"devDependencies": {
"eslint-plugin-solid": "^0.14.5"
"@types/relay-runtime": "^20.1.1",
"eslint-plugin-solid": "^0.14.5",
"relay-compiler": "^21.0.1",
"vite-plugin-cjs-interop": "^4.0.3",
"vite-plugin-relay-lite": "^0.12.0"
}
}
6 changes: 6 additions & 0 deletions packages/web/relay.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"src": "./src",
"schema": "./schema.graphql",
"language": "typescript",
"eagerEsModules": true
}
57 changes: 57 additions & 0 deletions packages/web/src/RelayEnviroment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// DrFed: A web-based platform for developing and debugging ActivityPub apps
// Copyright (C) 2026 DrFed team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

import {
Environment,
type FetchFunction,
Network,
RecordSource,
Store,
} from "relay-runtime";
import { getRequestEvent } from "solid-js/web";

import { readSessionCookie } from "./routes/session.ts";

// oxlint-disable no-async-await
const fetchFn: FetchFunction = async (params, variables) => {
const event = getRequestEvent();
const accessToken = readSessionCookie(event?.request);
const headers: Record<string, string> = {
"Content-Type": "application/json",
};
if (accessToken !== undefined) {
headers.Authorization = `Bearer ${accessToken}`;
}
const response = await fetch(import.meta.env.VITE_DRFED_URL, {
method: "POST",
headers,
body: JSON.stringify({
query: params.text,
variables,
}),
credentials: "include"
});

// oxlint-disable return-await no-unsafe-return
return await response.json();
};

export function createRelayEnvironment() {
return new Environment({
network: Network.create(fetchFn),
store: new Store(new RecordSource()),
});
}
Loading
Loading