Loading .gitlab-ci.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line build wiki: stage: build trigger: include: .gitlab/ci/wiki.yml allow_failure: true rules: - if: $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH .gitlab/ci/wiki.yml 0 → 100644 +16 −0 Original line number Diff line number Diff line # sync /doc/ to internal wiki repo for UI access # see #151 build-wiki: image: alpine stage: build before_script: - apk add --no-cache git git-subtree script: - git config user.email "ci@sc07.company" - git config user.name "ci" - git remote remove gitlab-wiki || true - git remote add gitlab-wiki "https://ci:$CI_TOKEN@sc07.dev/sc07/canvas.wiki.git" - git status - git checkout main - git pull - git push gitlab-wiki `git subtree split -P doc main`:main --force backend/src/handoff/index.ts +13 −0 Original line number Diff line number Diff line Loading @@ -4,7 +4,19 @@ import { router } from "./router.js"; export class Handoff { private static instance: Handoff; static canEnable() { return !!process.env.HANDOFF_TOKEN; } static get() { if (!process.env.HANDOFF_TOKEN) throw new Error("HANDOFF_TOKEN not set, cannot use Handoff"); if (!this.canEnable()) throw new Error( "This should never occur, developer missed adding description throw above this line" ); if (!this.instance) this.instance = new Handoff(); return this.instance; Loading @@ -12,6 +24,7 @@ export class Handoff { private constructor() {} static readonly HANDOFF_TOKEN = process.env.HANDOFF_TOKEN!; readonly activitypub = new HandoffActivityPub(); readonly router = router; } backend/src/lib/DocLinks.ts 0 → 100644 +5 −0 Original line number Diff line number Diff line export const DocLinks = { SOURCE: "https://sc07.dev/sc07/fediverse-auth", DOCS: "https://sc07.dev/sc07/fediverse-auth/-/wikis", HANDOFF_DOCS: "https://sc07.dev/sc07/fediverse-auth/-/wikis/handoff", }; backend/src/lib/express.ts +25 −2 Original line number Diff line number Diff line Loading @@ -10,10 +10,11 @@ import { errors as OIDC_Errors } from "oidc-provider"; import "../types/session-types.js"; import { APIRouter } from "./api.js"; import { integrateFederation } from "@fedify/express"; import { federation } from "./apub/federation.js"; import { federation, USER_IDENTIFIER } from "./apub/federation.js"; import { APub } from "./apub/utils.js"; import { APIAdminRouter } from "./api_admin.js"; import { Handoff } from "../handoff/index.js"; import { DocLinks } from "./DocLinks.js"; export const app = express(); Loading Loading @@ -46,7 +47,29 @@ app.use( }) ); app.get("/.well-known/com.sc07.fediverse-auth", (req, res) => { res.json({ registration: { mode: process.env.OIDC_REGISTRATION_TOKEN ? "private" : "public", }, fediverse: { account: APub.accountHandle, }, handoff: Handoff.canEnable() ? { enabled: true, token: Handoff.HANDOFF_TOKEN } : { enabled: false }, _meta: { source: DocLinks.SOURCE, docs: DocLinks.DOCS, }, }); }); try { app.use("/handoff", Handoff.get().router); } catch (e) { console.warn("Failed to activate Handoff:", (e as any)?.message || e); } const interactionMiddleware = ( req: express.Request, Loading Loading
.gitlab-ci.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line build wiki: stage: build trigger: include: .gitlab/ci/wiki.yml allow_failure: true rules: - if: $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
.gitlab/ci/wiki.yml 0 → 100644 +16 −0 Original line number Diff line number Diff line # sync /doc/ to internal wiki repo for UI access # see #151 build-wiki: image: alpine stage: build before_script: - apk add --no-cache git git-subtree script: - git config user.email "ci@sc07.company" - git config user.name "ci" - git remote remove gitlab-wiki || true - git remote add gitlab-wiki "https://ci:$CI_TOKEN@sc07.dev/sc07/canvas.wiki.git" - git status - git checkout main - git pull - git push gitlab-wiki `git subtree split -P doc main`:main --force
backend/src/handoff/index.ts +13 −0 Original line number Diff line number Diff line Loading @@ -4,7 +4,19 @@ import { router } from "./router.js"; export class Handoff { private static instance: Handoff; static canEnable() { return !!process.env.HANDOFF_TOKEN; } static get() { if (!process.env.HANDOFF_TOKEN) throw new Error("HANDOFF_TOKEN not set, cannot use Handoff"); if (!this.canEnable()) throw new Error( "This should never occur, developer missed adding description throw above this line" ); if (!this.instance) this.instance = new Handoff(); return this.instance; Loading @@ -12,6 +24,7 @@ export class Handoff { private constructor() {} static readonly HANDOFF_TOKEN = process.env.HANDOFF_TOKEN!; readonly activitypub = new HandoffActivityPub(); readonly router = router; }
backend/src/lib/DocLinks.ts 0 → 100644 +5 −0 Original line number Diff line number Diff line export const DocLinks = { SOURCE: "https://sc07.dev/sc07/fediverse-auth", DOCS: "https://sc07.dev/sc07/fediverse-auth/-/wikis", HANDOFF_DOCS: "https://sc07.dev/sc07/fediverse-auth/-/wikis/handoff", };
backend/src/lib/express.ts +25 −2 Original line number Diff line number Diff line Loading @@ -10,10 +10,11 @@ import { errors as OIDC_Errors } from "oidc-provider"; import "../types/session-types.js"; import { APIRouter } from "./api.js"; import { integrateFederation } from "@fedify/express"; import { federation } from "./apub/federation.js"; import { federation, USER_IDENTIFIER } from "./apub/federation.js"; import { APub } from "./apub/utils.js"; import { APIAdminRouter } from "./api_admin.js"; import { Handoff } from "../handoff/index.js"; import { DocLinks } from "./DocLinks.js"; export const app = express(); Loading Loading @@ -46,7 +47,29 @@ app.use( }) ); app.get("/.well-known/com.sc07.fediverse-auth", (req, res) => { res.json({ registration: { mode: process.env.OIDC_REGISTRATION_TOKEN ? "private" : "public", }, fediverse: { account: APub.accountHandle, }, handoff: Handoff.canEnable() ? { enabled: true, token: Handoff.HANDOFF_TOKEN } : { enabled: false }, _meta: { source: DocLinks.SOURCE, docs: DocLinks.DOCS, }, }); }); try { app.use("/handoff", Handoff.get().router); } catch (e) { console.warn("Failed to activate Handoff:", (e as any)?.message || e); } const interactionMiddleware = ( req: express.Request, Loading