From 3d40ed1002c71fdb64d2c4bb8baf23840ee3ec7a Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 13 Apr 2022 14:08:37 +0530 Subject: [PATCH] redirect to docs automatically from cryptpad.fr domains --- www/bounce/main.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/www/bounce/main.js b/www/bounce/main.js index 9dbeedcc4..b8647ccd5 100644 --- a/www/bounce/main.js +++ b/www/bounce/main.js @@ -59,6 +59,15 @@ define(['/api/config'], function (ApiConfig) { // Local URLs don't require any warning and can navigate directly without user input. if (target.host === host.host) { return void go(); } + // It's annoying to be prompted that you are leaving the platform to visit its docs + // but marking the docs domain as trusted undermines third-party admins' autonomy. + // If we ever abandon the cryptpad.fr domain someone could squat it and abuse this trust. + // If the docs domain is a subdomain of the current one then redirect automatically. + // We might make the docs domain configurable at some point in the future. + if (target.host === 'docs.cryptpad.fr' && target.host.endsWith(host.host)) { + return void go(); + } + // Everything else requires user input, so we load the platform's translations. // FIXME: this seems to infer language preferences from the browser instead of the user's account preferences require([