diff --git a/src/config.ts b/src/config.ts
index ed835b2..7d63094 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -127,6 +127,15 @@ type Config = {
* details on the available modes.
*/
powDifficultyLevel: "low" | "medium" | "high" | "extreme";
+ /**
+ * Duration in minutes before a PoW challenge expires. Users' browsers must
+ * solve the challenge within this time frame or it will be rejected.
+ * Defaults to 30 minutes. It should be kept somewhat low to prevent abusive
+ * clients from working on many challenges in parallel, but you may need to
+ * increase this value for higher difficulty levels or older devices will not
+ * be able to solve the challenge in time.
+ */
+ powChallengeTimeout: number;
/** Per-user limit for requests per minute to text and chat models. */
textModelRateLimit: number;
/** Per-user limit for requests per minute to image generation models. */
@@ -322,6 +331,7 @@ export const config: Config = {
powTokenHours: getEnvWithDefault("POW_TOKEN_HOURS", 24),
powTokenMaxIps: getEnvWithDefault("POW_TOKEN_MAX_IPS", 2),
powDifficultyLevel: getEnvWithDefault("POW_DIFFICULTY_LEVEL", "low"),
+ powChallengeTimeout: getEnvWithDefault("POW_CHALLENGE_TIMEOUT", 30),
firebaseRtdbUrl: getEnvWithDefault("FIREBASE_RTDB_URL", undefined),
firebaseKey: getEnvWithDefault("FIREBASE_KEY", undefined),
textModelRateLimit: getEnvWithDefault("TEXT_MODEL_RATE_LIMIT", 4),
diff --git a/src/info-page.ts b/src/info-page.ts
index 12c076c..711ccd5 100644
--- a/src/info-page.ts
+++ b/src/info-page.ts
@@ -16,7 +16,7 @@ const MODEL_FAMILY_FRIENDLY_NAME: { [f in ModelFamily]: string } = {
gpt4: "GPT-4",
"gpt4-32k": "GPT-4 32k",
"gpt4-turbo": "GPT-4 Turbo",
- "gpt4o": "GPT-4o",
+ gpt4o: "GPT-4o",
"dall-e": "DALL-E",
claude: "Claude (Sonnet)",
"claude-opus": "Claude (Opus)",
@@ -146,11 +146,15 @@ This proxy keeps full logs of all prompts and AI responses. Prompt logs are anon
function getSelfServiceLinks() {
if (config.gatekeeper !== "user_token") return "";
- const links = [
- ["Request a user token", "/user/captcha",],
- ["Check your user token", "/user/lookup",]
- ]
- return `
${links.map(([text, link]) => `
${text}`).join(" / ")}
`;
+
+ const links = [["Check your user token", "/user/lookup"]];
+ if (config.captchaMode !== "none") {
+ links.unshift(["Request a user token", "/user/captcha"]);
+ }
+
+ return `${links
+ .map(([text, link]) => `
${text}`)
+ .join(" / ")}
`;
}
function getServerTitle() {
@@ -262,7 +266,7 @@ if (config.serviceInfoPassword?.length) {
});
infoPageRouter.use(checkIfUnlocked);
}
-infoPageRouter.get("/", handleInfoPage);
+infoPageRouter.get("/", (req, res) => res.sendStatus(204));
infoPageRouter.get("/status", (req, res) => {
res.json(buildInfo(req.protocol + "://" + req.get("host"), false));
});
diff --git a/src/shared/views/partials/shared_header.ejs b/src/shared/views/partials/shared_header.ejs
index bb0d86a..0726364 100644
--- a/src/shared/views/partials/shared_header.ejs
+++ b/src/shared/views/partials/shared_header.ejs
@@ -3,7 +3,6 @@
-
<%= title %>
- Your device needs to perform a verification task before a user token will be issued. This verification might take
- anywhere from a few seconds to a few minutes, depending on your device and the proxy's security settings.
+ Your device needs to perform a verification task before you can receive access. This might take anywhere from a few
+ seconds to a few minutes, depending on your device and the proxy's security settings.
Click the button below to start.
What is this?
- This is an anti-abuse measure to slow down automated requests. It requires your device's CPU to find a solution to
- a cryptographic puzzle, after which a user token will be issued.
-
-
- Your browser may slow down during the verification process. If you want to do something else while waiting, reduce
- the number of workers to reduce the load on your device's CPU.
+ This is an anti-abuse measure designed to slow down automated requests. It requires your device's CPU to find a
+ solution to a cryptographic puzzle, after which a user token will be issued.
How long does verification take?
- The exact time depends on the device you're using and the server's difficulty setting (currently
+ It on the device you're using and the verification task's difficulty level (currently
<%= difficultyLevel %>). It could take anywhere from a few seconds to a few minutes.
@@ -97,8 +93,19 @@
How often do I need to do this?
Once you've earned a user token, you can use it for <%= tokenLifetime %> hours before it expires.
- You can refresh an expired token by returning to this page and completing the verification again, which will be
- faster than the first time.
+ You can refresh an expired token by returning to this page and verifying again. Subsequent verifications will go
+ faster than the first one.
+
+
+
+ What is the "Workers" setting?
+
+ This controls how many CPU cores will be used to solve the verification task. By default, all of your device's
+ cores will be used to solve the task as quickly as possible.
+
+
+ If your device gets too hot or you want to use it for other tasks while verification is in progress, reduce the
+ number of workers to lower the CPU load at the cost of slower verification.
diff --git a/src/user/web/views/user_request_token.ejs b/src/user/web/views/user_request_token.ejs
index 1384aa0..30b0b7a 100644
--- a/src/user/web/views/user_request_token.ejs
+++ b/src/user/web/views/user_request_token.ejs
@@ -18,9 +18,7 @@
Request User Token
-
- You can request a temporary user token to use this proxy. The token will be valid for <%= tokenLifetime %> hours.
-
+You can request a temporary user token to use this proxy. The token will be valid for <%= tokenLifetime %> hours.
<% if (keyRequired) { %>
You need to supply the proxy password to request or refresh a token.
@@ -31,10 +29,7 @@
<% } %>
-
- It looks like you might have an older temporary user token. You can refresh its expiration by completing a
- faster verification challenge.
-
+
It looks like you might have an older temporary user token. If it has expired, you can try to refresh it.
Existing token: