diff --git a/docs/DOCKER-FULL.md b/docs/DOCKER-FULL.md
index 73f21cd8..64a57f2e 100644
--- a/docs/DOCKER-FULL.md
+++ b/docs/DOCKER-FULL.md
@@ -12,6 +12,9 @@ invidious_companion:
public_url: "http://companion.example.com/companion"
```
+### Proof-of-work Captcha
+Will only work while using HTTPS. If in HTTP set `PUBLIC_CAPTCHA_DISABLED` to `true`
+
### Docker Compose
```yaml
@@ -42,6 +45,9 @@ services:
# Allow anyone to register
PUBLIC_REGISTRATION_ALLOWED: "false"
+ # Disable POW Captcha
+ PUBLIC_CAPTCHA_DISABLED: "false"
+
# Allow any domain in proxy
# This shouldn't be used unless you KNOW what your doing
# requires VITE_REGISTRATION_ALLOWED to be false
diff --git a/materialious/src/lib/server/captcha.ts b/materialious/src/lib/server/captcha.ts
index a8636118..4b1b5cdc 100644
--- a/materialious/src/lib/server/captcha.ts
+++ b/materialious/src/lib/server/captcha.ts
@@ -1,8 +1,11 @@
import { error } from '@sveltejs/kit';
import { verifySolution } from 'altcha-lib';
import { getSequelize } from './database';
+import { isOwnBackend } from '$lib/shared';
export async function verifyCaptcha(payload: string, key: string, maxUses: number = -1) {
+ if (isOwnBackend()?.captchaDisabled) return;
+
const passedCaptcha = await verifySolution(payload, key, true);
if (!passedCaptcha) {
throw error(400, 'Unsupported payload');
diff --git a/materialious/src/lib/shared/index.ts b/materialious/src/lib/shared/index.ts
index e8d6a5f8..de9f35be 100644
--- a/materialious/src/lib/shared/index.ts
+++ b/materialious/src/lib/shared/index.ts
@@ -6,6 +6,7 @@ export type IsOwnBackend = {
requireAuth: boolean;
registrationAllowed: boolean;
allowAnyProxy: boolean;
+ captchaDisabled: boolean;
};
export function isOwnBackend(): IsOwnBackend | null {
@@ -16,6 +17,7 @@ export function isOwnBackend(): IsOwnBackend | null {
internalAuth: env.PUBLIC_INTERNAL_AUTH !== 'false',
requireAuth: env.PUBLIC_REQUIRE_AUTH !== 'false',
registrationAllowed: env.PUBLIC_REGISTRATION_ALLOWED === 'true',
- allowAnyProxy: env.PUBLIC_DANGEROUS_ALLOW_ANY_PROXY === 'true'
+ allowAnyProxy: env.PUBLIC_DANGEROUS_ALLOW_ANY_PROXY === 'true',
+ captchaDisabled: env.PUBLIC_CAPTCHA_DISABLED === 'true'
};
}
diff --git a/materialious/src/routes/(app)/internal/login/+page.svelte b/materialious/src/routes/(app)/internal/login/+page.svelte
index bf6c5af9..ef374b6d 100644
--- a/materialious/src/routes/(app)/internal/login/+page.svelte
+++ b/materialious/src/routes/(app)/internal/login/+page.svelte
@@ -81,22 +81,24 @@
{/if}
-
- {
- const { payload, state } = ev.detail;
- if (state === 'verified' && payload) {
- captchaPayload = payload;
- }
- }}
- >
-
+ {#if !isOwnBackend()?.captchaDisabled}
+
+ {
+ const { payload, state } = ev.detail;
+ if (state === 'verified' && payload) {
+ captchaPayload = payload;
+ }
+ }}
+ >
+
+ {/if}