Skip to content

chore: Merge branch dev to main#206

Draft
github-actions[bot] wants to merge 17 commits intomainfrom
dev
Draft

chore: Merge branch dev to main#206
github-actions[bot] wants to merge 17 commits intomainfrom
dev

Conversation

@github-actions
Copy link
Contributor

This pull request will Merge branch dev to main.

@oSumAtrIX oSumAtrIX force-pushed the dev branch 8 times, most recently from df707ec to 8c44139 Compare February 19, 2026 22:14
…& use Gradle password credentials & native Ktor OpenAPI spec generator
@oSumAtrIX oSumAtrIX force-pushed the dev branch 3 times, most recently from ec83197 to fff6842 Compare March 7, 2026 01:40
@oSumAtrIX oSumAtrIX force-pushed the dev branch 2 times, most recently from 8ee3377 to 5e0378b Compare March 7, 2026 01:44
Copy link
Member

@PalmDevs PalmDevs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs some changes.

Comment on lines +25 to +91
if (!_app) {
const { apiVersion } = getConfig(env);

_app = new OpenAPIHono<AppBindings>();

_app.onError((err, c) => {
console.error(err);
return c.json(
{
error: err.message || "Unknown error",
stack: err.stack,
},
500,
);
});

// Default 5-minute cache for all routes (overridden per-route where needed)
_app.use("*", cacheControl(CacheDuration.short));

const versionedApp = new OpenAPIHono<AppBindings>();
versionedApp.route("/patches", patchesApp);
versionedApp.route("/manager", managerApp);
versionedApp.route("/announcements", announcementsApp);
versionedApp.route("/contributors", contributorsApp);
versionedApp.route("/team", teamApp);
versionedApp.route("/about", aboutApp);

_app.route(`/v${apiVersion}`, versionedApp);
_app.get("/", swaggerUI({ url: `/v${apiVersion}/openapi` }));

_app.doc(`/v${apiVersion}/openapi`, () => ({
openapi: "3.1.0",
info: {
title: "ReVanced API",
version: packageJson.version,
description: "API server for ReVanced.",
contact: {
name: "ReVanced",
url: "https://revanced.app",
email: "contact@revanced.app",
},
license: {
name: "AGPLv3",
url: "https://github.com/ReVanced/revanced-api/blob/main/LICENSE",
},
},
servers: [
{ url: "https://api.revanced.app", description: "Production" },
{
url: "{customServer}",
description: "Custom server",
variables: {
customServer: {
default: "api.revanced.app",
description: "Custom server URL",
},
},
},
],
}));
_app.openAPIRegistry.registerComponent("securitySchemes", "Bearer", {
type: "http",
scheme: "bearer",
});
}
return _app.fetch(request, env, ctx);
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused about every part of this.

Why not just initialize app outside and do fetch: (request, env, ctx) => app.fetch(request, env, ctx)?

Since this is running on Cloudflare Workers, this is technically fine, but for any normal Hono app, this code is incredibly inefficient.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it can be moved outside of fetch

Comment on lines +49 to +65
let _publicKeyCache: string | undefined;

export async function getPublicKey(env: Env) {
if (!_publicKeyCache) {
const { patches } = getConfig(env);
const res = await env.ASSETS.fetch(
new URL(patches.publicKeyFile, "https://assets.local"),
);
if (!res.ok) {
throw new Error(
`Failed to load public key from ${patches.publicKeyFile}: ${res.status}`,
);
}
_publicKeyCache = await res.text();
}
return { patches_public_key: _publicKeyCache };
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really need caching at the service level?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API is designed platform independent, as such this layer of cache is needed, e.g. when you deploy without a cdn cache

@oSumAtrIX oSumAtrIX force-pushed the dev branch 3 times, most recently from 3927adc to 0a0e002 Compare March 7, 2026 16:17
Co-Authored-By: oSumAtrIX <johan.melkonyan1@web.de>
semantic-release-bot and others added 2 commits March 7, 2026 16:38
# [1.7.0-dev.4](v1.7.0-dev.3...v1.7.0-dev.4) (2026-03-07)

### Features

* Convert ReVanced API from a Ktor server to serverless ([#211](#211)) ([2ba8849](2ba8849))
Co-authored-by: mostafaNazari702 <nazarimostafa2006@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants