add a config to force https for api permalinks (#285)

This commit is contained in:
teddit
2022-01-18 19:47:16 +01:00
parent bc274e9660
commit 15256b1cd8
3 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -25,7 +25,7 @@ module.exports = function () {
if (from === 'redis') json = JSON.parse(json);
if (api_type === 'rss') {
let protocol = config.https_enabled ? 'https' : 'http';
let protocol = config.https_enabled || config.api_force_https ? 'https' : 'http';
let items = '';
for (var i = 0; i < json.data.children.length; i++) {
let link = json.data.children[i].data;
@@ -149,7 +149,7 @@ module.exports = function () {
req.cookies
);
let protocol = config.https_enabled ? 'https' : 'http';
let protocol = config.https_enabled || config.api_force_https ? 'https' : 'http';
for (var i = 0; i < processed_json.links.length; i++) {
let link = processed_json.links[i];
let valid_reddit_self_domains = ['reddit.com'];
+1 -1
View File
@@ -23,7 +23,7 @@ module.exports = function () {
let _json = json; // Keep the original json
if (from === 'redis') json = JSON.parse(json);
let protocol = config.https_enabled ? 'https' : 'http';
let protocol = config.https_enabled || config.api_force_https ? 'https' : 'http';
let link = `${protocol}://${config.domain}/user/${user}`;
if (api_type === 'rss') {