diff --git a/layouts/default.vue b/layouts/default.vue index b66f12b8f..97c475135 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -73,14 +73,8 @@ declare module 'vue/types/vue' { } export default dark.extend({ - data(): { requiresLogin: boolean, testerPassword: string, testerPasswordCookie: string } { + data(): { testerPassword: string, testerPasswordCookie: string } { return { - requiresLogin: this.$config.locale !== '_' && ( - !this.$locales[this.$config.locale] || - !this.$locales[this.$config.locale].published || - process.env.NODE_ENV === 'test' || - process.env.BASE_URL!.includes('test.pronouns.page') - ), testerPassword: '', testerPasswordCookie: this.$cookies.get(TESTER_PASSWORD_COOKIE_KEY), }; @@ -96,6 +90,9 @@ export default dark.extend({ return !!this.$config.ads?.enabled && process.env.NODE_ENV !== 'development'; }, + requiresLogin(): boolean { + return process.env.ENV === 'test' || !this.$locales[this.$config.locale]?.published; + }, testerPasswordValid(): boolean { return !!this.testerPasswordCookie && md5(this.testerPasswordCookie) === TESTER_PASSWORD_HASH; }, diff --git a/nuxt.config.ts b/nuxt.config.ts index e4f3bf038..b5d91ee37 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -45,8 +45,8 @@ const allVersionsUrls = buildList(function*() { yield process.env.BASE_URL; yield 'http://pronouns.test:3000'; yield 'http://localhost:3000'; - } else if (process.env.NODE_ENV === 'test') { - yield 'https://test.pronouns.page'; + } else if (process.env.ENV === 'test') { + yield process.env.BASE_URL; } else { yield 'https://pronouns.page'; for (const localeDescription of Object.values(locales)) { @@ -318,6 +318,7 @@ const nuxtConfig: NuxtConfig = { transpile: ['markdown-it'], }, env: { + ENV: process.env.ENV!, BASE_URL: process.env.BASE_URL!, HOME_URL: process.env.HOME_URL || 'https://pronouns.page', PUBLIC_KEY: fs.readFileSync(`${__dirname}/keys/public.pem`).toString(),