Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ jobs:

- run: pnpm install --frozen-lockfile

- run: pnpm run lint
- run: pnpm exec biome lint

- name: Check formatting
if: always()
run: pnpm run format:check
12 changes: 12 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.next/
out/
build/
public/rss/
pnpm-lock.yaml

# git submodule, formatted by its own repo
lib/app_localization/

# generated: contentful CLI export, crowdin exports
contentful/export.json
locales/
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
'singleQuote': true,
'printWidth': 100,
'trailingComma': 'es5',
'embeddedLanguageFormatting': 'off',
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pnpm install
5. Signup for a free [Contentful](https://www.contentful.com/) account and create an organisation and within that create a space.

We called our organization **Session** and the space **Website**.

- For the site to build correctly you need to import our Content models and assets into your Contentful space. We have created some example content so you can get comfortable with our Contentful setup.

- Add your `space ID` and `content management token` inside of [contentful/config.json](contentful/config.json)
Expand Down
6 changes: 1 addition & 5 deletions knip.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
export default {
entry: [
'pages/**/*.{js,ts,tsx}',
'app/**/*.{js,ts,tsx}',
'src/pages/**/*.{js,ts,tsx}',
],
entry: ['pages/**/*.{js,ts,tsx}', 'app/**/*.{js,ts,tsx}', 'src/pages/**/*.{js,ts,tsx}'],
project: ['**/*.{js,ts,tsx}', '!node_modules/**'],
};
101 changes: 50 additions & 51 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,50 @@ const withSvgr = require('@newhighsco/next-plugin-svgr');

const isDev = process.env.NODE_ENV === 'development';

const baseCsp = (isDev) => [
"default-src 'self'",
`script-src 'self' ${isDev ? "'unsafe-eval' 'unsafe-inline'" : "'unsafe-inline'"} *.ctfassets.net *.youtube.com *.twitter.com donorbox.org`,
"child-src 'self' *.ctfassets.net *.youtube.com player.vimeo.com *.twitter.com donorbox.org",
"style-src 'self' 'unsafe-inline' *.googleapis.com",
"img-src 'self' blob: data: *.ctfassets.net *.youtube.com *.twitter.com",
"media-src 'self' *.youtube.com",
"connect-src *",
"font-src 'self' blob: data: fonts.gstatic.com maxcdn.bootstrapcdn.com",
"worker-src 'self' blob:",
].join('; ');
const baseCsp = (isDev) =>
[
"default-src 'self'",
`script-src 'self' ${isDev ? "'unsafe-eval' 'unsafe-inline'" : "'unsafe-inline'"} *.ctfassets.net *.youtube.com *.twitter.com donorbox.org`,
"child-src 'self' *.ctfassets.net *.youtube.com player.vimeo.com *.twitter.com donorbox.org",
"style-src 'self' 'unsafe-inline' *.googleapis.com",
"img-src 'self' blob: data: *.ctfassets.net *.youtube.com *.twitter.com",
"media-src 'self' *.youtube.com",
'connect-src *',
"font-src 'self' blob: data: fonts.gstatic.com maxcdn.bootstrapcdn.com",
"worker-src 'self' blob:",
].join('; ');

// Donate page uses a wide-open CSP — Donorbox dynamically loads PayPal, Stripe,
// Google Maps, reCAPTCHA, FingerprintJS and other SDKs at runtime that are
// impossible to fully enumerate. We lock down only what we can safely restrict
// (no arbitrary workers, no data: scripts) and leave the rest open.
const donateCsp = (isDev) => [
"default-src *",
`script-src * 'unsafe-inline' ${isDev ? "'unsafe-eval'" : ""}`,
"style-src * 'unsafe-inline'",
"img-src * blob: data:",
"font-src * blob: data:",
"frame-src *",
"connect-src *",
"child-src * blob:",
"worker-src 'self' blob:",
].join('; ');
const donateCsp = (isDev) =>
[
'default-src *',
`script-src * 'unsafe-inline' ${isDev ? "'unsafe-eval'" : ''}`,
"style-src * 'unsafe-inline'",
'img-src * blob: data:',
'font-src * blob: data:',
'frame-src *',
'connect-src *',
'child-src * blob:',
"worker-src 'self' blob:",
].join('; ');

const redirects = [
{
source: '/android',
destination:
'https://play.google.com/store/apps/details?id=network.loki.messenger',
destination: 'https://play.google.com/store/apps/details?id=network.loki.messenger',
permanent: true,
},
{
source: '/apk',
destination:
'https://github.com/session-foundation/session-android/releases',
destination: 'https://github.com/session-foundation/session-android/releases',
permanent: true,
},
{
source: '/iphone',
destination:
'https://apps.apple.com/app/session-private-messenger/id1470168868?ls=1',
destination: 'https://apps.apple.com/app/session-private-messenger/id1470168868?ls=1',
permanent: true,
},
{
Expand All @@ -58,27 +57,29 @@ const redirects = [

const isTranslateMode = process.env.NEXT_PUBLIC_TRANSLATION_MODE === 'true';

process.env.ENVIRONMENT_FALLBACK = 'en'
process.env.ENVIRONMENT_FALLBACK = 'en';

// TODO: enable all available locales as we get them fully translated
const locales = !isTranslateMode ? [
'en', // English
'zh-CN', // Chinese Simplified
// 'zh-TW', // Chinese Traditional
'cs', // Czech
'nl', // Dutch
'fr', // French
'de', // German
'hi', // Hindi
// 'hu', // Hungarian
'it', // Italian
'ja', // Japanese
'pl', // Polish
// 'pt', // Portuguese
// 'ro', // Romanian
'es', // Spanish
// 'sv', // Swedish
] : ['ach'];
const locales = !isTranslateMode
? [
'en', // English
'zh-CN', // Chinese Simplified
// 'zh-TW', // Chinese Traditional
'cs', // Czech
'nl', // Dutch
'fr', // French
'de', // German
'hi', // Hindi
// 'hu', // Hungarian
'it', // Italian
'ja', // Japanese
'pl', // Polish
// 'pt', // Portuguese
// 'ro', // Romanian
'es', // Spanish
// 'sv', // Swedish
]
: ['ach'];

// @ts-check
/** @type {import('next').NextConfig} */
Expand Down Expand Up @@ -108,10 +109,8 @@ const nextConfig = {
CONTENTFUL_PREVIEW_TOKEN: process.env.CONTENTFUL_PREVIEW_TOKEN,
CAMPAIGN_MONITOR_CLIENT_ID: process.env.CAMPAIGN_MONITOR_CLIENT_ID,
CAMPAIGN_MONITOR_API_KEY: process.env.CAMPAIGN_MONITOR_API_KEY,
CAMPAIGN_MONITOR_LIST_SESSION_ID:
process.env.CAMPAIGN_MONITOR_LIST_SESSION_ID,
CAMPAIGN_MONITOR_LIST_MARKET_RESEARCH_ID:
process.env.CAMPAIGN_MONITOR_LIST_MARKET_RESEARCH_ID,
CAMPAIGN_MONITOR_LIST_SESSION_ID: process.env.CAMPAIGN_MONITOR_LIST_SESSION_ID,
CAMPAIGN_MONITOR_LIST_MARKET_RESEARCH_ID: process.env.CAMPAIGN_MONITOR_LIST_MARKET_RESEARCH_ID,
MAILERLITE_API_KEY: process.env.MAILERLITE_API_KEY,
MAILERLITE_GROUP_ID: process.env.MAILERLITE_GROUP_ID,
NEXT_PUBLIC_TRANSLATION_MODE: process.env.NEXT_PUBLIC_TRANSLATION_MODE,
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
"build:staging": "NEXT_PUBLIC_SITE_ENV=development NODE_ENV=production next build",
"start": "NEXT_PUBLIC_SITE_ENV=production NODE_ENV=production next start --hostname 127.0.0.1",
"start:staging": "NEXT_PUBLIC_SITE_ENV=development NODE_ENV=production next start --hostname 127.0.0.1",
"lint": "biome lint",
"lint:fix": "biome lint --write",
"format": "biome format --write",
"lint": "biome lint && prettier --check .",
"lint:fix": "biome lint --write && prettier --write .",
"format": "prettier --write .",
"format:check": "prettier --check .",
"check": "biome check",
"check:fix": "biome check --write"
},
Expand Down Expand Up @@ -63,6 +64,7 @@
"contentful-cli": "^1.8.17",
"cssnano": "^4.1.11",
"postcss": "^8.2.13",
"prettier": "3.7.4",
"tailwindcss": "^2.2.15",
"tailwindcss-selection-variant": "^0.1.0",
"typescript": "5.8.3"
Expand Down
2 changes: 1 addition & 1 deletion pages/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function shouldBuildSlug(slug: string): boolean {
}
}

console.log(forbiddenWords)
console.log(forbiddenWords);

for (const w of forbiddenWords) {
if (slug.includes(w)) {
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 6 additions & 11 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
--gray-light: #55595c;
--gray-DEFAULT: #3a3a3a;
--gray-dark: #333132;
--border: #DFDFDF;
--border: #dfdfdf;
--radius: 0.625rem;
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
Expand Down Expand Up @@ -52,8 +52,7 @@
@font-face {
font-family: 'PublicSans';
font-display: swap;
src: url('../public/assets/fonts/PublicSans/PublicSans-VariableFont_wght.ttf')
format('truetype');
src: url('../public/assets/fonts/PublicSans/PublicSans-VariableFont_wght.ttf') format('truetype');
font-weight: 100 900;
font-style: normal;
}
Expand All @@ -72,8 +71,7 @@
@font-face {
font-family: 'SpaceMono';
font-display: swap;
src: url('../public/assets/fonts/SpaceMono/SpaceMono-Regular.ttf')
format('truetype');
src: url('../public/assets/fonts/SpaceMono/SpaceMono-Regular.ttf') format('truetype');
font-weight: 400;
font-style: normal;
}
Expand All @@ -82,8 +80,7 @@
@font-face {
font-family: 'SpaceMono';
font-display: swap;
src: url('../public/assets/fonts/SpaceMono/SpaceMono-Bold.ttf')
format('truetype');
src: url('../public/assets/fonts/SpaceMono/SpaceMono-Bold.ttf') format('truetype');
font-weight: 700;
font-style: normal;
}
Expand All @@ -92,8 +89,7 @@
@font-face {
font-family: 'SpaceMono';
font-display: swap;
src: url('../public/assets/fonts/SpaceMono/SpaceMono-Italic.ttf')
format('truetype');
src: url('../public/assets/fonts/SpaceMono/SpaceMono-Italic.ttf') format('truetype');
font-weight: 400;
font-style: italic;
}
Expand All @@ -102,8 +98,7 @@
@font-face {
font-family: 'SpaceMono';
font-display: swap;
src: url('../public/assets/fonts/SpaceMono/SpaceMono-BoldItalic.ttf')
format('truetype');
src: url('../public/assets/fonts/SpaceMono/SpaceMono-BoldItalic.ttf') format('truetype');
font-weight: 700;
font-style: italic;
}
Expand Down
9 changes: 3 additions & 6 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ module.exports = {
dark: 'var(--gray-dark)',
},
border: {
DEFAULT: 'var(--border)'
}
DEFAULT: 'var(--border)',
},
},
height: {
120: '30rem', // for larger images
Expand Down Expand Up @@ -80,8 +80,5 @@ module.exports = {
transitionDuration: ['group-hover'],
},
},
plugins: [
require('@tailwindcss/forms'),
require('tailwindcss-selection-variant'),
],
plugins: [require('@tailwindcss/forms'), require('tailwindcss-selection-variant')],
};
4 changes: 1 addition & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
// "noUnusedParameters": true, /* report errors on unused parameters (again, suggested for clean code writing) */
"incremental": true
},
"include": [
"global.d.ts",
"next-env.d.ts", "additional.d.ts", "**/*.ts", "**/*.tsx"],
"include": ["global.d.ts", "next-env.d.ts", "additional.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", ".next", "out"]
}
Loading