some quick fixes
This commit is contained in:
parent
7ffd99497c
commit
548381734a
5 changed files with 20 additions and 4 deletions
|
@ -11,7 +11,7 @@
|
|||
"scripts": {
|
||||
"rebuild": "pnpm run clean && pnpm -r run build && pnpm run gulp",
|
||||
"build": "pnpm -r run build && pnpm run gulp",
|
||||
"start": "pnpm check:connect && pnpm --filter backend run start",
|
||||
"start": "pnpm --filter backend run start",
|
||||
"start:test": "pnpm --filter backend run start:test",
|
||||
"init": "pnpm run migrate",
|
||||
"migrate": "pnpm --filter backend run migrate",
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
"jsonld": "6.0.0",
|
||||
"jsrsasign": "10.6.1",
|
||||
"koa": "2.13.4",
|
||||
"koa-remove-trailing-slashes": "2.0.3",
|
||||
"koa-bodyparser": "4.3.0",
|
||||
"koa-favicon": "2.1.0",
|
||||
"koa-json-body": "5.3.0",
|
||||
|
|
1
packages/backend/src/@types/koa-remove-trailing-slashes/index.d.ts
vendored
Normal file
1
packages/backend/src/@types/koa-remove-trailing-slashes/index.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
declare module 'koa-remove-trailing-slashes';
|
|
@ -30,6 +30,7 @@ import proxyServer from "./proxy/index.js";
|
|||
import webServer from "./web/index.js";
|
||||
import { initializeStreamingServer } from "./api/streaming.js";
|
||||
import { koaBody } from "koa-body";
|
||||
import * as removeTrailingSlash from "koa-remove-trailing-slashes";
|
||||
|
||||
export const serverLogger = new Logger("server", "gray", false);
|
||||
|
||||
|
@ -37,6 +38,8 @@ export const serverLogger = new Logger("server", "gray", false);
|
|||
const app = new Koa();
|
||||
app.proxy = true;
|
||||
|
||||
app.use(removeTrailingSlash());
|
||||
|
||||
if (!["production", "test"].includes(process.env.NODE_ENV || "")) {
|
||||
// Logger
|
||||
app.use(
|
||||
|
@ -154,10 +157,15 @@ router.get("/verify-email/:code", async (ctx) => {
|
|||
});
|
||||
|
||||
mastoRouter.get("/oauth/authorize", async (ctx) => {
|
||||
const { client_id, state, redirect_uri } = ctx.request.query.client_id;
|
||||
const { client_id, state, redirect_uri } = ctx.request.query;
|
||||
console.log(ctx.request.req);
|
||||
const param = state ? `state=${state}&mastodon=true` : "mastodon=true";
|
||||
ctx.redirect(`${Buffer.from(client_id || '', 'base64').toString()}?${param}`);
|
||||
let param = "mastodon=true";
|
||||
if (state)
|
||||
param += `&state=${state}`;
|
||||
if (redirect_uri)
|
||||
param += `&redirect_uri=${redirect_uri}`;
|
||||
const client = client_id? client_id : "";
|
||||
ctx.redirect(`${Buffer.from(client.toString(), 'base64').toString()}?${param}`);
|
||||
});
|
||||
|
||||
mastoRouter.post("/oauth/token", async (ctx) => {
|
||||
|
|
|
@ -162,6 +162,7 @@ importers:
|
|||
koa-json-body: 5.3.0
|
||||
koa-logger: 3.2.1
|
||||
koa-mount: 4.0.0
|
||||
koa-remove-trailing-slashes: 2.0.3
|
||||
koa-send: 5.0.1
|
||||
koa-slow: 2.1.0
|
||||
koa-views: 7.0.2
|
||||
|
@ -277,6 +278,7 @@ importers:
|
|||
koa-json-body: 5.3.0
|
||||
koa-logger: 3.2.1
|
||||
koa-mount: 4.0.0
|
||||
koa-remove-trailing-slashes: 2.0.3
|
||||
koa-send: 5.0.1
|
||||
koa-slow: 2.1.0
|
||||
koa-views: 7.0.2_6tybghmia4wsnt33xeid7y4rby
|
||||
|
@ -8266,6 +8268,10 @@ packages:
|
|||
- supports-color
|
||||
dev: false
|
||||
|
||||
/koa-remove-trailing-slashes/2.0.3:
|
||||
resolution: {integrity: sha512-NFFF9Sl1wxFo5h0I3OzrHDINdFPaqG+Hx19590F7PNOcmm7yYeFW71p4XicVuSovbcx75GWGb3fi6N6kI6E/3g==}
|
||||
dev: false
|
||||
|
||||
/koa-router/10.1.1:
|
||||
resolution: {integrity: sha512-z/OzxVjf5NyuNO3t9nJpx7e1oR3FSBAauiwXtMQu4ppcnuNZzTaQ4p21P8A6r2Es8uJJM339oc4oVW+qX7SqnQ==}
|
||||
engines: {node: '>= 8.0.0'}
|
||||
|
|
Loading…
Reference in a new issue