mirror of
https://codeberg.org/tacerus/teddit.git
synced 2025-05-06 11:47:19 +02:00
feature for ex-/including saved posts when exporting preferences
This commit is contained in:
parent
aae8495b13
commit
aeeeaa76b7
10
routes.js
10
routes.js
@ -55,7 +55,7 @@ module.exports = (app, redis, fetch, RedditAPI) => {
|
|||||||
}
|
}
|
||||||
if(!subbed_subreddits_is_set)
|
if(!subbed_subreddits_is_set)
|
||||||
res.clearCookie('subbed_subreddits')
|
res.clearCookie('subbed_subreddits')
|
||||||
return res.redirect('/preferences')
|
return res.redirect('/')
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error(`Error setting imported preferences to the cookies. Key: ${key}.`, error)
|
console.error(`Error setting imported preferences to the cookies. Key: ${key}.`, error)
|
||||||
}
|
}
|
||||||
@ -1456,6 +1456,14 @@ module.exports = (app, redis, fetch, RedditAPI) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
app.post('/export_prefs', (req, res, next) => {
|
app.post('/export_prefs', (req, res, next) => {
|
||||||
|
let export_saved = req.body.export_saved
|
||||||
|
let export_data = req.cookies
|
||||||
|
|
||||||
|
if(export_saved !== 'on') {
|
||||||
|
if(req.cookies.saved)
|
||||||
|
delete export_data.saved
|
||||||
|
}
|
||||||
|
|
||||||
let r = `${(Math.random().toString(36)+'00000000000000000').slice(2, 10+2).toUpperCase()}`
|
let r = `${(Math.random().toString(36)+'00000000000000000').slice(2, 10+2).toUpperCase()}`
|
||||||
let key = `prefs_key:${r}`
|
let key = `prefs_key:${r}`
|
||||||
redis.set(key, JSON.stringify(req.cookies), (error) => {
|
redis.set(key, JSON.stringify(req.cookies), (error) => {
|
||||||
|
@ -75,6 +75,9 @@ html
|
|||||||
.setting
|
.setting
|
||||||
small By exporting your preferences you can transfer your subscribed subreddits and preferences to another device. Or you could create a bookmark if you tend to delete your cookies frequently.
|
small By exporting your preferences you can transfer your subscribed subreddits and preferences to another device. Or you could create a bookmark if you tend to delete your cookies frequently.
|
||||||
br
|
br
|
||||||
|
label(for="export_saved") Export saved posts:
|
||||||
|
input(type="checkbox", name="export_saved", id="export_saved")
|
||||||
|
br
|
||||||
input(type="submit", value="Export preferences")
|
input(type="submit", value="Export preferences")
|
||||||
if preferences_key
|
if preferences_key
|
||||||
- var protocol = 'http'
|
- var protocol = 'http'
|
||||||
@ -89,5 +92,8 @@ html
|
|||||||
.setting
|
.setting
|
||||||
small By exporting your preferences you can transfer your subscribed subreddits and preferences to another device. Or you could create a bookmark if you tend to delete your cookies frequently.
|
small By exporting your preferences you can transfer your subscribed subreddits and preferences to another device. Or you could create a bookmark if you tend to delete your cookies frequently.
|
||||||
br
|
br
|
||||||
|
label(for="export_saved") Export saved posts:
|
||||||
|
input(type="checkbox", name="export_saved", id="export_saved")
|
||||||
|
br
|
||||||
input(type="submit", value="Export preferences")
|
input(type="submit", value="Export preferences")
|
||||||
include includes/footer.pug
|
include includes/footer.pug
|
||||||
|
Loading…
x
Reference in New Issue
Block a user