diff --git a/Dockerfile b/Dockerfile index 3caea14..d3b4121 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:15-alpine +FROM node:20-alpine RUN apk --no-cache add curl @@ -19,4 +19,4 @@ ENV DB_PREFIX /data/dbs/ ENV SECRET_DIRNAME /data -CMD ./Dockerstart.sh \ No newline at end of file +CMD ./Dockerstart.sh diff --git a/README.md b/README.md index 93c202b..0ebba49 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,10 @@ services: # (for weddings, birthdays, etc. only the admin account's list is accessible) # Set to 'true' to enable SINGLE_LIST: 'false' + # Some websites (like walmart) send headers that are larger than 8MB in + # length. If issues are encountered, set the node.js limit to a higher + # number than 8192 + #NODE_OPTIONS: "--max-http-header-size=32768" restart: always ``` @@ -93,6 +97,9 @@ UPDATE_CHECK=true PFP=true # Language of the interface, options listed in `languages` directory LANGUAGE=en-US +# Password to enter guest mode, +# e.g. https://wishes.example.com?pw=ReplaceWithYourGuestPassword +# GUEST_PASSWORD=ReplaceWithYourGuestPassword ## Wishlist Settings # Set to true to not allow users to have their own lists. You may want this for a birthday or wedding. @@ -144,4 +151,4 @@ As of writing, there are no code contributors to the main project. However, ther * Czech: [drSchaps](https://github.com/drSchaps) * German: [PeteS4](https://github.com/PeteS4) * French: [zethis](https://github.com/zethis) -* Spanish: [CantisW](https://github.com/CantisW) \ No newline at end of file +* Spanish: [CantisW](https://github.com/CantisW) diff --git a/src/config/index.js b/src/config/index.js index 1ee79e9..ef5a267 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -25,3 +25,7 @@ module.exports = { } if (module.exports.guestPassword) module.exports.wishlist.public = false +if (module.exports.guestPassword === 'ReplaceWithYourGuestPassword') { + console.error('Error: Guest password should be changed from default.') + process.exit(1) +} \ No newline at end of file diff --git a/src/index.js b/src/index.js index ed0c0f0..23c7af3 100644 --- a/src/index.js +++ b/src/index.js @@ -98,6 +98,7 @@ app.use((req, res, next) => { }) app.use(require('body-parser').urlencoded({ extended: true })) +app.use(require('cookie-parser')()); app.use(session({ secret: config.secret, resave: false, @@ -108,6 +109,16 @@ app.use(session({ }, name: 'christmas_community.connect.sid' })) +app.use((req, res, next) => { + let basepath = req.path.substring(0, req.path.lastIndexOf("/")); + + // Clear cookies for paths that are not the base path. See #17 + if(basepath.length > config.base.length) { + res.clearCookie('christmas_community.connect.sid', {path: req.path}); + res.clearCookie('christmas_community.connect.sid', {path: basepath}); + } + next(); +}); app.use(flash()) app.use(passport.initialize()) app.use(passport.session()) diff --git a/src/languages/cs-cz.js b/src/languages/cs-cz.js index f967765..8aa0803 100644 --- a/src/languages/cs-cz.js +++ b/src/languages/cs-cz.js @@ -125,7 +125,7 @@ module.exports.strings = { SETUP_USERNAME_PLACEHOLDER: 'Martin', SETUP_USERNAME: 'Uživatelské jméno', SUPPORTED_SITES_HEADER: 'Podporované obchody', - SUPPORTED_SITES_TEXT: 'Nefunguje obchod nebo úplně chybí? Založ nový ticket ZDE! :)', + SUPPORTED_SITES_TEXT: 'Nefunguje obchod nebo úplně chybí? Založ nový ticket ZDE! :)', UPDATE_NOTICE: (current, latest) => ` Nepoužíváte poslední verzi Christmas Community. V nové verzi mohou být nové funkce nebo opravy chyb. Zvžte aktualizaci :) diff --git a/src/languages/da-dk.js b/src/languages/da-dk.js index 6fa5265..293ae19 100644 --- a/src/languages/da-dk.js +++ b/src/languages/da-dk.js @@ -125,7 +125,7 @@ module.exports.strings = { SETUP_USERNAME_PLACEHOLDER: 'john', SETUP_USERNAME: 'Brugernavn', SUPPORTED_SITES_HEADER: 'Supporterede hjemmesider', - SUPPORTED_SITES_TEXT: 'Is a site missing or broken? Open an issue here! :)', + SUPPORTED_SITES_TEXT: 'Is a site missing or broken? Open an issue here! :)', UPDATE_NOTICE: (current, latest) => ` Christmas Community is out of date. There may be new features or bug fixes. Consider updating! :) diff --git a/src/languages/de-de.js b/src/languages/de-de.js index 8414d2d..fbd5ef3 100644 --- a/src/languages/de-de.js +++ b/src/languages/de-de.js @@ -125,7 +125,7 @@ module.exports.strings = { SETUP_USERNAME_PLACEHOLDER: 'john', SETUP_USERNAME: 'Nutzername', SUPPORTED_SITES_HEADER: 'Unterstützte Seiten', - SUPPORTED_SITES_TEXT: 'Fehlt eine Seite oder ist etwas defekt? Eröffne hier ein Issue! :)', + SUPPORTED_SITES_TEXT: 'Fehlt eine Seite oder ist etwas defekt? Eröffne hier ein Issue! :)', UPDATE_NOTICE: (current, latest) => ` Christmas Community ist veraltet. Möglicherweise gibt es neue Funktionen oder Fehler wurden beseitigt. Mach' am besten ein Update! :) diff --git a/src/languages/en-us.js b/src/languages/en-us.js index 7406916..8371aab 100644 --- a/src/languages/en-us.js +++ b/src/languages/en-us.js @@ -124,8 +124,8 @@ module.exports.strings = { SETUP_PASSWORD: 'Password', SETUP_USERNAME_PLACEHOLDER: 'john', SETUP_USERNAME: 'Username', - SUPPORTED_SITES_HEADER: 'Working Sites', - SUPPORTED_SITES_TEXT: 'You can still add items from other sites, but it can\'t autopopulate the information, so do that yourself.', + SUPPORTED_SITES_HEADER: 'Supported Sites', + SUPPORTED_SITES_TEXT: 'Is a site missing or broken? Open an issue here! :)', UPDATE_NOTICE: (current, latest) => ` New version available! There may be new features or bug fixes. Consider updating! :) diff --git a/src/languages/es-es.js b/src/languages/es-es.js index bb3a22d..a9ca846 100644 --- a/src/languages/es-es.js +++ b/src/languages/es-es.js @@ -125,7 +125,7 @@ module.exports.strings = { SETUP_USERNAME_PLACEHOLDER: 'juan', SETUP_USERNAME: 'Nombre de usuario', SUPPORTED_SITES_HEADER: 'Sitios web compatibles', - SUPPORTED_SITES_TEXT: '¿Hay un sitio ausente o roto? Abra una propuesta aquí! :)', + SUPPORTED_SITES_TEXT: '¿Hay un sitio ausente o roto? Abra una propuesta aquí! :)', UPDATE_NOTICE: (current, latest) => ` Christmas Community es desactualizado. Puede haber nuevas functiones o correcciones. ¡Considera actualizar! :) diff --git a/src/languages/fr-ca.js b/src/languages/fr-ca.js index d499dd1..6f3f024 100644 --- a/src/languages/fr-ca.js +++ b/src/languages/fr-ca.js @@ -124,7 +124,7 @@ module.exports.strings = { SETUP_USERNAME_PLACEHOLDER: 'félix', SETUP_USERNAME: 'Nom d\'utilisateur', SUPPORTED_SITES_HEADER: 'Sites pris en charge', - SUPPORTED_SITES_TEXT: 'Un site est-il manquant ou cassé? Reporter un problème here! :)', + SUPPORTED_SITES_TEXT: 'Un site est-il manquant ou cassé? Reporter un problème here! :)', UPDATE_NOTICE: (current, latest) => ` Christmas Community est obsolète. Il peut y avoir de nouvelles fonctionnalités ou des corrections de bugs. Pensez à mettre à jour! :) diff --git a/src/languages/fr-fr.js b/src/languages/fr-fr.js index 8a5a822..70de6ec 100644 --- a/src/languages/fr-fr.js +++ b/src/languages/fr-fr.js @@ -125,7 +125,7 @@ module.exports.strings = { SETUP_USERNAME_PLACEHOLDER: 'jean', SETUP_USERNAME: "Nom d'utilisateur", SUPPORTED_SITES_HEADER: 'Sites supportés', - SUPPORTED_SITES_TEXT: 'Un site est-il manquant ou cassé? Ouvrir une issue here! :)', + SUPPORTED_SITES_TEXT: 'Un site est-il manquant ou cassé? Ouvrir une issue here! :)', UPDATE_NOTICE: (current, latest) => ` Christmas Community est obsolète. Il peut y avoir de nouvelles fonctionnalités ou des corrections de bugs. Pensez à mettre à jour! :) diff --git a/src/languages/nb-no.js b/src/languages/nb-no.js new file mode 100644 index 0000000..9113db3 --- /dev/null +++ b/src/languages/nb-no.js @@ -0,0 +1,187 @@ +module.exports.momentLocale = 'nb' + +module.exports.strings = { + _NOT_LOCALIZED: key => `${key} har ikke blitt oversatt til norsk enda.`, + ADMIN_CLEAR_WISHLISTS_BUTTON: 'Tøm alle ønskelister', + ADMIN_CLEAR_WISHLISTS_DESCRIPTION: 'Dette vil umiddelbart og irreversibelt slette alle ønskelister! Vurder å ta en sikkerhetskopi av databasen før du bruker dette.', + ADMIN_CLEAR_WISHLISTS_HEADER: 'Sletting av ønskelister', + ADMIN_SETTINGS_CLEARDB_BUTTON: 'Tøm ønskelister', + ADMIN_SETTINGS_CLEARDB_DESCRIPTION: 'Advarsel: Disse alternativene ødelegger data! Du bør ta en sikkerhetskopi av databasen før du bruker disse alternativene.', + ADMIN_SETTINGS_CLEARDB_HEADER: 'Dataødeleggelse', + ADMIN_SETTINGS_CLEARDB_SUCCESS: 'Alle ønskelister ble tømt.', + ADMIN_SETTINGS_HEADER: 'Administratorinnstillinger', + ADMIN_SETTINGS_USERS_ADD_BUTTON: 'Legg til bruker', + ADMIN_SETTINGS_USERS_ADD_HEADER: 'Legg til bruker', + ADMIN_SETTINGS_USERS_ADD_PLACEHOLDER: 'Ola', + ADMIN_SETTINGS_USERS_ADD_USERNAME: 'Brukernavn', + ADMIN_SETTINGS_USERS_ADD_ERROR_USERNAME_EMPTY: 'Brukernavn kan ikke være tomt.', + ADMIN_SETTINGS_USERS_EDIT_DELETE_FAIL_ADMIN: 'Kunne ikke fjerne: bruker er administrator.', + ADMIN_SETTINGS_USERS_EDIT_DELETE_SUCCESS: name => `Brukeren ${name} ble fjernet.`, + ADMIN_SETTINGS_USERS_EDIT_DEMOTE_NOT_ADMIN: 'brukeren er ikke en administrator', + ADMIN_SETTINGS_USERS_EDIT_DEMOTE_SELF: 'Du kan ikke nedgradere egen konto.', + ADMIN_SETTINGS_USERS_EDIT_DEMOTE_SUCCESS: name => `${name} er ikke lengre en administrator.`, + ADMIN_SETTINGS_USERS_EDIT_IMPERSONATE_SUCCESS: name => `Du er nå ${name}.`, + ADMIN_SETTINGS_USERS_EDIT_NO_USERNAME_PROVIDED: 'Ingen brukernavn oppgitt', + ADMIN_SETTINGS_USERS_EDIT_PROMOTE_ALREADY_ADMIN: 'brukeren er allerede administrator', + ADMIN_SETTINGS_USERS_EDIT_PROMOTE_DEMOTE_NOT_FOUND: 'Brukeren ble ikke funnet.', + ADMIN_SETTINGS_USERS_EDIT_PROMOTE_SUCCESS: name => `${name} er nå en administrator.`, + ADMIN_SETTINGS_USERS_EDIT_RENAMED_USER: 'Brukeren er omdøpt!', + ADMIN_SETTINGS_USERS_EDIT_SAME_NAME: 'Brukernavnet er det samme som det nye brukernavnet.', + ADMIN_SETTINGS_USERS_EDIT: 'Rediger', + ADMIN_SETTINGS_USERS_HEADER: 'Brukere', + ADMIN_SETTINGS_VERSION_INFO: 'Versjonsinfo', + ADMIN_USER_EDIT_ACCOUNT_UNCONFIRMED: "Denne kontoen er ikke bekreftet.", + ADMIN_USER_EDIT_ADMIN_ISADMIN: name => `${name} er en administrator.`, + ADMIN_USER_EDIT_ADMIN_NOTADMIN: name => `${name} er ikke en administrator.`, + ADMIN_USER_EDIT_ADMIN: 'Administrator', + ADMIN_USER_EDIT_CHANGE_NAME: 'Endre navn', + ADMIN_USER_EDIT_CHANGE_USERNAME: 'Endre brukernavn', + ADMIN_USER_EDIT_CONFIRMATION_LINK: 'Bekreftelseslenke', + ADMIN_USER_EDIT_DELETE_ADMIN: 'Brukeren er administrator', + ADMIN_USER_EDIT_DELETE_HEADER: 'Irreversibel sletting', + ADMIN_USER_EDIT_DELETE_USER: name => `Fjern bruker ${name}`, + ADMIN_USER_EDIT_DEMOTE_SELF: 'Du kan ikke nedgradere deg selv', + ADMIN_USER_EDIT_DEMOTE: name => `Nedgrader ${name}`, + ADMIN_USER_EDIT_EDITING_USER: name => `Redigerer bruker "${name}"`, + ADMIN_USER_EDIT_GENERATE_NEW_LINK: 'Generer ny lenke', + ADMIN_USER_EDIT_IMPERSONATE_BUTTON: name => `Logg inn som ${name}`, + ADMIN_USER_EDIT_IMPERSONATE_HEADER: 'Logg inn som', + ADMIN_USER_EDIT_LINK_EXPIRY_FUTURE: fromNow => `Følgende lenke utløper ${fromNow}`, // fromNow is localized by moment + ADMIN_USER_EDIT_LINK_EXPIRY_PAST: fromNow => `Følgende lenke utløp ${fromNow}`, + ADMIN_USER_EDIT_PROMOTE: name => `Promoter ${name}`, + ADMIN_USER_EDIT_RESET_PASSWORD_HASLINK_EXPIRY_FUTURE: fromNow => `Den utløper ${fromNow}`, + ADMIN_USER_EDIT_RESET_PASSWORD_HASLINK_EXPIRY_PAST: fromNow => `Den utløp ${fromNow}`, + ADMIN_USER_EDIT_RESET_PASSWORD_HASLINK: 'Det finnes en gjennopprettingslenke for denne brukeren.', + ADMIN_USER_EDIT_RESET_PASSWORD_HEADER: 'Nullstill passord', + ADMIN_USER_EDIT_RESET_PASSWORD_LINK_CANCEL: 'Slett gjennopprettingslenke', + ADMIN_USER_EDIT_RESET_PASSWORD_LINK_CREATE: 'Opprett gjennopprettingslenke', + ADMIN_USER_EDIT_RESET_PASSWORD_LINK_REFRESH: 'Oppdater gjennopprettingslenke', + ADMIN_USER_EDIT_USERNAME: 'Brukernavn', + BACK_BUTTON: 'Tilbake', + CONFIRM_ACCOUNT_EXPIRED: 'Din gjenopprettingslenke er utløpt. Vennligst be om en ny.', + CONFIRM_ACCOUNT_HEADER_INVALID: `${_CC.config.siteTitle} | Ugyldig bekreftelseslenke`, + CONFIRM_ACCOUNT_HEADER_VALID: `${_CC.config.siteTitle} | Bekreft konto`, + CONFIRM_ACCOUNT_INVALID: "Denne bekreftelseslenken er ugyldig. Kanskje er den slettet, eller det mangler tegn på slutten av den?", + CONFIRM_ACCOUNT_SET_PW_BUTTON: `Bli medlem av ${_CC.config.siteTitle}`, + CONFIRM_ACCOUNT_SET_PW_PLACEHOLDER: 'pa$$ord!', + CONFIRM_ACCOUNT_SET_PW_TEXT: name => `Hei, ${name}! Vennligst sett ditt passord her.`, + CONFIRM_ACCOUNT_SUCCESS: `Velkommen til ${_CC.config.siteTitle}!`, + LOGIN_BUTTON: 'Logg inn', + LOGIN_PASSWORD_PLACEHOLDER: 'pa$$ord!', + LOGIN_PASSWORD: 'Passord', + LOGIN_USERNAME_PLACEHOLDER: 'Ola', + LOGIN_USERNAME: 'Brukernavn', + LOGOUT_BUTTON: 'Logg ut', + NAVBAR_ADMIN: 'Administratorinnstillinger', + NAVBAR_LOGIN: 'Logg inn', + NAVBAR_LOGOUT: 'Logg ut', + NAVBAR_PROFILE: 'Profil', + NAVBAR_WISHLIST: 'Min ønskeliste', + NOTE_BACK: name => `Tilbake til ${name}s ønskeliste`, + NOTE_GET_PRODUCT_DATA: 'Hent produktdata', + NOTE_GUARD: 'Ugyldig bruker', + NOTE_IMAGE_URL: 'Bildelenke', + NOTE_MISSING_PROP: prop => `Mangler egenskap ${prop}`, // not really possible to localize this unfortunately + NOTE_NAME: 'Navn', + NOTE_NOTE: 'Notat', + NOTE_PRICE: 'Pris', + NOTE_REFRESH_DATA: 'Oppdater data', + NOTE_REMOVE_GUARD: 'Ugyldig bruker', + NOTE_REMOVE_MISSING: 'Har ingen notater', + NOTE_REMOVE_SUCCESS: 'Notatet ble fjernet', + NOTE_SAVE_BUTTON: 'Lagre element', + NOTE_SUCCESS: 'Lagret!', + NOTE_URL: 'Lenke', + PROFILE_HEADER: 'Profil', + PROFILE_PASSWORD_BUTTON: 'Lagre', + PROFILE_PASSWORD_NEW: 'Nytt passord', + PROFILE_PASSWORD_OLD_MISMATCH: 'Feil gammelt passord', + PROFILE_PASSWORD_OLD: 'Nytt passord', + PROFILE_PASSWORD_PLACEHOLDER: 'pa$$ord!', + PROFILE_PASSWORD_REQUIRED_NEW: 'Nytt passord er påkrevd', + PROFILE_PASSWORD_REQUIRED_OLD: 'Gammelt passord er påkrevd', + PROFILE_PASSWORD_SUCCESS: 'Endringer ble lagret!', + PROFILE_PASSWORD_TITLE: name => `Profilinnstillinger - Passord - ${name}`, + PROFILE_PFP_IMAGE_URL: 'Bildelenke', + PROFILE_SAVE_PFP_DISABLED: 'Profilbilder er deaktivert.', + PROFILE_SAVE_PFP_SUCCESS: 'Profilbilde ble lagret!', + PROFILE_SECURITY_CHANGE_PASSWORD: 'Endre passord', + PROFILE_SECURITY: 'Sikkerhet', + PROFILE_TITLE: name => `Profilinnstillinger - ${name}`, + RESET_PASSWORD_BUTTON: 'Tilbakestill passord', + RESET_PASSWORD_GREETING_EXPIRED: 'Din gjenopprettingslenke er utløpt. Vennligst be om en ny.', + RESET_PASSWORD_GREETING_INVALID: "Denne gjenopprettingslenken er ugyldig. Kanskje er den slettet, eller det mangler tegn på slutten av den?", + RESET_PASSWORD_GREETING_VALID: name => `Hei, ${name}! Vennligst sett ditt passord her.`, + RESET_PASSWORD_HEADER_INVALID: `${_CC.config.siteTitle} | Ugyldig gjenopprettingslenke`, + RESET_PASSWORD_HEADER_VALID: `${_CC.config.siteTitle} | Nullstill passord`, + RESET_PASSWORD_PASSWORD_PLACEHOLDER: 'pa$$ord!', + RESET_PASSWORD_PASSWORD: 'Passord', + RESET_PASSWORD_SUCCESS: 'Passordet ble nullstilt!', + SETUP_ADMIN_USER: 'Administratorbruker', + SETUP_BUTTON: 'Konfigurer!', + SETUP_HEADER: 'Konfigurasjon', + SETUP_PASSWORD_PLACEHOLDER: 'pa$$ord!', + SETUP_PASSWORD: 'Passord', + SETUP_USERNAME_PLACEHOLDER: 'Ola', + SETUP_USERNAME: 'Brukernavn', + SUPPORTED_SITES_HEADER: 'Støttede nettsteder', + SUPPORTED_SITES_TEXT: 'Mangler en nettsted, eller har problemer? Skriv en feilrapport her! :)', + UPDATE_NOTICE: (current, latest) => ` + + Christmas Community er utdatert. Det kan være nye funksjoner og feilrettinger. Vurder å oppdatere! :) + +
+ (du kan deaktivere dette med UPDATE_CHECK=false) +

+ Gjeldende: ${current} +
+ Siste: ${latest} + Denne meldingen er kun synlig for administratorer`, + WISHLIST_ADD: 'Legg til element i ønskelisten', + WISHLIST_ADDED_BY_USER: addedBy => `Lagt til av: ${addedBy}`, + WISHLIST_ADDED_BY: 'Lagt til av', + WISHLIST_ADDED_ITEM_TO_OWN_WISHLIST: 'Elementet ble lagt til i ønskelisten.', + WISHLIST_CONFLICT: 'Elementer blir lagt til for fort. Vennligst prøv igjen.', + WISHLIST_DELETE: 'Slett', + WISHLIST_EDIT_ITEM: 'Rediger element', + WISHLIST_FETCH_FAIL: 'Kunne ikke hente ønskeliste -- eksisterer brukeren?', + WISHLIST_IMAGE: 'Bilde', + WISHLIST_ITEM_MISSING: 'Element ikke funnet', + WISHLIST_MOVE_DOWN: 'Flytt ned', + WISHLIST_MOVE_GUARD: 'Feil bruker', + WISHLIST_MOVE_INVALID: 'Ugyldig bevegelse', + WISHLIST_MOVE_ITEM_DOWN: 'Flytt element ned', + WISHLIST_MOVE_ITEM_TOP: 'Flytt element til toppen', + WISHLIST_MOVE_ITEM_UP: 'Flytt element opp', + WISHLIST_MOVE_SUCCESS: 'Elementet ble flyttet!', + WISHLIST_MOVE_TOP: 'Flytt til toppen', + WISHLIST_MOVE_UNKNOWN_DIRECTION: 'Ukjent retning', + WISHLIST_MOVE_UP: 'Flytt opp', + WISHLIST_NAME: 'Navn', + WISHLIST_NOTE: 'Notat', + WISHLIST_OPTIONAL: 'Valgfritt', + WISHLIST_PLEDGE_DUPLICATE: 'Elementet er allerede reservert', + WISHLIST_PLEDGE_ITEM: 'Reserver element', + WISHLIST_PLEDGE_SUCCESS: 'Elementet ble reservert!', + WISHLIST_PLEDGE: 'Reserver', + WISHLIST_PLEDGED: pledgedBy => `Reservert av ${pledgedBy}`, + WISHLIST_PLEDGED_GUEST: 'Reservert av gjestebruker', + WISHLIST_PLEDGED_ITEM_FOR_USER: user => `Reserverte elementet for ${user}.`, + WISHLIST_PRICE: 'Pris', + WISHLIST_REFRESH_GUARD: 'Ugyldig bruker', + WISHLIST_REFRESH_NO_URL: 'Elementet har ingen lenke.', + WISHLIST_REFRESH_SUCCESS: 'Data ble oppdatert!', + WISHLIST_REMOVE_GUARD: 'Feil bruker', + WISHLIST_REMOVE_SUCCESS: 'Fjernet fra ønskeliste', + WISHLIST_SUGGEST: 'Foreslå element', + WISHLIST_TITLE: name => `${_CC.config.siteTitle} - Ønskeliste - ${name}`, + WISHLIST_UNPLEDGE_GUARD: 'Du har ikke reservert dette elementet', // should never happen unless someone makes their own http requests + WISHLIST_UNPLEDGE_SUCCESS: 'Reservasjonen for elementet ble trukket!', + WISHLIST_UNPLEDGE: 'Trekk reservasjon', + WISHLIST_URL_LABEL: `Elementlenke eller navn (Støttede nettsteder)`, + WISHLIST_URL_PLACEHOLDER: 'https://www.amazon.com/dp/B00ZV9RDKK', + WISHLIST_URL_REQUIRED: 'Elementlenke eller navn er påkrevd', + WISHLISTS_COUNTS_SELF: name => `${name}: ???/???`, + WISHLISTS_COUNTS: (name, pledged, total) => `${name}: ${pledged}/${total}`, + WISHLISTS_TITLE: `${_CC.config.siteTitle} - Ønskeliste` +} diff --git a/src/languages/nl-nl.js b/src/languages/nl-nl.js index 3c9f4ac..dc8e2c4 100644 --- a/src/languages/nl-nl.js +++ b/src/languages/nl-nl.js @@ -125,7 +125,7 @@ module.exports.strings = { SETUP_USERNAME_PLACEHOLDER: 'henk', SETUP_USERNAME: 'Gebruikersnaam', SUPPORTED_SITES_HEADER: 'Ondersteunde sites', - SUPPORTED_SITES_TEXT: 'Ontbreekt er een website of is er een kapot? Open een issue hier! :)', + SUPPORTED_SITES_TEXT: 'Ontbreekt er een website of is er een kapot? Open een issue hier! :)', UPDATE_NOTICE: (current, latest) => ` Christmas Community is niet meer up to date. Misschien zijn er nieuwe functies of bugfixes. Overweeg om te updaten :) diff --git a/src/languages/ro-ro.js b/src/languages/ro-ro.js index b3a5a4b..4c4ac20 100644 --- a/src/languages/ro-ro.js +++ b/src/languages/ro-ro.js @@ -125,7 +125,7 @@ module.exports.strings = { SETUP_USERNAME_PLACEHOLDER: 'ion', SETUP_USERNAME: 'Nume de utilizator', SUPPORTED_SITES_HEADER: 'Site-uri suportate', - SUPPORTED_SITES_TEXT: 'Este vreun site care lipsește sau nu funcționează corect? Sesizați problema aici! :)', + SUPPORTED_SITES_TEXT: 'Este vreun site care lipsește sau nu funcționează corect? Sesizați problema aici! :)', UPDATE_NOTICE: (current, latest) => ` Folosiți o versiune învechită a Christmas Community. Este posibil să se fi adăugat noi funcții și rezolvat erori. Este recomandată actualizarea! :) diff --git a/src/routes/index.js b/src/routes/index.js index 86e05d9..647da11 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -29,7 +29,6 @@ module.exports = ({ db, config }) => { const router = express.Router() router.use('/', express.static(path.join(__dirname, '../static'))) - router.use(require('cookie-parser')()) router.get('/', async (req, res, next) => { diff --git a/src/structures/Wishlist.js b/src/structures/Wishlist.js index 927b0b4..cb2b7bf 100644 --- a/src/structures/Wishlist.js +++ b/src/structures/Wishlist.js @@ -161,6 +161,8 @@ class Wishlist { } const productData = await getProductData(item.url) + if (!productData) return; // short-circuit when there's no data + for (const key of ['name', 'price', 'image']) { if (productData[key]) item[key] = productData[key] } diff --git a/src/views/wishlist.pug b/src/views/wishlist.pug index 039d7dd..dada33f 100644 --- a/src/views/wishlist.pug +++ b/src/views/wishlist.pug @@ -39,14 +39,27 @@ block content figure(style='width: 100%; margin: 0;') img(src=item.image, style='width: 100%; max-height: 20em; object-fit: contain;') if item.url - td.ugc(data-label='Name') - a( - href=item.url, - rel='noopener noreferrer', - target='_blank' - )= (item.name ? item.name : item.url) + td.ugc(data-label=lang('WISHLIST_NAME')) + if item.pledgedBy && item.addedBy != req.user._id + strike + a( + href=item.url, + rel='noopener noreferrer', + target='_blank' + )= (item.name ? item.name : item.url) + else + a( + href=item.url, + rel='noopener noreferrer', + target='_blank' + )= (item.name ? item.name : item.url) else - td.ugc(data-label=lang('WISHLIST_NAME'))= item.name + td.ugc(data-label='Name') + if item.pledgedBy + strike + span= item.name + else + span= item.name if _CC.config.wishlist.note.markdown td.ugc(data-label=lang('WISHLIST_NOTE')) div!= item.note @@ -143,13 +156,25 @@ block content if item.price span= ' ' if item.url - a( - href=item.url, - rel='noopener noreferrer', - target='_blank' - )= (item.name ? item.name : item.url) + if item.pledgedBy && item.addedBy != req.user._id + strike + a( + href=item.url, + rel='noopener noreferrer', + target='_blank' + )= (item.name ? item.name : item.url) + else + a( + href=item.url, + rel='noopener noreferrer', + target='_blank' + )= (item.name ? item.name : item.url) else - span= item.name + if item.pledgedBy + strike + span= item.name + else + span= item.name hr if item.note || item.image .columns @@ -163,7 +188,7 @@ block content style='height: 100%;' readonly )= item.note - span.overflowWrap=lang('WISHLIST_ADDED_BY', item.addedBy) + span.overflowWrap=lang('WISHLIST_ADDED_BY_USER', item.addedBy) hr div if req.params.user !== req.user._id && !item.pledgedBy