Add Quetre option
This commit is contained in:
parent
27874a6766
commit
bc3af7b609
|
@ -193,6 +193,7 @@ module.exports = function(request, fs) {
|
||||||
let youtubeRegex = /(?<=href=")(https?:\/\/)([A-z.]+\.)?youtu(be\.com|\.be)(?=.+")/gm;
|
let youtubeRegex = /(?<=href=")(https?:\/\/)([A-z.]+\.)?youtu(be\.com|\.be)(?=.+")/gm;
|
||||||
let twitterRegex = /(?<=href=")(https?:\/\/)(www\.)?twitter\.com(?=.+")/gm;
|
let twitterRegex = /(?<=href=")(https?:\/\/)(www\.)?twitter\.com(?=.+")/gm;
|
||||||
let instagramRegex = /(?<=href=")(https?:\/\/)(www+\.)?instagram.com(?=.+")/gm;
|
let instagramRegex = /(?<=href=")(https?:\/\/)(www+\.)?instagram.com(?=.+")/gm;
|
||||||
|
let quoraRegex = /(?<=href=")(https?:\/\/)([A-z.]+\.)?quora\.com(?=.+")/gm;
|
||||||
|
|
||||||
let protocol = config.https_enabled || config.api_force_https ? 'https://' : 'http://'
|
let protocol = config.https_enabled || config.api_force_https ? 'https://' : 'http://'
|
||||||
|
|
||||||
|
@ -260,6 +261,10 @@ module.exports = function(request, fs) {
|
||||||
if(user_preferences.domain_instagram)
|
if(user_preferences.domain_instagram)
|
||||||
str = str.replace(instagramRegex, protocol + user_preferences.domain_instagram)
|
str = str.replace(instagramRegex, protocol + user_preferences.domain_instagram)
|
||||||
|
|
||||||
|
if(typeof(user_preferences.domain_quora) != 'undefined')
|
||||||
|
if(user_preferences.domain_quora)
|
||||||
|
str = str.replace(quoraRegex, protocol + user_preferences.domain_quora)
|
||||||
|
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,15 @@ overridingRoutes.all('*', (req, res, next) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let domainQuora = req.query.domain_quora;
|
||||||
|
if (domainQuora) {
|
||||||
|
req.cookies.domain_quora = domainQuora;
|
||||||
|
res.cookie('domain_quora', domainQuora, {
|
||||||
|
maxAge: 31536000,
|
||||||
|
httpOnly: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let videosMuted = req.query.videos_muted;
|
let videosMuted = req.query.videos_muted;
|
||||||
if (videosMuted) {
|
if (videosMuted) {
|
||||||
req.cookies.videos_muted = videosMuted;
|
req.cookies.videos_muted = videosMuted;
|
||||||
|
|
|
@ -15,6 +15,7 @@ function resetPreferences(res) {
|
||||||
res.clearCookie('domain_twitter');
|
res.clearCookie('domain_twitter');
|
||||||
res.clearCookie('domain_youtube');
|
res.clearCookie('domain_youtube');
|
||||||
res.clearCookie('domain_instagram');
|
res.clearCookie('domain_instagram');
|
||||||
|
res.clearCookie('domain_quora');
|
||||||
res.clearCookie('videos_muted');
|
res.clearCookie('videos_muted');
|
||||||
res.clearCookie('prefer_frontpage');
|
res.clearCookie('prefer_frontpage');
|
||||||
res.clearCookie('show_large_gallery_images');
|
res.clearCookie('show_large_gallery_images');
|
||||||
|
@ -92,6 +93,7 @@ preferenceRoutes.post('/saveprefs', (req, res, next) => {
|
||||||
let domain_twitter = req.body.domain_twitter;
|
let domain_twitter = req.body.domain_twitter;
|
||||||
let domain_youtube = req.body.domain_youtube;
|
let domain_youtube = req.body.domain_youtube;
|
||||||
let domain_instagram = req.body.domain_instagram;
|
let domain_instagram = req.body.domain_instagram;
|
||||||
|
let domain_quora = req.body.domain_quora;
|
||||||
let videos_muted = req.body.videos_muted;
|
let videos_muted = req.body.videos_muted;
|
||||||
let prefer_frontpage = req.body.prefer_frontpage;
|
let prefer_frontpage = req.body.prefer_frontpage;
|
||||||
let show_large_gallery_images = req.body.show_large_gallery_images;
|
let show_large_gallery_images = req.body.show_large_gallery_images;
|
||||||
|
@ -172,6 +174,10 @@ preferenceRoutes.post('/saveprefs', (req, res, next) => {
|
||||||
maxAge: 365 * 24 * 60 * 60 * 1000,
|
maxAge: 365 * 24 * 60 * 60 * 1000,
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
});
|
});
|
||||||
|
res.cookie('domain_quora', domain_quora, {
|
||||||
|
maxAge: 365 * 24 * 60 * 60 * 1000,
|
||||||
|
httpOnly: true,
|
||||||
|
});
|
||||||
|
|
||||||
if (prefer_frontpage === 'on') prefer_frontpage = 'true';
|
if (prefer_frontpage === 'on') prefer_frontpage = 'true';
|
||||||
res.cookie('prefer_frontpage', prefer_frontpage, {
|
res.cookie('prefer_frontpage', prefer_frontpage, {
|
||||||
|
|
|
@ -31,6 +31,12 @@ html
|
||||||
input(type="text", name="domain_instagram", id="domain_instagram", value="" + user_preferences.domain_instagram + "", placeholder="e.g. bibliogram.art")
|
input(type="text", name="domain_instagram", id="domain_instagram", value="" + user_preferences.domain_instagram + "", placeholder="e.g. bibliogram.art")
|
||||||
else
|
else
|
||||||
input(type="text", name="domain_instagram", id="domain_instagram", placeholder="e.g. bibliogram.art")
|
input(type="text", name="domain_instagram", id="domain_instagram", placeholder="e.g. bibliogram.art")
|
||||||
|
.setting
|
||||||
|
label(for="domain_quora") Replace Quora links with Quetre (blank to disable):
|
||||||
|
if(user_preferences.domain_quora != '' && typeof(user_preferences.domain_quora) != 'undefined')
|
||||||
|
input(type="text", name="domain_quora", id="domain_quora", value="" + user_preferences.domain_quora + "", placeholder="e.g. quetre.iket.me")
|
||||||
|
else
|
||||||
|
input(type="text", name="domain_quora", id="domain_quora", placeholder="e.g. quetre.iket.me")
|
||||||
legend Display
|
legend Display
|
||||||
.setting
|
.setting
|
||||||
label(for="theme") Theme:
|
label(for="theme") Theme:
|
||||||
|
|
Loading…
Reference in New Issue