diff --git a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl index 03c62eb9ee0..54b3260979c 100644 --- a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl +++ b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl @@ -14,6 +14,7 @@ var ENABLE_DEBUG_MODE = {if ENABLE_DEBUG_MODE}true{else}false{/if}; var ENABLE_PRODUCTION_DEBUG_MODE = {if ENABLE_PRODUCTION_DEBUG_MODE}true{else}false{/if}; var ENABLE_DEVELOPER_TOOLS = {if ENABLE_DEVELOPER_TOOLS}true{else}false{/if}; + var FORCE_LOGIN = {if FORCE_LOGIN}true{else}false{/if}; var PAGE_TITLE = '{unsafe:PAGE_TITLE|phrase|encodeJS}'; var REACTION_TYPES = {unsafe:$__wcf->getReactionHandler()->getReactionsJSVariable()}; diff --git a/ts/WoltLabSuite/Core/Ui/Feed/Dialog.ts b/ts/WoltLabSuite/Core/Ui/Feed/Dialog.ts index 0ef48e17547..4fe858aad22 100644 --- a/ts/WoltLabSuite/Core/Ui/Feed/Dialog.ts +++ b/ts/WoltLabSuite/Core/Ui/Feed/Dialog.ts @@ -37,9 +37,11 @@ function openDialog(event: Event): void { const linkWithoutAccessToken = linkWithAccessToken.replace(/(\\?|&)at=[^&]*&?/, "$1").replace(/(\?|&)$/, ""); - UiDialog.openStatic( - "feedLinkDialog", - ` + // When `FORCE_LOGIN` is active, an RSS reader cannot access the feed without an + // access token. The anonymous link is therefore useless and must not be shown. + let withoutAccessToken = ""; + if (!window.FORCE_LOGIN) { + withoutAccessToken = ` ${Language.get("wcf.global.rss.accessToken.info")}
${Language.get("wcf.global.rss.withoutAccessToken")}
@@ -53,7 +55,13 @@ function openDialog(event: Event): void { -
+`; + } + + UiDialog.openStatic( + "feedLinkDialog", + ` +${withoutAccessToken}
${Language.get("wcf.global.rss.withAccessToken")}
diff --git a/ts/global.d.ts b/ts/global.d.ts index 65a4e32b881..c091fc0751c 100644 --- a/ts/global.d.ts +++ b/ts/global.d.ts @@ -30,6 +30,7 @@ declare global { Devtools?: typeof Devtools; ENABLE_DEBUG_MODE: boolean; ENABLE_DEVELOPER_TOOLS: boolean; + FORCE_LOGIN: boolean; LANGUAGE_ID: number; PAGE_TITLE: string; REACTION_TYPES: { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Feed/Dialog.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Feed/Dialog.js index 1294af66230..cd445c7a952 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Feed/Dialog.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Feed/Dialog.js @@ -31,7 +31,11 @@ define(["require", "exports", "tslib", "../Dialog", "../../StringUtil", "../../L const alternative = event.currentTarget; const linkWithAccessToken = alternative.href; const linkWithoutAccessToken = linkWithAccessToken.replace(/(\\?|&)at=[^&]*&?/, "$1").replace(/(\?|&)$/, ""); - Dialog_1.default.openStatic("feedLinkDialog", ` + // When `FORCE_LOGIN` is active, an RSS reader cannot access the feed without an + // access token. The anonymous link is therefore useless and must not be shown. + let withoutAccessToken = ""; + if (!window.FORCE_LOGIN) { + withoutAccessToken = ` ${Language.get("wcf.global.rss.accessToken.info")}
${Language.get("wcf.global.rss.withoutAccessToken")}
@@ -43,7 +47,10 @@ define(["require", "exports", "tslib", "../Dialog", "../../StringUtil", "../../L
-
+`; + } + Dialog_1.default.openStatic("feedLinkDialog", ` +${withoutAccessToken}
${Language.get("wcf.global.rss.withAccessToken")}