Merge branch 'monorepo' into 'main'
Make Ditto a monorepo See merge request soapbox-pub/ditto!661
2
.vscode/launch.json
vendored
|
|
@ -8,7 +8,7 @@
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Launch Program",
|
"name": "Launch Program",
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"program": "${workspaceFolder}/src/server.ts",
|
"program": "${workspaceFolder}/packages/ditto/server.ts",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"runtimeExecutable": "deno",
|
"runtimeExecutable": "deno",
|
||||||
"runtimeArgs": [
|
"runtimeArgs": [
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ ENV PORT 5000
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN mkdir -p data && chown -R deno data
|
RUN mkdir -p data && chown -R deno data
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN deno cache --allow-import src/server.ts
|
RUN deno cache --allow-import packages/ditto/server.ts
|
||||||
RUN apt-get update && apt-get install -y unzip curl
|
RUN apt-get update && apt-get install -y unzip curl
|
||||||
RUN deno task soapbox
|
RUN deno task soapbox
|
||||||
CMD deno task start
|
CMD deno task start
|
||||||
|
|
|
||||||
15
deno.json
|
|
@ -1,15 +1,17 @@
|
||||||
{
|
{
|
||||||
"version": "1.1.0",
|
"workspace": [
|
||||||
|
"./packages/ditto"
|
||||||
|
],
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"start": "deno run -A --env-file --deny-read=.env src/server.ts",
|
"start": "deno run -A --env-file --deny-read=.env packages/ditto/server.ts",
|
||||||
"dev": "deno run -A --env-file --deny-read=.env --watch src/server.ts",
|
"dev": "deno run -A --env-file --deny-read=.env --watch packages/ditto/server.ts",
|
||||||
"hook": "deno run --allow-read --allow-run --allow-write https://deno.land/x/deno_hooks@0.1.1/mod.ts",
|
"hook": "deno run --allow-read --allow-run --allow-write https://deno.land/x/deno_hooks@0.1.1/mod.ts",
|
||||||
"db:export": "deno run -A --env-file --deny-read=.env scripts/db-export.ts",
|
"db:export": "deno run -A --env-file --deny-read=.env scripts/db-export.ts",
|
||||||
"db:import": "deno run -A --env-file --deny-read=.env scripts/db-import.ts",
|
"db:import": "deno run -A --env-file --deny-read=.env scripts/db-import.ts",
|
||||||
"db:cleanup": "deno run -A --env-file --deny-read=.env scripts/db-policy.ts",
|
"db:cleanup": "deno run -A --env-file --deny-read=.env scripts/db-policy.ts",
|
||||||
"db:migrate": "deno run -A --env-file --deny-read=.env scripts/db-migrate.ts",
|
"db:migrate": "deno run -A --env-file --deny-read=.env scripts/db-migrate.ts",
|
||||||
"nostr:pull": "deno run -A --env-file --deny-read=.env scripts/nostr-pull.ts",
|
"nostr:pull": "deno run -A --env-file --deny-read=.env scripts/nostr-pull.ts",
|
||||||
"debug": "deno run -A --env-file --deny-read=.env --inspect src/server.ts",
|
"debug": "deno run -A --env-file --deny-read=.env --inspect packages/ditto/server.ts",
|
||||||
"test": "deno test -A --env-file=.env.test --deny-read=.env --junit-path=./deno-test.xml",
|
"test": "deno test -A --env-file=.env.test --deny-read=.env --junit-path=./deno-test.xml",
|
||||||
"check": "deno check --allow-import .",
|
"check": "deno check --allow-import .",
|
||||||
"nsec": "deno run scripts/nsec.ts",
|
"nsec": "deno run scripts/nsec.ts",
|
||||||
|
|
@ -20,7 +22,7 @@
|
||||||
"stats:recompute": "deno run -A --env-file --deny-read=.env scripts/stats-recompute.ts",
|
"stats:recompute": "deno run -A --env-file --deny-read=.env scripts/stats-recompute.ts",
|
||||||
"soapbox": "curl -O https://dl.soapbox.pub/main/soapbox.zip && mkdir -p public && mv soapbox.zip public/ && cd public/ && unzip -o soapbox.zip && rm soapbox.zip",
|
"soapbox": "curl -O https://dl.soapbox.pub/main/soapbox.zip && mkdir -p public && mv soapbox.zip public/ && cd public/ && unzip -o soapbox.zip && rm soapbox.zip",
|
||||||
"trends": "deno run -A --env-file --deny-read=.env scripts/trends.ts",
|
"trends": "deno run -A --env-file --deny-read=.env scripts/trends.ts",
|
||||||
"clean:deps": "deno cache --reload src/app.ts",
|
"clean:deps": "deno cache --reload packages/ditto/app.ts",
|
||||||
"db:populate:nip05": "deno run -A --env-file --deny-read=.env scripts/db-populate-nip05.ts",
|
"db:populate:nip05": "deno run -A --env-file --deny-read=.env scripts/db-populate-nip05.ts",
|
||||||
"db:populate-search": "deno run -A --env-file --deny-read=.env scripts/db-populate-search.ts",
|
"db:populate-search": "deno run -A --env-file --deny-read=.env scripts/db-populate-search.ts",
|
||||||
"db:populate-extensions": "deno run -A --env-file --deny-read=.env scripts/db-populate-extensions.ts",
|
"db:populate-extensions": "deno run -A --env-file --deny-read=.env scripts/db-populate-extensions.ts",
|
||||||
|
|
@ -37,7 +39,7 @@
|
||||||
"./public"
|
"./public"
|
||||||
],
|
],
|
||||||
"imports": {
|
"imports": {
|
||||||
"@/": "./src/",
|
"@/": "./packages/ditto/",
|
||||||
"@b-fuze/deno-dom": "jsr:@b-fuze/deno-dom@^0.1.47",
|
"@b-fuze/deno-dom": "jsr:@b-fuze/deno-dom@^0.1.47",
|
||||||
"@bradenmacdonald/s3-lite-client": "jsr:@bradenmacdonald/s3-lite-client@^0.7.4",
|
"@bradenmacdonald/s3-lite-client": "jsr:@bradenmacdonald/s3-lite-client@^0.7.4",
|
||||||
"@cashu/cashu-ts": "npm:@cashu/cashu-ts@^2.2.0",
|
"@cashu/cashu-ts": "npm:@cashu/cashu-ts@^2.2.0",
|
||||||
|
|
@ -71,7 +73,6 @@
|
||||||
"comlink": "npm:comlink@^4.4.1",
|
"comlink": "npm:comlink@^4.4.1",
|
||||||
"comlink-async-generator": "npm:comlink-async-generator@^0.0.1",
|
"comlink-async-generator": "npm:comlink-async-generator@^0.0.1",
|
||||||
"commander": "npm:commander@12.1.0",
|
"commander": "npm:commander@12.1.0",
|
||||||
"deno.json": "./deno.json",
|
|
||||||
"entities": "npm:entities@^4.5.0",
|
"entities": "npm:entities@^4.5.0",
|
||||||
"fast-stable-stringify": "npm:fast-stable-stringify@^1.0.0",
|
"fast-stable-stringify": "npm:fast-stable-stringify@^1.0.0",
|
||||||
"formdata-helper": "npm:formdata-helper@^0.3.0",
|
"formdata-helper": "npm:formdata-helper@^0.3.0",
|
||||||
|
|
|
||||||
226
log.json
|
|
@ -178,7 +178,7 @@ const app = new Hono<AppEnv>({ strict: false });
|
||||||
/** User-provided files in the gitignored `public/` directory. */
|
/** User-provided files in the gitignored `public/` directory. */
|
||||||
const publicFiles = serveStatic({ root: './public/' });
|
const publicFiles = serveStatic({ root: './public/' });
|
||||||
/** Static files provided by the Ditto repo, checked into git. */
|
/** Static files provided by the Ditto repo, checked into git. */
|
||||||
const staticFiles = serveStatic({ root: './static/' });
|
const staticFiles = serveStatic({ root: new URL('./static/', import.meta.url).pathname });
|
||||||
|
|
||||||
app.use('*', cacheControlMiddleware({ noStore: true }));
|
app.use('*', cacheControlMiddleware({ noStore: true }));
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 997 B After Width: | Height: | Size: 997 B |
|
Before Width: | Height: | Size: 696 B After Width: | Height: | Size: 696 B |
|
|
@ -18,7 +18,7 @@ export const frontendController: AppMiddleware = async (c) => {
|
||||||
c.header('Cache-Control', 'max-age=86400, s-maxage=30, public, stale-if-error=604800');
|
c.header('Cache-Control', 'max-age=86400, s-maxage=30, public, stale-if-error=604800');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const content = await Deno.readTextFile(new URL('../../public/index.html', import.meta.url));
|
const content = await Deno.readTextFile(new URL('../../../public/index.html', import.meta.url));
|
||||||
|
|
||||||
if (content.includes(META_PLACEHOLDER)) {
|
if (content.includes(META_PLACEHOLDER)) {
|
||||||
const params = getPathParams(c.req.path);
|
const params = getPathParams(c.req.path);
|
||||||