8000 Revert "chore: Upgrade `path-to-regexp`" by tommoor · Pull Request #8652 · outline/outline · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Revert "chore: Upgrade path-to-regexp" #8652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
8000 Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"crypto-js": "^4.2.0",
"datadog-metrics": "^0.11.2",
"date-fns": "^3.6.0",
"dd-trace": "^5.41.0",
"dd-trace": "^3.58.0",
"diff": "^5.2.0",
"dotenv": "^16.4.7",
"email-providers": "^1.14.0",
Expand Down Expand Up @@ -142,7 +142,7 @@
"koa-helmet": "^6.1.0",
"koa-logger": "^3.2.1",
"koa-mount": "^4.0.0",
"koa-router": "13.0.1",
"koa-router": "7.4.0",
"koa-send": "5.0.1",
"koa-sslify": "5.0.1",
"koa-useragent": "^4.1.0",
Expand Down Expand Up @@ -371,4 +371,4 @@
"rollup": "^4.5.1"
},
"version": "0.82.0"
}
}
4 changes: 2 additions & 2 deletions server/routes/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ if (env.isDevelopment) {
router.use("/", developer.routes());
}

router.post("*all", (ctx) => {
router.post("*", (ctx) => {
ctx.throw(NotFoundError("Endpoint not found"));
});

router.get("*all", (ctx) => {
router.get("*", (ctx) => {
ctx.throw(NotFoundError("Endpoint not found"));
});

Expand Down
52 changes: 25 additions & 27 deletions server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,41 @@ const router = new Router();
koa.use<BaseContext, UserAgentContext>(userAgent);

// serve public assets
router.use(
["/images/*path", "/email/*path", "/fonts/*path"],
async (ctx, next) => {
let done;

if (ctx.method === "HEAD" || ctx.method === "GET") {
try {
done = await send(ctx, ctx.path, {
root: path.resolve(__dirname, "../../../public"),
// 7 day expiry, these assets are mostly static but do not contain a hash
maxAge: Day.ms * 7,
setHeaders: (res) => {
res.setHeader("Access-Control-Allow-Origin", "*");
},
});
} catch (err) {
if (err.status !== 404) {
throw err;
}
router.use(["/images/*", "/email/*", "/fonts/*"], async (ctx, next) => {
let done;

if (ctx.method === "HEAD" || ctx.method === "GET") {
try {
done = await send(ctx, ctx.path, {
root: path.resolve(__dirname, "../../../public"),
// 7 day expiry, these assets are mostly static but do not contain a hash
maxAge: Day.ms * 7,
setHeaders: (res) => {
res.setHeader("Access-Control-Allow-Origin", "*");
},
});
} catch (err) {
if (err.status !== 404) {
throw err;
}
}
}

if (!done) {
await next();
}
if (!done) {
await next();
}
);
});

router.use(
["/share/:shareId{/*path}", "/share/:shareId/doc/:documentSlug"],
["/share/:shareId", "/share/:shareId/doc/:documentSlug", "/share/:shareId/*"],
(ctx) => {
ctx.redirect(ctx.path.replace(/^\/share/, "/s"));
ctx.status = 301;
}
);

if (env.isProduction) {
router.get("/static/*path", async (ctx) => {
router.get("/static/*", async (ctx) => {
try {
const pathname = ctx.path.substring(8);
if (!pathname) {
Expand Down Expand Up @@ -126,16 +123,17 @@ router.get("/opensearch.xml", (ctx) => {
ctx.body = opensearchResponse(ctx.request.URL.origin);
});

router.get("/s/:shareId{/*path}", shareDomains(), renderShare);
router.get("/s/:shareId", shareDomains(), renderShare);
router.get("/s/:shareId/doc/:documentSlug", shareDomains(), renderShare);
router.get("/s/:shareId/*", shareDomains(), renderShare);

router.get("/embeds/gitlab", renderEmbed);
router.get("/embeds/github", renderEmbed);
router.get("/embeds/dropbox", renderEmbed);
router.get("/embeds/pinterest", renderEmbed);

// catch all for application
router.get("*all", shareDomains(), async (ctx, next) => {
router.get("*", shareDomains(), async (ctx, next) => {
if (ctx.state?.rootShare) {
return renderShare(ctx, next);
}
Expand Down
Loading
Loading
0