Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ jobs:
- run: pnpm install --frozen-lockfile

- run: pnpm run lint

- name: Check formatting
if: always()
run: pnpm run format:check
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
# misc
.DS_Store
*.pem
.vscode
.vscode/*
!.vscode/settings.json
!.vscode/extensions.json
.venv

# debug
Expand Down
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["biomejs.biome"]
}
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"[javascript]": { "editor.defaultFormatter": "biomejs.biome" },
"[javascriptreact]": { "editor.defaultFormatter": "biomejs.biome" },
"[typescript]": { "editor.defaultFormatter": "biomejs.biome" },
"[typescriptreact]": { "editor.defaultFormatter": "biomejs.biome" },
"[json]": { "editor.defaultFormatter": "biomejs.biome" },
"[jsonc]": { "editor.defaultFormatter": "biomejs.biome" },
"[css]": { "editor.defaultFormatter": "biomejs.biome" }
}
13 changes: 9 additions & 4 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"$schema": "https://biomejs.dev/schemas/2.1.2/schema.json",
"vcs": {
"enabled": false,
"enabled": true,
"clientKind": "git",
"useIgnoreFile": false
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"includes": ["./**/*.ts", "./**/*.tsx"]
"ignoreUnknown": true,
"includes": ["**", "!**/lib/app_localization/**", "!**/locales/**", "!contentful/export.json"]
},
"formatter": {
"enabled": true,
Expand Down Expand Up @@ -87,5 +87,10 @@
"organizeImports": "on"
}
}
},
"css": {
"formatter": {
"quoteStyle": "single"
}
}
}
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"lint": "biome lint",
"lint:fix": "biome lint --write",
"format": "biome format --write",
"format:check": "biome format",
"check": "biome check",
"check:fix": "biome check --write"
},
Expand Down
2 changes: 0 additions & 2 deletions pages/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ function shouldBuildSlug(slug: string): boolean {
}
}

console.log(forbiddenWords)

for (const w of forbiddenWords) {
if (slug.includes(w)) {
return false;
Expand Down
21 changes: 8 additions & 13 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,17 +98,16 @@
@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;
}

/** Icon font
* Current: Lucide v0.488.0
* Download from https://github.com/lucide-icons/lucide/releases
* NOTE Make sure the lucide-react package is the same version
*/
* NOTE Make sure the lucide-react package is the same version
*/
@font-face {
font-family: 'Lucide';
src: url('../public/assets/fonts/lucide.ttf') format('truetype');
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