release(desktop): Release v0.4.1

release(desktop): Release v0.4.1
This commit is contained in:
DIYgod
2025-04-05 11:01:47 +08:00
committed by GitHub
477 changed files with 18420 additions and 6809 deletions
+78
View File
@@ -0,0 +1,78 @@
name: Build Android
on:
push:
branches: [dev]
paths:
- "apps/mobile/web-app/**"
- "apps/mobile/native/**"
- "apps/mobile/package.json"
- "apps/mobile/app.config.ts"
pull_request:
branches: [dev]
paths:
- "apps/mobile/web-app/**"
- "apps/mobile/native/**"
- "apps/mobile/package.json"
- "apps/mobile/app.config.ts"
workflow_dispatch:
inputs:
profile:
type: choice
default: preview
options:
- preview
- production
description: "Build profile"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build Android apk for device
if: github.secret_source != 'None'
runs-on: ubuntu-latest
steps:
- name: 📦 Checkout code
uses: actions/checkout@v4
- name: 📦 Setup pnpm
uses: pnpm/action-setup@v4
- name: 🏗 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "zulu"
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: 📱 Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Install dependencies
run: pnpm install
- name: 🔨 Build Android app
working-directory: apps/mobile
run: eas build --platform android --profile ${{ github.event.inputs.profile || 'preview' }} --local --output=${{ github.workspace }}/build.apk
- name: 📤 Upload apk Artifact
uses: actions/upload-artifact@v4
with:
name: app-android
path: ${{ github.workspace }}/build.apk
retention-days: 90
@@ -7,12 +7,14 @@ on:
- "apps/mobile/web-app/**"
- "apps/mobile/native/**"
- "apps/mobile/package.json"
- "apps/mobile/app.config.ts"
pull_request:
branches: [dev]
paths:
- "apps/mobile/web-app/**"
- "apps/mobile/native/**"
- "apps/mobile/package.json"
- "apps/mobile/app.config.ts"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -81,6 +83,11 @@ jobs:
path: apps/mobile/build.ipa
retention-days: 90
- name: Clear Xcode cache
if: needs.check-runner.outputs.runner-label == 'self-hosted'
run: |
rm -rf ~/Library/Developer/Xcode/DerivedData
build-simulator:
name: Build iOS IPA for simulator
if: github.secret_source != 'None'
+5
View File
@@ -88,6 +88,11 @@ jobs:
path: apps/mobile/build.ipa
retention-days: 90
- name: Clear Xcode cache
if: needs.check-runner.outputs.runner-label == 'self-hosted'
run: |
rm -rf ~/Library/Developer/Xcode/DerivedData
- name: Submit to App Store
if: github.event.inputs.profile == 'production'
run: |
+43 -23
View File
@@ -11,9 +11,9 @@ on:
tag_version:
type: boolean
description: "Tag Version"
mas:
store:
type: boolean
description: "Build for Mac App Store"
description: "Build for Mac App Store and Microsoft Store"
build_version:
type: string
description: "Build Version, only available when mas is true"
@@ -34,14 +34,16 @@ env:
jobs:
release:
runs-on: ${{ matrix.os }}
env:
PROD: ${{ github.event.inputs.tag_version == 'true' || github.ref_type == 'tag' || github.event.inputs.store == 'true' }}
RELEASE: ${{ github.event.inputs.tag_version == 'true' || github.ref_type == 'tag' }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
exclude:
- os: ${{ github.event.inputs.mas == 'true' && 'ubuntu-latest' }}
- os: ${{ github.event.inputs.mas == 'true' && 'windows-latest' }}
- os: ${{ github.event.inputs.store == 'true' && 'ubuntu-latest' }}
permissions:
id-token: write
@@ -51,13 +53,13 @@ jobs:
steps:
- name: Check out Git repository Fully
uses: actions/checkout@v4
if: github.event.inputs.tag_version == 'true' || github.ref_type == 'tag'
if: env.PROD == 'true'
with:
fetch-depth: 0
lfs: true
- name: Check out Git repository
uses: actions/checkout@v4
if: github.event.inputs.tag_version != 'true' && github.ref_type != 'tag'
if: env.PROD == 'false'
with:
fetch-depth: 1
lfs: true
@@ -125,14 +127,22 @@ jobs:
run: |
cd apps/desktop
pnpm update:main-hash
- name: Build
- name: Build - Vite
run: |
cd apps/desktop
pnpm build:electron-vite ${{ env.PROD == 'false' && '--mode staging' || '' }}
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Build - Windows and Linux
if: runner.os != 'macOS'
run: pnpm build:electron
run: |
cd apps/desktop
pnpm build:electron-forge ${{ env.PROD == 'false' && '--mode=staging' || '' }}
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Build (macOS)
if: runner.os == 'macOS' && github.event.inputs.mas != 'true'
- name: Build - macOS
if: runner.os == 'macOS' && github.event.inputs.store != 'true'
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
@@ -143,20 +153,28 @@ jobs:
with:
max_attempts: 3
timeout_minutes: 10
command: pnpm build:macos
command: |
cd apps/desktop
npx electron-forge make --arch=x64 --platform=darwin ${{ env.PROD == 'false' && '--mode=staging' || '' }}
npx electron-forge make --arch=arm64 --platform=darwin ${{ env.PROD == 'false' && '--mode=staging' || '' }}
npx tsx scripts/merge-yml.ts
- name: Build (Mac App Store)
if: runner.os == 'macOS' && github.event.inputs.mas == 'true'
- name: Build - Mac App Store
if: runner.os == 'macOS' && github.event.inputs.store == 'true'
env:
OSX_SIGN_KEYCHAIN_PATH: ${{ runner.temp }}/app-signing.keychain-db
OSX_SIGN_IDENTITY: ${{ secrets.OSX_SIGN_IDENTITY_MAS }}
OSX_SIGN_PROVISIONING_PROFILE_PATH: ${{ runner.temp }}/build_pp.provisionprofile
BUILD_VERSION: ${{ github.event.inputs.build_version }}
run: pnpm build:mas
run: |
cd apps/desktop
pnpm build:electron-forge:mas
- name: Build Renderer
- name: Build - Renderer
if: runner.os == 'Linux'
run: pnpm build:render
run: |
cd apps/desktop
pnpm build:render
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
@@ -209,7 +227,8 @@ jobs:
retention-days: 90
- uses: signpath/github-action-submit-signing-request@v1.1
if: runner.os == 'windows' && (github.ref_type == 'tag' || github.event.inputs.tag_version == 'true')
continue-on-error: true
if: runner.os == 'windows' && env.RELEASE == 'true'
with:
api-token: "${{ secrets.SIGNPATH_API_TOKEN }}"
organization-id: "8c651516-fdaf-40a1-9fea-001dffde850e"
@@ -220,12 +239,12 @@ jobs:
output-artifact-directory: "apps/desktop/out/make/"
- name: Update latest.yml
if: runner.os == 'windows' && (github.ref_type == 'tag' || github.event.inputs.tag_version == 'true')
if: runner.os == 'windows' && env.RELEASE == 'true'
run: npx tsx apps/desktop/scripts/update-windows-yml.ts
- name: Upload file (windows-x64-exe signed)
uses: actions/upload-artifact@v4
if: runner.os == 'windows' && (github.ref_type == 'tag' || github.event.inputs.tag_version == 'true')
if: runner.os == 'windows' && env.RELEASE == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
@@ -244,7 +263,7 @@ jobs:
with:
name: windows-x64-appx
path: |
apps/desktop/out/make/**/*x64.appx
apps/desktop/out/make/**/*.appx
retention-days: 90
- name: Upload file (linux-x64-appimage)
@@ -260,7 +279,7 @@ jobs:
retention-days: 90
- name: Generate artifact attestation
if: github.ref_type == 'tag' || github.event.inputs.tag_version == 'true'
if: env.RELEASE == 'true'
continue-on-error: true
uses: actions/attest-build-provenance@v2
with:
@@ -274,19 +293,20 @@ jobs:
apps/desktop/dist/*.tar.gz
- run: npx changelogithub
if: github.ref_type == 'tag' || github.event.inputs.tag_version == 'true'
if: env.RELEASE == 'true'
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Version
if: env.RELEASE == 'true'
id: version
uses: ./.github/actions/setup-version
with:
type: "desktop"
- name: Create Release Draft
if: github.ref_type == 'tag' || github.event.inputs.tag_version == 'true'
if: env.RELEASE == 'true'
uses: softprops/action-gh-release@v2
with:
name: v${{ steps.version.outputs.APP_VERSION }}
+21
View File
@@ -0,0 +1,21 @@
# What's New in v0.4.1
## New Features
- Added a "Mark Above as Read" button at the bottom of the entry list (88963a9)
## Improvements
- Enable linking social accounts with a different email (#3355)
- Integrated a more advanced AI model for enhanced performance
- Increased the number of invitation codes that users can create
- Excluded entries without images from the picture view for a streamlined browsing experience
## Bug Fixes
- Updated the icon for "View Source Content" to distinguish it from "Open in Browser" (#3373)
- Fixed the problem of unread entries being incorrectly marked as read (#3305)
- Corrected an issue where the modal's close button was unresponsive in certain scenarios (#3387)
- Addressed a bug that prevented actions from being saved when empty (a997329)
- Corrected an issue where unread statuses were not properly displayed in some instances
- Fixed the timing of new content notifications to ensure they are sent only after the content is available
+1 -1
View File
@@ -35,7 +35,7 @@ export const viteRenderBaseConfig = {
alias: {
"~": resolve("src/renderer/src"),
"@pkg": resolve("package.json"),
"@locales": resolve("locales"),
"@locales": resolve("../../locales"),
"@follow/electron-main": resolve("src/main/src"),
},
},
+2 -2
View File
@@ -19,7 +19,7 @@ export default defineConfig({
alias: {
"@shared": resolve("packages/shared/src"),
"@pkg": resolve("./package.json"),
"@locales": resolve("./locales"),
"@locales": resolve("../../locales"),
"~": resolve("./src/main/src"),
},
},
@@ -38,7 +38,7 @@ export default defineConfig({
resolve: {
alias: {
"@pkg": resolve("./package.json"),
"@locales": resolve("./locales"),
"@locales": resolve("../../locales"),
},
},
},
+6 -3
View File
@@ -19,6 +19,9 @@ import yaml from "js-yaml"
import { rimraf, rimrafSync } from "rimraf"
const platform = process.argv.find((arg) => arg.startsWith("--platform"))?.split("=")[1]
const mode = process.argv.find((arg) => arg.startsWith("--mode"))?.split("=")[1]
const isStaging = mode === "staging"
const artifactRegex = /.*\.(?:exe|dmg|AppImage|zip)$/
const platformNamesMap = {
@@ -96,7 +99,7 @@ const config: ForgeConfig = {
appCategoryType: "public.app-category.news",
buildVersion: process.env.BUILD_VERSION || undefined,
appBundleId: "is.follow",
icon: "resources/icon",
icon: isStaging ? "resources/icon-staging" : "resources/icon",
extraResource: ["./resources/app-update.yml"],
protocols: [
{
@@ -178,14 +181,14 @@ const config: ForgeConfig = {
),
new MakerSquirrel({
name: "Folo",
setupIcon: "resources/icon.ico",
setupIcon: isStaging ? "resources/icon-staging.ico" : "resources/icon.ico",
iconUrl: "https://app.follow.is/favicon.ico",
}),
new MakerAppImage({
config: {
icons: [
{
file: "resources/icon.png",
file: isStaging ? "resources/icon-staging.png" : "resources/icon.png",
size: 256,
},
],
-45
View File
@@ -1,45 +0,0 @@
{
"app.copied_to_clipboard": "Copied to clipboard",
"cancel": "Cancel",
"close": "Close",
"confirm": "Confirm",
"ok": "OK",
"quantifier.piece": "",
"retry": "Retry",
"space": " ",
"time.last_night": "Last Night",
"time.the_night_before_last": "The Night Before Last",
"time.today": "Today",
"time.yesterday": "Yesterday",
"tips.load-lng-error": "Failed to load language pack",
"words.actions": "Actions",
"words.ago": "ago",
"words.all": "All",
"words.back": "Back",
"words.copy": "Copy",
"words.create": "Create",
"words.default": "Default",
"words.delete": "Delete",
"words.download": "Download",
"words.edit": "Edit",
"words.entry": "Entry",
"words.expand": "Expand",
"words.follow": "Follow",
"words.id": "ID",
"words.items_one": "Item",
"words.items_other": "Items",
"words.local": "local",
"words.manage": "Manage",
"words.record": "record",
"words.record_one": "record",
"words.record_other": "records",
"words.reset": "Reset",
"words.result": "result",
"words.result_one": "result",
"words.result_other": "results",
"words.rsshub": "RSSHub",
"words.save": "Save",
"words.submit": "Submit",
"words.update": "Update",
"words.which.all": "All"
}
-44
View File
@@ -1,44 +0,0 @@
{
"app.copied_to_clipboard": "クリップボードにコピーしました",
"cancel": "キャンセル",
"close": "閉じる",
"confirm": "確認",
"ok": "OK",
"quantifier.piece": "個",
"retry": "再試行",
"space": " ",
"time.last_night": "昨夜",
"time.the_night_before_last": "一昨夜",
"time.today": "今日",
"time.yesterday": "昨日",
"tips.load-lng-error": "言語パックの読み込みに失敗しました",
"words.actions": "アクション",
"words.ago": "前",
"words.all": "すべて",
"words.back": "戻る",
"words.copy": "コピー",
"words.create": "作成",
"words.delete": "削除",
"words.download": "ダウンロード",
"words.edit": "編集",
"words.entry": "エントリー",
"words.expand": "展開",
"words.follow": "フォロー",
"words.id": "ID",
"words.items_one": "アイテム",
"words.items_other": "アイテム",
"words.local": "ローカル",
"words.manage": "マネージ",
"words.record": "記録",
"words.record_one": "記録",
"words.record_other": "記録",
"words.reset": "リセット",
"words.result": "結果",
"words.result_one": "結果",
"words.result_other": "結果",
"words.rsshub": "RSSHub",
"words.save": "保存",
"words.submit": "送信",
"words.update": "更新",
"words.which.all": "すべて"
}
-44
View File
@@ -1,44 +0,0 @@
{
"app.copied_to_clipboard": "클립보드에 복사됨",
"cancel": "취소",
"close": "닫기",
"confirm": "확인",
"ok": "확인",
"quantifier.piece": "",
"retry": "재시도",
"space": " ",
"time.last_night": "어젯밤",
"time.the_night_before_last": "그저께 밤",
"time.today": "오늘",
"time.yesterday": "어제",
"tips.load-lng-error": "언어 팩을 불러오지 못했습니다",
"words.actions": "액션",
"words.ago": "전",
"words.all": "전체",
"words.back": "뒤로",
"words.copy": "복사",
"words.create": "생성",
"words.delete": "삭제",
"words.download": "다운로드",
"words.edit": "편집",
"words.entry": "항목",
"words.expand": "펼치기",
"words.follow": "팔로우",
"words.id": "ID",
"words.items_one": "항목",
"words.items_other": "항목들",
"words.local": "로컬",
"words.manage": "관리",
"words.record": "기록",
"words.record_one": "기록",
"words.record_other": "기록들",
"words.reset": "초기화",
"words.result": "결과",
"words.result_one": "결과",
"words.result_other": "결과들",
"words.rsshub": "RSSHub",
"words.save": "저장",
"words.submit": "제출",
"words.update": "업데이트",
"words.which.all": "모두"
}
-44
View File
@@ -1,44 +0,0 @@
{
"app.copied_to_clipboard": "Скопировано в буфер обмена",
"cancel": "Отменить",
"close": "Закрыть",
"confirm": "Подтвердить",
"ok": "ОК",
"quantifier.piece": "",
"retry": "Повторить попытку",
"space": " ",
"time.last_night": "Прошлой ночью",
"time.the_night_before_last": "Позапрошлой ночью",
"time.today": "Сегодня",
"time.yesterday": "Вчера",
"tips.load-lng-error": "Не удалось загрузить языковой пакет",
"words.actions": "Действия",
"words.ago": "назад",
"words.all": "Все",
"words.back": "Назад",
"words.copy": "Копировать",
"words.create": "Создать",
"words.delete": "Удалить",
"words.download": "Скачать",
"words.edit": "Редактировать",
"words.entry": "Запись",
"words.expand": "Расширить",
"words.follow": "Следовать",
"words.id": "ID",
"words.items_one": "Элемент",
"words.items_other": "Элементы",
"words.local": "локальный",
"words.manage": "Управлять",
"words.record": "запись",
"words.record_one": "запись",
"words.record_other": "записи",
"words.reset": "Сброс",
"words.result": "результат",
"words.result_one": "результат",
"words.result_other": "результаты",
"words.rsshub": "RSSHub",
"words.save": "Сохранить",
"words.submit": "Отправить",
"words.update": "Обновить",
"words.which.all": "Все"
}
-45
View File
@@ -1,45 +0,0 @@
{
"app.copied_to_clipboard": "已复制到剪贴板",
"cancel": "取消",
"close": "关闭",
"confirm": "确认",
"ok": "好",
"quantifier.piece": "条",
"retry": "重试",
"space": "",
"time.last_night": "昨晚",
"time.the_night_before_last": "前天晚上",
"time.today": "今天",
"time.yesterday": "昨天",
"tips.load-lng-error": "加载语言包失败",
"words.actions": "操作",
"words.ago": "前",
"words.all": "全部",
"words.back": "返回",
"words.copy": "复制",
"words.create": "创建",
"words.default": "默认",
"words.delete": "删除",
"words.download": "下载",
"words.edit": "编辑",
"words.entry": "条目",
"words.expand": "展开",
"words.follow": "关注",
"words.id": "ID",
"words.items_one": "内容",
"words.items_other": "内容",
"words.local": "本地",
"words.manage": "管理",
"words.record": "记录",
"words.record_one": "记录",
"words.record_other": "记录",
"words.reset": "重置",
"words.result": "结果",
"words.result_one": "结果",
"words.result_other": "结果",
"words.rsshub": "RSSHub",
"words.save": "保存",
"words.submit": "提交",
"words.update": "更新",
"words.which.all": "全部"
}
-45
View File
@@ -1,45 +0,0 @@
{
"app.copied_to_clipboard": "已複製到剪貼簿",
"cancel": "取消",
"close": "關閉",
"confirm": "確認",
"ok": "確定",
"quantifier.piece": "",
"retry": "重試",
"space": " ",
"time.last_night": "昨晚",
"time.the_night_before_last": "前晚",
"time.today": "今天",
"time.yesterday": "昨天",
"tips.load-lng-error": "語言包載入失敗",
"words.actions": "操作",
"words.ago": "前",
"words.all": "全部",
"words.back": "返回",
"words.copy": "複製",
"words.create": "建立",
"words.default": "預設",
"words.delete": "刪除",
"words.download": "下載",
"words.edit": "編輯",
"words.entry": "條目",
"words.expand": "展開",
"words.follow": "追隨",
"words.id": "ID",
"words.items_one": "項目",
"words.items_other": "項目",
"words.local": "本地",
"words.manage": "管理",
"words.record": "記錄",
"words.record_one": "記錄",
"words.record_other": "記錄",
"words.reset": "重設",
"words.result": "結果",
"words.result_one": "結果",
"words.result_other": "結果",
"words.rsshub": "RSSHub",
"words.save": "儲存",
"words.submit": "提交",
"words.update": "更新",
"words.which.all": "全部"
}
-44
View File
@@ -1,44 +0,0 @@
{
"app.copied_to_clipboard": "已複製到剪貼簿",
"cancel": "取消",
"close": "關閉",
"confirm": "確認",
"ok": "確定",
"quantifier.piece": "條",
"retry": "重試",
"space": " ",
"time.last_night": "昨晚",
"time.the_night_before_last": "前晚",
"time.today": "今天",
"time.yesterday": "昨天",
"tips.load-lng-error": "語言套件讀取失敗",
"words.actions": "操作",
"words.ago": "前",
"words.all": "全部",
"words.back": "返回",
"words.copy": "複製",
"words.create": "創建",
"words.delete": "刪除",
"words.download": "下載",
"words.edit": "編輯",
"words.entry": "條目",
"words.expand": "展開",
"words.follow": "跟隨",
"words.id": "ID",
"words.items_one": "內容",
"words.items_other": "內容",
"words.local": "本地",
"words.manage": "管理",
"words.record": "記錄",
"words.record_one": "記錄",
"words.record_other": "記錄",
"words.reset": "重置",
"words.result": "結果",
"words.result_one": "結果",
"words.result_other": "結果",
"words.rsshub": "RSSHub",
"words.save": "儲存",
"words.submit": "提交",
"words.update": "更新",
"words.which.all": "全部"
}
+9 -8
View File
@@ -1,7 +1,7 @@
{
"name": "Folo",
"type": "module",
"version": "0.4.0",
"version": "0.4.1",
"private": true,
"description": "Follow everything in one place",
"author": "Folo Team",
@@ -13,9 +13,11 @@
"main": "./dist/main/index.js",
"scripts": {
"analyze:web": "cross-env analyzer=1 vite build",
"build": "electron-vite build && electron-forge make",
"build:macos": "electron-vite build && electron-forge make --arch=x64 --platform=darwin && electron-forge make --arch=arm64 --platform=darwin && tsx scripts/merge-yml.ts",
"build:mas": "electron-vite build && electron-forge make --arch=universal --platform=mas",
"build:electron": "electron-vite build && electron-forge make",
"build:electron-forge": "electron-forge make",
"build:electron-forge:macos": "electron-forge make --arch=x64 --platform=darwin && electron-forge make --arch=arm64 --platform=darwin && tsx scripts/merge-yml.ts",
"build:electron-forge:mas": "electron-forge make --arch=universal --platform=mas",
"build:electron-vite": "electron-vite build",
"build:render": "vite build -c vite.config.electron-render.ts",
"build:web": "rm -rf out/web && cross-env WEB_BUILD=1 vite build",
"bump": "vv",
@@ -26,7 +28,6 @@
"dev:electron": "electron-vite dev",
"dev:server": "pnpm run --filter=ssr dev",
"dev:web": "cross-env WEB_BUILD=1 vite",
"generator:i18n-template": "tsx scripts/generate-i18n-locale.ts",
"publish": "electron-vite build && electron-forge publish",
"start": "electron-vite preview",
"update:main-hash": "tsx plugins/vite/generate-main-hash.ts"
@@ -53,7 +54,7 @@
"@follow/shared": "workspace:*",
"@follow/utils": "workspace:*",
"@pengx17/electron-forge-maker-appimage": "1.2.1",
"@sentry/vite-plugin": "3.2.2",
"@sentry/vite-plugin": "3.2.4",
"@types/html-minifier-terser": "7.0.2",
"@types/js-yaml": "4.0.9",
"@types/react-google-recaptcha": "2.1.9",
@@ -64,7 +65,7 @@
"cssnano": "7.0.6",
"dotenv": "16.4.7",
"drizzle-orm": "0.41.0",
"electron": "34.3.4",
"electron": "34.4.1",
"electron-devtools-installer": "4.0.0",
"electron-packager-languages": "0.6.0",
"electron-vite": "3.1.0",
@@ -82,7 +83,7 @@
"utf-8-validate": "6.0.5"
},
"productName": "Folo",
"mainHash": "2c7aa5b45904e0ed7b096a18828311b13397f3c7f62d83f6e6ae2d586a70d5b4",
"mainHash": "039327ef2c09e66d8f5c4e021f33d78d4497794b222114fee795ed70c2045000",
"bump": {
"before": [
"git pull --rebase",
+1 -1
View File
@@ -12,7 +12,7 @@ export function localesPlugin(): Plugin {
generateBundle(_options, bundle) {
const __dirname = dirname(fileURLToPath(import.meta.url))
const localesDir = path.resolve(__dirname, "../../locales")
const localesDir = path.resolve(__dirname, "../../../../locales")
const namespaces = fs.readdirSync(localesDir).filter((dir) => dir !== ".DS_Store")
const languageResources = {} as any
@@ -58,5 +58,5 @@ function calculateCompleteness(localesDir: string): LanguageCompletion {
}
const __dirname = dirname(fileURLToPath(import.meta.url))
const i18n = calculateCompleteness(path.resolve(__dirname, "../../../locales"))
const i18n = calculateCompleteness(path.resolve(__dirname, "../../../../../locales"))
export default i18n
Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 431 B

+6 -6
View File
@@ -30,14 +30,14 @@
"@follow/utils": "workspace:*",
"@openpanel/web": "1.0.1",
"@sentry/electron": "6.3.0",
"builder-util-runtime": "9.2.10",
"builder-util-runtime": "9.3.1",
"cookie-es": "2.0.0",
"electron-context-menu": "4.0.5",
"electron-log": "5.3.2",
"electron-log": "5.3.3",
"electron-squirrel-startup": "1.0.1",
"electron-store": "10.0.1",
"electron-updater": "6.3.9",
"es-toolkit": "1.33.0",
"electron-updater": "6.6.2",
"es-toolkit": "1.34.1",
"fast-folder-size": "2.4.0",
"font-list": "1.5.1",
"i18next": "24.2.3",
@@ -55,8 +55,8 @@
"@follow/models": "workspace:*",
"@follow/types": "workspace:*",
"@types/js-yaml": "4.0.9",
"@types/node": "22.13.13",
"electron": "34.3.4",
"@types/node": "22.13.14",
"electron": "34.4.1",
"electron-devtools-installer": "4.0.0",
"hono": "4.7.5"
}
@@ -1,5 +1,6 @@
const langs = ["en", "zh-CN", "ja"]
export const currentSupportedLanguages = langs.sort()
const langs = ["en", "zh-CN", "zh-HK", "zh-TW", "ja"] as const
export const currentSupportedLanguages = [...langs].sort() as string[]
export type MainSupportedLanguages = (typeof langs)[number]
export const ns = ["native"] as const
export const defaultNS = "native" as const
@@ -4,6 +4,8 @@ import zhCn from "@locales/native/zh-CN.json"
import zhHk from "@locales/native/zh-HK.json"
import zhTw from "@locales/native/zh-TW.json"
import type { MainSupportedLanguages, ns } from "./constants"
export const resources = {
en: {
native: en,
@@ -20,4 +22,4 @@ export const resources = {
ja: {
native: ja,
},
}
} satisfies Record<MainSupportedLanguages, Record<(typeof ns)[number], Record<string, string>>>
+2 -3
View File
@@ -1,9 +1,8 @@
import os from "node:os"
export const mode = process.env.NODE_ENV
export const isDev = mode === "development"
import { DEV } from "@follow/shared/constants"
export const channel: "development" | "beta" | "alpha" | "stable" = isDev ? "development" : "stable"
export const channel: "development" | "beta" | "alpha" | "stable" = DEV ? "development" : "stable"
const { platform } = process
export const isMacOS = platform === "darwin"
+10 -5
View File
@@ -1,21 +1,26 @@
import path from "node:path"
import { fileURLToPath, pathToFileURL } from "node:url"
import { MODE, ModeEnum } from "@follow/shared/constants"
import { isMacOS, isWindows } from "./env"
const __dirname = fileURLToPath(new URL(".", import.meta.url))
const iconMap = {
prod: path.join(__dirname, "../../resources/icon.png"),
dev: path.join(__dirname, "../../static/icon-dev.png"),
[ModeEnum.production]: path.join(__dirname, "../../resources/icon.png"),
[ModeEnum.development]: path.join(__dirname, "../../resources/icon-dev.png"),
[ModeEnum.staging]: path.join(__dirname, "../../resources/icon-staging.png"),
}
export const getIconPath = () => iconMap[process.env.NODE_ENV === "development" ? "dev" : "prod"]
export const getIconPath = () => iconMap[MODE]
export const getTrayIconPath = () => {
if (isMacOS) {
return path.join(__dirname, "../../resources/tray-icon.png")
return path.join(__dirname, "../../resources/icon-tray.png")
}
if (isWindows) {
// https://www.electronjs.org/docs/latest/api/tray#:~:text=Windows,best%20visual%20effects.
return path.join(__dirname, "../../resources/icon-no-padding.ico")
return MODE === ModeEnum.staging
? path.join(__dirname, "../../resources/icon-tray-staging.ico")
: path.join(__dirname, "../../resources/icon-tray.ico")
}
return getIconPath()
}
+3 -3
View File
@@ -1,6 +1,6 @@
import { electronApp, optimizer } from "@electron-toolkit/utils"
import { callWindowExpose } from "@follow/shared/bridge"
import { APP_PROTOCOL } from "@follow/shared/constants"
import { APP_PROTOCOL, DEV } from "@follow/shared/constants"
import { env } from "@follow/shared/env.desktop"
import { createBuildSafeHeaders } from "@follow/utils/headers"
import { IMAGE_PROXY_URL } from "@follow/utils/img-proxy"
@@ -9,7 +9,7 @@ import { app, BrowserWindow, net, protocol, session } from "electron"
import squirrelStartup from "electron-squirrel-startup"
import { DEVICE_ID } from "./constants/system"
import { isDev, isMacOS } from "./env"
import { isMacOS } from "./env"
import { initializeAppStage0, initializeAppStage1 } from "./init"
import { updateProxy } from "./lib/proxy"
import { handleUrlRouting } from "./lib/router"
@@ -26,7 +26,7 @@ import {
windowStateStoreKey,
} from "./window"
if (isDev) console.info("[main] env loaded:", env)
if (DEV) console.info("[main] env loaded:", env)
const apiURL = process.env["VITE_API_URL"] || import.meta.env.VITE_API_URL
+3 -4
View File
@@ -2,7 +2,7 @@ import path from "node:path"
import { getRendererHandlers, registerIpcMain } from "@egoist/tipc/main"
import { PushReceiver } from "@eneris/push-receiver"
import { APP_PROTOCOL } from "@follow/shared/constants"
import { APP_PROTOCOL, DEV } from "@follow/shared/constants"
import { env } from "@follow/shared/env.desktop"
import type { MessagingData } from "@follow/shared/hono"
import { app, nativeTheme, Notification, protocol, shell } from "electron"
@@ -23,13 +23,12 @@ import { createMainWindow, getMainWindow } from "./window"
if (process.argv.length === 3 && process.argv[2]!.startsWith("follow-dev:")) {
process.env.NODE_ENV = "development"
}
const isDev = process.env.NODE_ENV === "development"
/**
* Mandatory and fast initializers for the app
*/
export function initializeAppStage0() {
if (isDev) app.setPath("appData", path.join(app.getPath("appData"), "Follow (dev)"))
if (DEV) app.setPath("appData", path.join(app.getPath("appData"), "Follow (dev)"))
initializeSentry()
}
export const initializeAppStage1 = () => {
@@ -86,7 +85,7 @@ export const registerMenuAndContextMenu = () => {
showCopyLink: true,
showCopyImageAddress: true,
showCopyImage: true,
showInspectElement: isDev,
showInspectElement: DEV,
showSelectAll: true,
showCopyVideoAddress: true,
showSaveVideoAs: true,
+8 -2
View File
@@ -3,7 +3,7 @@ import { app, Menu, nativeImage, Tray } from "electron"
import { isMacOS } from "~/env"
import { getTrayIconPath } from "~/helper"
import { revealLogFile } from "~/logger"
import { logger, revealLogFile } from "~/logger"
import { checkForAppUpdates } from "~/updater"
import { getMainWindowOrCreate } from "../window"
@@ -63,7 +63,13 @@ export const registerAppTray = () => {
},
],
},
{ label: t("menu.quit", { name }), click: () => app.quit() },
{
label: t("menu.quit", { name }),
click: () => {
logger.info("Quit app from tray")
app.quit()
},
},
])
tray.setContextMenu(contextMenu)
tray.setToolTip(app.getName())
+5
View File
@@ -14,5 +14,10 @@ export async function revealLogFile() {
}
app.on("before-quit", () => {
logger.info("App is quitting")
log.transports.console.level = false
})
app.on("will-quit", () => {
logger.info("App will quit")
})
+3 -2
View File
@@ -1,10 +1,11 @@
import { callWindowExpose } from "@follow/shared/bridge"
import { DEV } from "@follow/shared/constants"
import { dispatchEventOnWindow } from "@follow/shared/event"
import { name } from "@pkg"
import type { BrowserWindow, MenuItem, MenuItemConstructorOptions } from "electron"
import { Menu } from "electron"
import { isDev, isMacOS } from "./env"
import { isMacOS } from "./env"
import { clearAllDataAndConfirm } from "./lib/cleaner"
import { t } from "./lib/i18n"
import { revealLogFile } from "./logger"
@@ -202,7 +203,7 @@ export const registerAppMenu = () => {
},
]
if (isDev) {
if (DEV) {
menus.push({
label: t("menu.debug"),
submenu: [
+2 -2
View File
@@ -5,6 +5,7 @@ import { fileURLToPath } from "node:url"
import { getRendererHandlers } from "@egoist/tipc/main"
import { callWindowExpose } from "@follow/shared/bridge"
import { DEV } from "@follow/shared/constants"
import { env } from "@follow/shared/env.desktop"
import { app, BrowserWindow, clipboard, dialog, shell } from "electron"
@@ -17,7 +18,6 @@ import { registerAppTray } from "~/lib/tray"
import { logger, revealLogFile } from "~/logger"
import { cleanupOldRender, loadDynamicRenderEntry } from "~/updater/hot-updater"
import { isDev } from "../env"
import { downloadFile } from "../lib/download"
import { i18n } from "../lib/i18n"
import { cleanBetterAuthSessionCookie, cleanUser } from "../lib/user"
@@ -279,7 +279,7 @@ ${content}
for (const window of allWindows) {
if (window === mainWindow) {
if (isDev) {
if (DEV) {
logger.verbose("[rendererUpdateReload]: skip reload in dev")
break
}
+3 -3
View File
@@ -1,11 +1,11 @@
import { isDev } from "~/env"
import { DEV } from "@follow/shared/constants"
export const appUpdaterConfig = {
// Disable renderer hot update will trigger app update when available
enableRenderHotUpdate: !isDev,
enableRenderHotUpdate: !DEV,
enableCoreUpdate: !process.mas && !process.windowsStore,
// Disable app update will also disable renderer hot update and core update
enableAppUpdate: !isDev,
enableAppUpdate: !DEV,
app: {
autoCheckUpdate: true,
+4 -3
View File
@@ -1,10 +1,11 @@
import { getRendererHandlers } from "@egoist/tipc/main"
import { DEV } from "@follow/shared/constants"
import { autoUpdater as defaultAutoUpdater } from "electron-updater"
import { GITHUB_OWNER, GITHUB_REPO } from "~/constants/app"
import { canUpdateRender, CanUpdateRenderState, hotUpdateRender } from "~/updater/hot-updater"
import { channel, isDev, isWindows } from "../env"
import { channel, isWindows } from "../env"
import { logger } from "../logger"
import type { RendererHandlers } from "../renderer-handlers"
import { destroyMainWindow, getMainWindow } from "../window"
@@ -13,7 +14,7 @@ import { CustomGitHubProvider } from "./custom-github-provider"
import { WindowsUpdater } from "./windows-updater"
// skip auto update in dev mode
// const disabled = isDev
// const disabled = DEV
const disabled = !appUpdaterConfig.enableAppUpdate
const autoUpdater = isWindows ? new WindowsUpdater() : defaultAutoUpdater
@@ -151,7 +152,7 @@ export const registerUpdater = async () => {
autoUpdater.on("error", (e) => {
logger.error("Error while updating client", e)
})
autoUpdater.forceDevUpdateConfig = isDev
autoUpdater.forceDevUpdateConfig = DEV
setInterval(() => {
if (appUpdaterConfig.app.autoCheckUpdate) {
+3 -2
View File
@@ -4,12 +4,13 @@ import { fileURLToPath } from "node:url"
import { is } from "@electron-toolkit/utils"
import { APP_PROTOCOL } from "@follow/shared"
import { callWindowExpose, WindowState } from "@follow/shared/bridge"
import { DEV } from "@follow/shared/constants"
import type { BrowserWindowConstructorOptions } from "electron"
import { app, BrowserWindow, screen, shell } from "electron"
import type { Event } from "electron/main"
import { START_IN_TRAY_ARGS } from "./constants/app"
import { isDev, isMacOS, isWindows, isWindows11 } from "./env"
import { isMacOS, isWindows, isWindows11 } from "./env"
import { filePathToAppUrl, getIconPath } from "./helper"
import { t } from "./lib/i18n"
import { store } from "./lib/store"
@@ -46,7 +47,7 @@ export function createWindow(
preload: path.join(__dirname, "../preload/index.mjs"),
sandbox: false,
webviewTag: true,
webSecurity: !isDev,
webSecurity: !DEV,
nodeIntegration: true,
contextIsolation: false,
},
+1 -1
View File
@@ -13,7 +13,7 @@
"baseUrl": ".",
"paths": {
"@pkg": ["../../package.json"],
"@locales/*": ["../../locales/*"],
"@locales/*": ["../../../../locales/*"],
"~/*": ["./src/*"]
}
}
+13 -13
View File
@@ -33,12 +33,12 @@
"@radix-ui/react-popover": "1.1.6",
"@radix-ui/react-slider": "1.2.3",
"@radix-ui/react-slot": "1.1.2",
"@sentry/react": "9.9.0",
"@sentry/react": "9.10.1",
"@shikijs/transformers": "3.2.1",
"@tanstack/query-sync-storage-persister": "5.69.0",
"@tanstack/react-query": "5.69.0",
"@tanstack/react-query-devtools": "5.69.0",
"@tanstack/react-query-persist-client": "5.69.0",
"@tanstack/query-sync-storage-persister": "5.70.0",
"@tanstack/react-query": "5.70.0",
"@tanstack/react-query-devtools": "5.70.0",
"@tanstack/react-query-persist-client": "5.70.0",
"@tanstack/react-virtual": "3.13.5",
"@use-gesture/react": "10.3.1",
"@welldone-software/why-did-you-render": "10.0.1",
@@ -53,10 +53,10 @@
"dnum": "2.14.0",
"embla-carousel-react": "8.5.2",
"embla-carousel-wheel-gestures": "8.0.1",
"es-toolkit": "1.33.0",
"es-toolkit": "1.34.1",
"firebase": "11.5.0",
"foxact": "0.2.45",
"framer-motion": "12.5.0",
"framer-motion": "12.6.2",
"franc-min": "6.2.0",
"fuse.js": "7.1.0",
"hast-util-to-jsx-runtime": "2.3.6",
@@ -76,22 +76,22 @@
"re-resizable": "6.11.2",
"react-blurhash": "0.3.0",
"react-fast-marquee": "1.6.5",
"react-hook-form": "7.54.2",
"react-hook-form": "7.55.0",
"react-hotkeys-hook": "4.6.1",
"react-i18next": "15.4.1",
"react-intersection-observer": "9.16.0",
"react-ios-pwa-prompt": "2.0.6",
"react-qr-code": "2.0.15",
"react-resizable-layout": "npm:@innei/react-resizable-layout@0.7.3-fork.1",
"react-router": "7.4.0",
"react-router": "7.4.1",
"react-selecto": "1.26.3",
"react-shadow": "20.6.0",
"react-zoom-pan-pinch": "3.7.0",
"shiki": "3.2.1",
"sonner": "2.0.1",
"sonner": "2.0.2",
"tldts": "6.1.85",
"use-context-selector": "2.0.0",
"use-sync-external-store": "1.4.0",
"use-sync-external-store": "1.5.0",
"usehooks-ts": "3.1.1",
"zod": "3.24.2",
"zustand": "5.0.3"
@@ -105,8 +105,8 @@
"@follow/models": "workspace:*",
"@follow/types": "workspace:*",
"@follow/utils": "workspace:*",
"@types/node": "22.13.13",
"@vite-pwa/assets-generator": "0.2.6",
"@types/node": "22.13.14",
"@vite-pwa/assets-generator": "1.0.0",
"fake-indexeddb": "6.0.0",
"happy-dom": "17.4.4",
"react-scan": "0.3.3"
@@ -1,6 +1,6 @@
// This file is auto-generated by scripts/generate-i18n-locale.ts
// DONT EDIT THIS FILE MANUALLY
export const currentSupportedLanguages = [
const langs = [
"en",
"de",
"ja",
@@ -21,7 +21,10 @@ export const currentSupportedLanguages = [
"es",
"ko",
"tr",
]
] as const
export const currentSupportedLanguages = langs as readonly string[]
export type RendererSupportedLanguages = (typeof langs)[number]
export const dayjsLocaleImportMap = {
en: ["en", () => import("dayjs/locale/en")],
["zh-CN"]: ["zh-cn", () => import("dayjs/locale/zh-cn")],
@@ -44,5 +47,5 @@ export const dayjsLocaleImportMap = {
["ko"]: ["ko", () => import("dayjs/locale/ko")],
["tr"]: ["tr", () => import("dayjs/locale/tr")],
}
export const ns = ["app", "common", "lang", "settings", "shortcuts", "errors"] as const
export const ns = ["common", "lang", "errors", "app", "settings", "shortcuts"] as const
export const defaultNS = "app" as const
@@ -1,50 +1,52 @@
// This file is auto-generated by scripts/generate-i18n-locale.ts
// DONT EDIT THIS FILE MANUALLY
import en from "../../../../locales/app/en.json"
import common_ardz from "../../../../locales/common/ar-DZ.json"
import common_ariq from "../../../../locales/common/ar-IQ.json"
import common_arkw from "../../../../locales/common/ar-KW.json"
import common_arma from "../../../../locales/common/ar-MA.json"
import common_arsa from "../../../../locales/common/ar-SA.json"
import common_artn from "../../../../locales/common/ar-TN.json"
import common_de from "../../../../locales/common/de.json"
import common_en from "../../../../locales/common/en.json"
import common_es from "../../../../locales/common/es.json"
import common_fi from "../../../../locales/common/fi.json"
import common_fr from "../../../../locales/common/fr.json"
import common_it from "../../../../locales/common/it.json"
import common_ja from "../../../../locales/common/ja.json"
import common_ko from "../../../../locales/common/ko.json"
import common_pt from "../../../../locales/common/pt.json"
import common_ru from "../../../../locales/common/ru.json"
import common_tr from "../../../../locales/common/tr.json"
import common_zhCN from "../../../../locales/common/zh-CN.json"
import common_zhHK from "../../../../locales/common/zh-HK.json"
import common_zhTW from "../../../../locales/common/zh-TW.json"
import errors_en from "../../../../locales/errors/en.json"
import external_en from "../../../../locales/external/en.json"
import lang_ardz from "../../../../locales/lang/ar-DZ.json"
import lang_ariq from "../../../../locales/lang/ar-IQ.json"
import lang_arkw from "../../../../locales/lang/ar-KW.json"
import lang_arma from "../../../../locales/lang/ar-MA.json"
import lang_arsa from "../../../../locales/lang/ar-SA.json"
import lang_artn from "../../../../locales/lang/ar-TN.json"
import lang_de from "../../../../locales/lang/de.json"
import lang_en from "../../../../locales/lang/en.json"
import lang_es from "../../../../locales/lang/es.json"
import lang_fi from "../../../../locales/lang/fi.json"
import lang_fr from "../../../../locales/lang/fr.json"
import lang_it from "../../../../locales/lang/it.json"
import lang_ja from "../../../../locales/lang/ja.json"
import lang_ko from "../../../../locales/lang/ko.json"
import lang_pt from "../../../../locales/lang/pt.json"
import lang_ru from "../../../../locales/lang/ru.json"
import lang_tr from "../../../../locales/lang/tr.json"
import lang_zhCN from "../../../../locales/lang/zh-CN.json"
import lang_zhHK from "../../../../locales/lang/zh-HK.json"
import lang_zhTW from "../../../../locales/lang/zh-TW.json"
import settings_en from "../../../../locales/settings/en.json"
import shortcuts_en from "../../../../locales/shortcuts/en.json"
import en from "@locales/app/en.json"
import common_ardz from "@locales/common/ar-DZ.json"
import common_ariq from "@locales/common/ar-IQ.json"
import common_arkw from "@locales/common/ar-KW.json"
import common_arma from "@locales/common/ar-MA.json"
import common_arsa from "@locales/common/ar-SA.json"
import common_artn from "@locales/common/ar-TN.json"
import common_de from "@locales/common/de.json"
import common_en from "@locales/common/en.json"
import common_es from "@locales/common/es.json"
import common_fi from "@locales/common/fi.json"
import common_fr from "@locales/common/fr.json"
import common_it from "@locales/common/it.json"
import common_ja from "@locales/common/ja.json"
import common_ko from "@locales/common/ko.json"
import common_pt from "@locales/common/pt.json"
import common_ru from "@locales/common/ru.json"
import common_tr from "@locales/common/tr.json"
import common_zhCN from "@locales/common/zh-CN.json"
import common_zhHK from "@locales/common/zh-HK.json"
import common_zhTW from "@locales/common/zh-TW.json"
import errors_en from "@locales/errors/en.json"
import lang_ardz from "@locales/lang/ar-DZ.json"
import lang_ariq from "@locales/lang/ar-IQ.json"
import lang_arkw from "@locales/lang/ar-KW.json"
import lang_arma from "@locales/lang/ar-MA.json"
import lang_arsa from "@locales/lang/ar-SA.json"
import lang_artn from "@locales/lang/ar-TN.json"
import lang_de from "@locales/lang/de.json"
import lang_en from "@locales/lang/en.json"
import lang_es from "@locales/lang/es.json"
import lang_fi from "@locales/lang/fi.json"
import lang_fr from "@locales/lang/fr.json"
import lang_it from "@locales/lang/it.json"
import lang_ja from "@locales/lang/ja.json"
import lang_ko from "@locales/lang/ko.json"
import lang_pt from "@locales/lang/pt.json"
import lang_ru from "@locales/lang/ru.json"
import lang_tr from "@locales/lang/tr.json"
import lang_zhCN from "@locales/lang/zh-CN.json"
import lang_zhHK from "@locales/lang/zh-HK.json"
import lang_zhTW from "@locales/lang/zh-TW.json"
import settings_en from "@locales/settings/en.json"
import shortcuts_en from "@locales/shortcuts/en.json"
import type { ns, RendererSupportedLanguages } from "./constants"
/**
* This file is the language resource that is loaded in full when the app is initialized.
* When switching languages, the app will automatically download the required language resources,
@@ -57,7 +59,6 @@ export const defaultResources = {
app: en,
lang: lang_en,
common: common_en,
external: external_en,
settings: settings_en,
shortcuts: shortcuts_en,
errors: errors_en,
@@ -91,4 +92,7 @@ export const defaultResources = {
de: { lang: lang_de, common: common_de },
ko: { lang: lang_ko, common: common_ko },
tr: { lang: lang_tr, common: common_tr },
}
} satisfies Record<
RendererSupportedLanguages,
Partial<Record<(typeof ns)[number], Record<string, string>>>
>
@@ -1,11 +1,11 @@
import { Logo } from "@follow/components/icons/logo.jsx"
import { Button } from "@follow/components/ui/button/index.js"
import { ELECTRON_BUILD } from "@follow/shared/constants"
import { captureException } from "@sentry/react"
import { useEffect } from "react"
import type { Location } from "react-router"
import { Navigate, useLocation, useNavigate } from "react-router"
import { isElectronBuild } from "~/constants"
import { removeAppSkeleton } from "~/lib/app"
import { PoweredByFooter } from "./PoweredByFooter"
@@ -27,7 +27,7 @@ class AccessNotFoundError extends Error {
export const NotFound = () => {
const location = useLocation()
useEffect(() => {
if (!isElectronBuild) {
if (!ELECTRON_BUILD) {
return
}
captureException(
@@ -1,4 +1,5 @@
import { useIsDark } from "@follow/hooks"
import { ELECTRON_BUILD } from "@follow/shared/constants"
import { cn } from "@follow/utils/utils"
import { useIsomorphicLayoutEffect } from "foxact/use-isomorphic-layout-effect"
import type { FC } from "react"
@@ -11,7 +12,6 @@ import type {
} from "shiki"
import { useUISettingKey, useUISettingSelector } from "~/atoms/settings/ui"
import { isElectronBuild } from "~/constants"
import { tipcClient } from "~/lib/client"
import { CopyButton } from "../../button/CopyButton"
@@ -42,7 +42,7 @@ export const ShikiHighLighter: FC<ShikiProps> = (props) => {
const guessCodeLanguage = useUISettingKey("guessCodeLanguage")
useInsertionEffect(() => {
if (!guessCodeLanguage) return
if (language || !isElectronBuild) return
if (language || !ELECTRON_BUILD) return
if (!bundledLanguagesKeysSet) {
import("shiki/langs")
@@ -445,7 +445,9 @@ const FallbackableImage: FC<
width={props.width}
{...props}
className={cn(
"mx-auto transition-opacity duration-700",
// See https://github.com/BetterTyped/react-zoom-pan-pinch/issues/135#issuecomment-683463453
// See also https://github.com/RSSNext/Folo/issues/3183
"!pointer-events-auto mx-auto transition-opacity duration-700",
isLoading ? "opacity-0" : "opacity-100",
props.className,
)}
@@ -456,7 +458,7 @@ const FallbackableImage: FC<
/>
<div
className={cn(
"center absolute inset-0 size-full transition-opacity duration-700",
"center pointer-events-none absolute inset-0 size-full transition-opacity duration-700",
isLoading ? "opacity-100" : "opacity-0",
)}
>
@@ -18,9 +18,9 @@ export const FixedModalCloseButton: Component<{
onClick={onClick}
>
<i className="i-mgc-close-cute-re text-lg" />
<span className="sr-only">{t("close")}</span>
<span className="sr-only">{t("words.close")}</span>
</TooltipTrigger>
<TooltipContent>{t("close")}</TooltipContent>
<TooltipContent>{t("words.close")}</TooltipContent>
</Tooltip>
)
}
@@ -90,7 +90,7 @@ export function AsyncModalContent<T>({
<i className="i-mgc-close-cute-re" />
</Button>
</TooltipTrigger>
<TooltipContent>{t("close")}</TooltipContent>
<TooltipContent>{t("words.close")}</TooltipContent>
</Tooltip>
)}
</m.div>
@@ -9,7 +9,7 @@ export const ModalClose = () => {
return (
<MotionButtonBase
aria-label={t("close")}
aria-label={t("words.close")}
className="hover:bg-theme-button-hover absolute right-6 top-6 flex size-8 items-center justify-center rounded-md duration-200"
onClick={dismiss}
>
@@ -186,7 +186,7 @@ export const useDialog = (): DialogInstance => {
dismiss()
}}
>
{options.cancelText ?? t("cancel", { ns: "common" })}
{options.cancelText ?? t("words.cancel", { ns: "common" })}
</Button>
<Button
onClick={() => {
@@ -195,7 +195,7 @@ export const useDialog = (): DialogInstance => {
dismiss()
}}
>
{options.confirmText ?? t("confirm", { ns: "common" })}
{options.confirmText ?? t("words.confirm", { ns: "common" })}
</Button>
</div>
</div>
@@ -3,6 +3,7 @@ import { RootPortalProvider } from "@follow/components/ui/portal/provider.js"
import { EllipsisHorizontalTextWithTooltip } from "@follow/components/ui/typography/index.js"
import { ZIndexProvider } from "@follow/components/ui/z-index/index.js"
import { useRefValue } from "@follow/hooks"
import { ELECTRON_BUILD } from "@follow/shared/constants"
import { nextFrame, preventDefault, stopPropagation } from "@follow/utils/dom"
import { cn, getOS } from "@follow/utils/utils"
import * as Dialog from "@radix-ui/react-dialog"
@@ -31,7 +32,7 @@ import { AppErrorBoundary } from "~/components/common/AppErrorBoundary"
import { SafeFragment } from "~/components/common/Fragment"
import { m } from "~/components/common/Motion"
import { ErrorComponentType } from "~/components/errors/enum"
import { ElECTRON_CUSTOM_TITLEBAR_HEIGHT, isElectronBuild } from "~/constants"
import { ElECTRON_CUSTOM_TITLEBAR_HEIGHT } from "~/constants"
import { useSwitchHotKeyScope } from "~/hooks/common"
import { modalStackAtom } from "./atom"
@@ -45,7 +46,7 @@ import { useModalSubscriber } from "./internal/use-subscriber"
import { ModalOverlay } from "./overlay"
import type { ModalOverlayOptions, ModalProps } from "./types"
const DragBar = isElectronBuild ? (
const DragBar = ELECTRON_BUILD ? (
<span className="drag-region fixed left-0 right-36 top-0 h-8" />
) : null
export const ModalInternal = memo(
@@ -374,7 +375,7 @@ export const ModalInternal = memo(
</Dialog.Title>
{canClose && (
<Dialog.DialogClose
className="center z-[1] p-2"
className="center hover:bg-theme-button-hover z-[2] rounded-lg p-2"
tabIndex={1}
onClick={close}
>
@@ -1,5 +0,0 @@
export const isElectronBuild = ELECTRON
export const isWebBuild = !ELECTRON
export const isDev = import.meta.env.DEV
export const isProd = import.meta.env.PROD
@@ -1,5 +1,4 @@
export * from "./app"
export * from "./copy"
export * from "./environment"
export * from "./hotkeys"
export * from "./ui"
@@ -4,7 +4,7 @@ import { useCallback } from "react"
import { tipcClient } from "~/lib/client"
const minimizeToTrayAtom = atom<boolean>(false)
const minimizeToTrayAtom = atom<boolean>(true)
minimizeToTrayAtom.onMount = (setAtom) => {
tipcClient?.getMinimizeToTray().then((proxy: boolean) => {
+2 -2
View File
@@ -1,3 +1,4 @@
import { DEV } from "@follow/shared/constants"
import { Chain } from "@follow/utils/chain"
import { EventBus } from "@follow/utils/event-bus"
import { getStorageNS } from "@follow/utils/ns"
@@ -8,7 +9,6 @@ import { initReactI18next } from "react-i18next"
import { defaultNS, ns } from "./@types/constants"
import { defaultResources } from "./@types/default-resource"
import { getGeneralSettings } from "./atoms/settings/general"
import { isDev } from "./constants"
import { jotaiStore } from "./lib/jotai"
export const i18nAtom = atom(i18next)
@@ -48,7 +48,7 @@ export const initI18n = async () => {
}
let cache = null as any
if (!isDev) {
if (!DEV) {
cache = LocaleCache.shared.get(lang)
if (cache) {
mergedResources[lang] = cache
@@ -1,11 +1,10 @@
import { initializeDayjs } from "@follow/components/dayjs"
import { registerGlobalContext } from "@follow/shared/bridge"
import { IN_ELECTRON } from "@follow/shared/constants"
import { DEV, ELECTRON_BUILD, IN_ELECTRON } from "@follow/shared/constants"
import { tracker } from "@follow/tracker"
import { repository } from "@pkg"
import { enableMapSet } from "immer"
import { isDev, isElectronBuild } from "~/constants"
import { browserDB } from "~/database"
import { initI18n } from "~/i18n"
import { settingSyncQueue } from "~/modules/settings/helper/sync-queue"
@@ -45,7 +44,7 @@ declare global {
export const initializeApp = async () => {
appLog(`${APP_NAME}: Follow everything in one place`, repository.url)
if (isDev) {
if (DEV) {
const favicon = await import("/favicon-dev.ico?url")
const url = new URL(favicon.default, import.meta.url).href
@@ -70,7 +69,7 @@ export const initializeApp = async () => {
registerHistoryStack()
// Set Environment
document.documentElement.dataset.buildType = isElectronBuild ? "electron" : "web"
document.documentElement.dataset.buildType = ELECTRON_BUILD ? "electron" : "web"
// Register global context for electron
registerGlobalContext({
@@ -1,3 +1,4 @@
import { ELECTRON_BUILD } from "@follow/shared/constants"
import { env } from "@follow/shared/env.desktop"
import { appSessionTraceId } from "@follow/utils/environment"
import { version } from "@pkg"
@@ -6,7 +7,6 @@ import { useEffect } from "react"
import { createRoutesFromChildren, matchRoutes, useLocation, useNavigationType } from "react-router"
import { whoami } from "~/atoms/user"
import { isElectronBuild } from "~/constants"
import { SentryConfig } from "./sentry.config"
@@ -50,5 +50,5 @@ export const initSentry = async () => {
Sentry.setTag("session_trace_id", appSessionTraceId)
Sentry.setTag("app_version", version)
Sentry.setTag("build", isElectronBuild ? "electron" : "web")
Sentry.setTag("build", ELECTRON_BUILD ? "electron" : "web")
}
@@ -1,3 +1,4 @@
import { DEV } from "@follow/shared/constants"
import { env } from "@follow/shared/env.desktop"
import type { AppType } from "@follow/shared/hono"
import PKG from "@pkg"
@@ -8,7 +9,6 @@ import { toast } from "sonner"
import { NetworkStatus, setApiStatus } from "~/atoms/network"
import { setLoginModalShow } from "~/atoms/user"
import { isDev } from "~/constants"
import { NeedActivationToast } from "~/modules/activation/NeedActivationToast"
import { DebugRegistry } from "~/modules/debug/registry"
@@ -22,7 +22,7 @@ export const apiFetch = ofetch.create({
const header = new Headers(options.headers)
header.set("x-app-version", PKG.version)
if (isDev) {
if (DEV) {
header.set("X-App-Dev", "1")
}
header.set("X-App-Name", "Folo Web")
@@ -95,7 +95,7 @@ export const apiClient = hc<AppType>(env.VITE_API_URL, {
},
})
if (isDev) {
if (DEV) {
DebugRegistry.add("Activation Toast", () => {
setTimeout(() => {
const toastId = toast.error(
@@ -1,3 +1,4 @@
import { DEV } from "@follow/shared/constants"
import { cn } from "@follow/utils/utils"
import { t } from "i18next"
import { FetchError } from "ofetch"
@@ -7,7 +8,6 @@ import { toast } from "sonner"
import { CopyButton } from "~/components/ui/button/CopyButton"
import { Markdown } from "~/components/ui/markdown/Markdown"
import { isDev } from "~/constants"
import { DebugRegistry } from "~/modules/debug/registry"
export const getFetchErrorInfo = (
@@ -120,7 +120,7 @@ export const toastFetchError = (
})
}
}
if (isDev) {
if (DEV) {
DebugRegistry.add("Simulate request error", () => {
createErrorToaster(
"Simulated request error",
@@ -1,10 +1,9 @@
import { WEB_BUILD } from "@follow/shared/constants"
import { replaceImgUrlIfNeed as replaceImgUrlIfNeedUtils } from "@follow/utils/img-proxy"
import { isWebBuild } from "~/constants"
export const replaceImgUrlIfNeed = (url?: string) => {
return replaceImgUrlIfNeedUtils({
url,
inBrowser: isWebBuild,
inBrowser: WEB_BUILD,
})
}
@@ -52,7 +52,7 @@ export const loadLanguageAndApply = async (lang: string) => {
const res = await Promise.allSettled(
namespaces.map(async (ns) => {
const loader = nsGlobbyMap[`../../locales/${ns}/${lang}.json`]
const loader = nsGlobbyMap[`../../../../locales/${ns}/${lang}.json`]
if (!loader) return
const nsResources = await loader().then((m: any) => m.default)
+13 -9
View File
@@ -1,13 +1,17 @@
import { parseHtml } from "@follow/components/ui/markdown/parse-html.js"
import { views } from "@follow/constants"
import type { SupportedLanguages } from "@follow/models/types"
import { LANGUAGE_MAP } from "@follow/shared"
import { ACTION_LANGUAGE_MAP } from "@follow/shared"
import { franc } from "franc-min"
import type { FlatEntryModel } from "~/store/entry"
import { apiClient } from "./api-fetch"
function duplicateIfLengthLessThan(text: string, length: number) {
return text.length < length ? text.repeat(Math.ceil(length / text.length)) : text
}
export const checkLanguage = ({
content,
language,
@@ -19,16 +23,16 @@ export const checkLanguage = ({
const pureContent = parseHtml(content)
.toText()
.replaceAll(/https?:\/\/\S+|www\.\S+/g, " ")
const { code } = LANGUAGE_MAP[language]
if (!code) return false
const sourceLanguage = franc(pureContent, {
only: [code],
})
if (sourceLanguage === code) {
return true
} else {
const { code } = ACTION_LANGUAGE_MAP[language]
if (!code) {
return false
}
const sourceLanguage = franc(duplicateIfLengthLessThan(pureContent, 20), {
only: [code],
})
return sourceLanguage === code
}
export async function translate({
+3 -3
View File
@@ -2,7 +2,7 @@ import "./wdyr"
import "@follow/components/tailwind"
import "./styles/main.css"
import { IN_ELECTRON } from "@follow/shared/constants"
import { IN_ELECTRON, WEB_BUILD } from "@follow/shared/constants"
import { getOS } from "@follow/utils/utils"
import { ClickToComponent } from "click-to-react-component"
import * as React from "react"
@@ -10,14 +10,14 @@ import ReactDOM from "react-dom/client"
import { RouterProvider } from "react-router/dom"
import { setAppIsReady } from "./atoms/app"
import { ElECTRON_CUSTOM_TITLEBAR_HEIGHT, isWebBuild } from "./constants"
import { ElECTRON_CUSTOM_TITLEBAR_HEIGHT } from "./constants"
import { initializeApp } from "./initialize"
import { registerAppGlobalShortcuts } from "./initialize/global-shortcuts"
import { router } from "./router"
initializeApp().finally(() => {
import("./push-notification").then(({ registerWebPushNotifications }) => {
if (navigator.serviceWorker && isWebBuild) {
if (navigator.serviceWorker && WEB_BUILD) {
registerWebPushNotifications()
}
})
@@ -65,17 +65,15 @@ function ActionSettingOperations() {
<i className="i-mgc-add-cute-re mr-1" />
<span>{t("actions.newRule")}</span>
</Button>
{actionLength > 0 && (
<Button
variant="primary"
disabled={!isDirty}
isLoading={mutation.isPending}
onClick={() => mutation.mutate()}
>
<i className="i-mgc-check-circle-cute-re mr-1" />
{t("actions.save")}
</Button>
)}
<Button
variant="primary"
disabled={!isDirty}
isLoading={mutation.isPending}
onClick={() => mutation.mutate()}
>
<i className="i-mgc-check-circle-cute-re mr-1" />
{t("actions.save")}
</Button>
</div>
)
}
@@ -1,9 +1,8 @@
import { useMobile } from "@follow/components/hooks/useMobile.js"
import { WEB_BUILD } from "@follow/shared/constants"
import { repository } from "@pkg"
import { useTranslation } from "react-i18next"
import { isWebBuild } from "~/constants"
export const FooterInfo = () => {
const { t } = useTranslation()
@@ -16,7 +15,7 @@ export const FooterInfo = () => {
</div>
)}
{isWebBuild && !isMobile && (
{WEB_BUILD && !isMobile && (
<div className="center absolute inset-y-0 right-2">
<button
type="button"
@@ -4,7 +4,7 @@ import { PanelSplitter } from "@follow/components/ui/divider/index.js"
import { Kbd } from "@follow/components/ui/kbd/Kbd.js"
import { RootPortal } from "@follow/components/ui/portal/index.jsx"
import type { FeedViewType } from "@follow/constants"
import { IN_ELECTRON } from "@follow/shared/constants"
import { DEV, IN_ELECTRON, PROD } from "@follow/shared/constants"
import { preventDefault } from "@follow/utils/dom"
import { cn } from "@follow/utils/utils"
import { Slot } from "@radix-ui/react-slot"
@@ -31,7 +31,7 @@ import { AppErrorBoundary } from "~/components/common/AppErrorBoundary"
import { ErrorComponentType } from "~/components/errors/enum"
import { PlainModal } from "~/components/ui/modal/stacked/custom-modal"
import { DeclarativeModal } from "~/components/ui/modal/stacked/declarative-modal"
import { HotKeyScopeMap, isDev } from "~/constants"
import { HotKeyScopeMap } from "~/constants"
import { ROOT_CONTAINER_ID } from "~/constants/dom"
import { shortcuts } from "~/constants/shortcuts"
import { useDailyTask } from "~/hooks/biz/useDailyTask"
@@ -97,7 +97,7 @@ export function MainDestopLayout() {
return (
<RootContainer ref={containerRef}>
{!import.meta.env.PROD && <EnvironmentIndicator />}
{!PROD && <EnvironmentIndicator />}
<Suspense>
<AppNotificationContainer />
@@ -332,7 +332,7 @@ const FeedResponsiveResizerContainer = ({
)
}
if (isDev) {
if (DEV) {
DebugRegistry.add("New User Guide", () => {
import("~/modules/new-user-guide/guide-modal-content").then((m) => {
window.presentModal({
@@ -2,6 +2,7 @@ import { getReadonlyRoute } from "@follow/components/atoms/route.js"
import { MotionButtonBase } from "@follow/components/ui/button/index.js"
import { ScrollArea } from "@follow/components/ui/scroll-area/index.js"
import { Routes } from "@follow/constants"
import { ELECTRON_BUILD } from "@follow/shared/constants"
import { springScrollTo } from "@follow/utils/scroller"
import { cn, getOS } from "@follow/utils/utils"
import { useEffect, useRef, useState } from "react"
@@ -9,7 +10,6 @@ import { useTranslation } from "react-i18next"
import { NavigationType, Outlet, useLocation, useNavigate, useNavigationType } from "react-router"
import { FABContainer, FABPortable } from "~/components/ui/fab"
import { isElectronBuild } from "~/constants"
import { useSubViewTitleValue } from "./hooks"
@@ -51,7 +51,7 @@ export function SubviewLayout() {
const { t } = useTranslation()
// electron window has pt-[calc(var(--fo-window-padding-top)_-10px)]
const isElectronWindows = isElectronBuild && getOS() === "Windows"
const isElectronWindows = ELECTRON_BUILD && getOS() === "Windows"
return (
<div className="relative flex size-full">
@@ -5,11 +5,11 @@ import {
TooltipPortal,
TooltipTrigger,
} from "@follow/components/ui/tooltip/index.jsx"
import { DEV, MODE } from "@follow/shared/constants"
import { env } from "@follow/shared/env.desktop"
import { useUserRole } from "~/atoms/user"
import { useModalStack } from "~/components/ui/modal/stacked/hooks"
import { isDev } from "~/constants"
import { DebugRegistry } from "../debug/registry"
@@ -24,7 +24,7 @@ export const EnvironmentIndicator = () => {
aria-hidden
type="button"
onClick={() => {
if (!isDev) return
if (!DEV) return
const actionMap = DebugRegistry.getAll()
@@ -51,8 +51,8 @@ export const EnvironmentIndicator = () => {
}}
>
<div className="center bg-accent fixed bottom-0 right-0 z-[99999] flex rounded-tl px-1 py-0.5 text-xs text-white">
{role}:{isDev && <i className="i-mgc-bug-cute-re size-3" />}
{import.meta.env.MODE}
{role}:{DEV && <i className="i-mgc-bug-cute-re size-3" />}
{MODE}
</div>
</button>
</TooltipTrigger>
@@ -88,7 +88,7 @@ export const BoostModalContent = ({ feedId }: { feedId: string }) => {
{t("boost.boost_success_thanks")}
</m.p>
<Button variant="primary" onClick={() => dismiss()}>
{t.common("close")}
{t.common("words.close")}
</Button>
</>
) : (
@@ -188,10 +188,6 @@ export const useRegisterEntryCommands = () => {
}
window.print()
toast(t("entry_actions.exported_notify"), {
duration: 1000,
})
},
},
{
@@ -229,7 +225,7 @@ export const useRegisterEntryCommands = () => {
{
id: COMMAND_ID.entry.viewSourceContent,
label: t("entry_actions.view_source_content"),
icon: <i className="i-mgc-world-2-cute-re" />,
icon: <i className="i-mgc-web-cute-re" />,
run: ({ entryId }) => {
if (!getShowSourceContent()) {
const entry = useEntryStore.getState().flatMapEntries[entryId]
@@ -377,7 +377,7 @@ const FeedInnerForm = ({
dismiss()
}}
>
{t.common("cancel")}
{t.common("words.cancel")}
</Button>
)}
<Button ref={buttonRef} type="submit" isLoading={followMutation.isPending}>
@@ -284,7 +284,7 @@ const SearchCard: FC<{
onUnSubscribed?: (item: DiscoverSearchData[number]) => void
}> = memo(({ item, onSuccess }) => {
const follow = useFollow()
const { t } = useTranslation("external")
const { t } = useTranslation()
return (
<Card data-feed-id={item.feed?.id || item.list?.id} className="select-text">
@@ -333,7 +333,7 @@ const ListInnerForm = ({
dismiss()
}}
>
{t.common("cancel")}
{t.common("words.cancel")}
</Button>
)}
<Button ref={buttonRef} type="submit" isLoading={followMutation.isPending}>
@@ -39,7 +39,7 @@ export const RecommendationCard: FC<RecommendationCardProps> = memo(
categories.delete("popular")
return {
maintainers: Array.from(maintainers),
categories: Array.from(categories) as typeof RSSHubCategories | string[],
categories: Array.from(categories) as unknown as typeof RSSHubCategories,
}
}, [data])
@@ -146,7 +146,7 @@ export const RecommendationCard: FC<RecommendationCardProps> = memo(
)}
>
{RSSHubCategories.includes(c)
? t(`discover.category.${c as (typeof RSSHubCategories)[number]}`)
? t(`discover.category.${c}`, { ns: "common" })
: upperFirst(c)}
</button>
))}
@@ -176,7 +176,7 @@ export function Recommendations({
<TabsList>
{RSSHubCategories.map((category) => (
<TabsTrigger data-value={category} key={category} value={category}>
{t(`discover.category.${category}`)}
{t(`discover.category.${category}`, { ns: "common" })}
</TabsTrigger>
))}
</TabsList>
@@ -0,0 +1,44 @@
import { FeedViewType, views } from "@follow/constants"
import { FlatMarkAllReadButton } from "./mark-all-button"
export const FooterMarkItem = ({ view }: { view: FeedViewType }) => {
if (view === FeedViewType.SocialMedia) {
return <SocialMediaFooterMarkItem />
} else if (views[view]!.gridMode) {
return <GridFooterMarkItem />
}
return <CommonFooterMarkItem />
}
const SocialMediaFooterMarkItem = () => {
return (
<FlatMarkAllReadButton
className="justify-start"
buttonClassName="w-[645px] mx-auto mb-4 pl-7 py-4"
iconClassName="mr-1 text-lg"
which="above"
/>
)
}
const GridFooterMarkItem = () => {
return (
<FlatMarkAllReadButton
buttonClassName="w-full py-4"
iconClassName="mr-1 text-base"
which="above"
/>
)
}
const CommonFooterMarkItem = () => {
return (
<FlatMarkAllReadButton
className="justify-start"
buttonClassName="w-full rounded-none px-6 py-4"
iconClassName="mr-1 text-base"
which="above"
/>
)
}
@@ -3,6 +3,7 @@ import { ActionButton, Button, IconButton } from "@follow/components/ui/button/i
import { Kbd, KbdCombined } from "@follow/components/ui/kbd/Kbd.js"
import { RootPortal } from "@follow/components/ui/portal/index.jsx"
import { useCountdown } from "@follow/hooks"
import { ELECTRON_BUILD } from "@follow/shared/constants"
import { cn, getOS } from "@follow/utils/utils"
import { AnimatePresence, m } from "framer-motion"
import type { FC, ReactNode } from "react"
@@ -12,7 +13,7 @@ import { Trans, useTranslation } from "react-i18next"
import { toast } from "sonner"
import { useOnClickOutside } from "usehooks-ts"
import { HotKeyScopeMap, isElectronBuild } from "~/constants"
import { HotKeyScopeMap } from "~/constants"
import { shortcuts } from "~/constants/shortcuts"
import { useI18n } from "~/hooks/common"
@@ -20,7 +21,6 @@ import type { MarkAllFilter } from "../hooks/useMarkAll"
import { useMarkAllByRoute } from "../hooks/useMarkAll"
interface MarkAllButtonProps {
filter?: MarkAllFilter
className?: string
which?: ReactNode
shortcut?: boolean
@@ -31,13 +31,13 @@ export const MarkAllReadWithOverlay = forwardRef<
MarkAllButtonProps & {
containerRef: React.RefObject<HTMLDivElement>
}
>(({ filter, className, which = "all", shortcut, containerRef }, ref) => {
>(({ className, which = "all", shortcut, containerRef }, ref) => {
const { t } = useTranslation()
const { t: commonT } = useTranslation("common")
const [show, setShow] = useState(false)
const handleMarkAllAsRead = useMarkAllByRoute(filter)
const handleMarkAllAsRead = useMarkAllByRoute()
const [popoverRef, setPopoverRef] = useState<HTMLDivElement | null>(null)
useOnClickOutside({ current: popoverRef }, () => {
@@ -136,7 +136,7 @@ const Popup = ({ which, containerRef, setPopoverRef, setShow, handleMarkAllAsRea
useViewport((v) => v.w)
// electron window has pt-[calc(var(--fo-window-padding-top)_-10px)]
const isElectronWindows = isElectronBuild && getOS() === "Windows"
const isElectronWindows = ELECTRON_BUILD && getOS() === "Windows"
return (
<RootPortal to={$parent}>
<m.div
@@ -206,10 +206,17 @@ const ConfirmMarkAllReadInfo = ({ undo }: { undo: () => any }) => {
)
}
export const FlatMarkAllReadButton: FC<MarkAllButtonProps> = (props) => {
export const FlatMarkAllReadButton: FC<
MarkAllButtonProps & {
filter?: MarkAllFilter
buttonClassName?: string
iconClassName?: string
text?: string
}
> = (props) => {
const t = useI18n()
const { className, filter, which } = props
const { className, filter, which, buttonClassName, iconClassName } = props
const [status, setStatus] = useState<"initial" | "confirm" | "done">("initial")
const handleMarkAll = useMarkAllByRoute(filter)
@@ -222,6 +229,7 @@ export const FlatMarkAllReadButton: FC<MarkAllButtonProps> = (props) => {
<Button
variant="ghost"
disabled={status === "done"}
buttonClassName={buttonClassName}
className={cn(
"center relative flex h-auto gap-1",
@@ -245,9 +253,9 @@ export const FlatMarkAllReadButton: FC<MarkAllButtonProps> = (props) => {
>
<AnimatePresence mode="wait">
{status === "confirm" ? (
<m.i key={1} {...animate} className="i-mgc-question-cute-re" />
<m.i key={1} {...animate} className={cn("i-mgc-question-cute-re", iconClassName)} />
) : (
<m.i key={2} {...animate} className="i-mgc-check-circle-cute-re" />
<m.i key={2} {...animate} className={cn("i-mgc-check-circle-cute-re", iconClassName)} />
)}
</AnimatePresence>
<span className={cn(status === "confirm" ? "opacity-0" : "opacity-100", "duration-200")}>
@@ -17,6 +17,7 @@ import { entryActions, useEntry } from "~/store/entry"
import { useFeedById, useFeedHeaderTitle } from "~/store/feed"
import { useSubscriptionByFeedId } from "~/store/subscription"
import { FooterMarkItem } from "./components/FooterMarkItem"
import { EntryColumnGrid } from "./grid"
import { useEntriesByView } from "./hooks/useEntriesByView"
import { useSnapEntryIdList } from "./hooks/useEntryIdListSnap"
@@ -161,6 +162,7 @@ function EntryColumnImpl() {
fetchNextPage={fetchNextPage}
refetch={entries.refetch}
groupCounts={groupedCounts}
Footer={<FooterMarkItem view={view} />}
/>
)}
</EntryColumnWrapper>
@@ -246,7 +246,7 @@ function AudioCover({
}: {
entryId: string
src: string
durationInSeconds?: number
durationInSeconds?: number | string
feedIcon: React.ReactNode
}) {
const isMobile = useMobile()
@@ -254,13 +254,8 @@ function AudioCover({
playerValue.src === src && playerValue.show ? playerValue.status : false,
)
// durationInSeconds's format like 00:00:00 or 4000
if (durationInSeconds && Number.isNaN(+durationInSeconds)) {
// @ts-expect-error durationInSeconds is string
durationInSeconds = formatTimeToSeconds(durationInSeconds)
}
const estimatedMins = durationInSeconds && Math.floor(durationInSeconds / 60)
const seconds = formatTimeToSeconds(durationInSeconds)
const estimatedMins = seconds && Math.floor(seconds / 60)
const handleClickPlay = (e: React.MouseEvent<HTMLDivElement>) => {
if (isMobile) e.stopPropagation()
@@ -38,7 +38,12 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
const href = entry?.entries.url
if (!href) return "#"
if (href.startsWith("http")) return href
if (href.startsWith("http")) {
const domain = new URL(href).hostname
if (domain === "localhost") return "#"
return href
}
const feedSiteUrl = feed?.type === "feed" ? feed.siteUrl : null
if (href.startsWith("/") && feedSiteUrl) return safeUrl(href, feedSiteUrl)
return href
@@ -63,11 +68,9 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
return
}
let durationInSeconds = audioAttachment.duration_in_seconds
if (Number.isNaN(+durationInSeconds)) {
// @ts-expect-error durationInSeconds is string
durationInSeconds = formatTimeToSeconds(durationInSeconds)
const durationInSeconds = formatTimeToSeconds(audioAttachment.duration_in_seconds)
if (!durationInSeconds) {
return
}
return formatEstimatedMins(Math.floor(durationInSeconds / 60))
@@ -5,7 +5,7 @@ import { Button, MotionButtonBase } from "@follow/components/ui/button/index.js"
import { LoadingWithIcon } from "@follow/components/ui/loading/index.jsx"
import { RootPortal } from "@follow/components/ui/portal/index.jsx"
import { useScrollViewElement } from "@follow/components/ui/scroll-area/hooks.js"
import { IN_ELECTRON } from "@follow/shared/constants"
import { IN_ELECTRON, WEB_BUILD } from "@follow/shared/constants"
import { EventBus } from "@follow/utils/event-bus"
import { springScrollTo } from "@follow/utils/scroller"
import { cn } from "@follow/utils/utils"
@@ -25,7 +25,6 @@ import { useActionLanguage } from "~/atoms/settings/general"
import { enableShowSourceContent } from "~/atoms/source-content"
import { CopyButton } from "~/components/ui/button/CopyButton"
import { Toc } from "~/components/ui/markdown/components/Toc"
import { isWebBuild } from "~/constants"
import { useEntryReadabilityToggle } from "~/hooks/biz/useEntryActions"
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
import { useAuthQuery } from "~/hooks/common/useBizQuery"
@@ -138,10 +137,10 @@ export const NoContent: FC<{
return (
<div className="center">
<div className="space-y-2 text-balance text-center text-sm text-zinc-400">
{(isWebBuild || status === ReadabilityStatus.FAILURE) && (
{(WEB_BUILD || status === ReadabilityStatus.FAILURE) && (
<span>{t("entry_content.no_content")}</span>
)}
{isWebBuild && (
{WEB_BUILD && (
<div>
<span>{t("entry_content.web_app_notice")}</span>
</div>
@@ -12,7 +12,7 @@ export const ViewSelectContent = () => {
<SelectItem key={view.name} value={`${index}`}>
<div className="flex items-center gap-2">
<span className={cn(view.className, "flex")}>{view.icon}</span>
<span>{t(view.name as any)}</span>
<span>{t(view.name, { ns: "common" })}</span>
</div>
</SelectItem>
))}
@@ -34,7 +34,7 @@ const CmdNPanel = () => {
tipcClient?.readClipboard().then((clipboardText) => {
if (clipboardText) {
form.setValue("url", clipboardText)
form.control._updateValid()
form.control._setValid()
}
})
}, [])
@@ -74,7 +74,6 @@ export function AccountManagement() {
<AuthProviderButton key={provider} provider={provider} />
))}
</div>
<p className="text-muted-foreground text-xs">{t("profile.link_social.description")}</p>
</div>
)
}
@@ -10,12 +10,7 @@ import { EntryInfoContext } from "../context"
export const TimeStamp = (props: { time: string }) => {
const { entryId } = useContext(EntryInfoContext)
const entry = useEntry(entryId)
let mediaDuration = entry?.entries.attachments?.[0]?.duration_in_seconds
if (mediaDuration && Number.isNaN(+mediaDuration)) {
// @ts-expect-error mediaDuration is string
mediaDuration = formatTimeToSeconds(mediaDuration)
}
const mediaDuration = formatTimeToSeconds(entry?.entries.attachments?.[0]?.duration_in_seconds)
const src = entry?.entries?.attachments?.[0]?.url
if (!src) return <span>{props.time}</span>
@@ -62,7 +62,6 @@ class SettingSyncQueue {
this.teardown()
this.load()
this.flush()
const d1 = EventBus.subscribe("SETTING_CHANGE_EVENT", (data) => {
const tab = bizSettingKeyToTabMapping[data.key]
@@ -251,6 +250,8 @@ class SettingSyncQueue {
const setter = localSettingSetterMap[tab]
nextPayload.updated = remoteUpdatedDate
setter(nextPayload)
}
}
@@ -4,15 +4,14 @@ import { IN_ELECTRON } from "@follow/shared/constants"
import { preventDefault } from "@follow/utils/dom"
import { cn, getOS } from "@follow/utils/utils"
import type { BoundingBox } from "framer-motion"
import { useDragControls } from "framer-motion"
import { Resizable } from "re-resizable"
import type { PointerEventHandler, PropsWithChildren } from "react"
import type { PropsWithChildren } from "react"
import { memo, Suspense, useCallback, useEffect, useRef } from "react"
import { useUISettingSelector } from "~/atoms/settings/ui"
import { m } from "~/components/common/Motion"
import { resizableOnly } from "~/components/ui/modal"
import { useResizeableModal } from "~/components/ui/modal/stacked/hooks"
import { useModalResizeAndDrag } from "~/components/ui/modal/stacked/internal/use-drag"
import { ElECTRON_CUSTOM_TITLEBAR_HEIGHT } from "~/constants"
import { useActivationModal } from "~/modules/activation"
@@ -36,17 +35,18 @@ export function SettingModalLayout(
const tab = useSettingTab()
const elementRef = useRef<HTMLDivElement>(null)
const edgeElementRef = useRef<HTMLDivElement>(null)
const dragController = useDragControls()
const {
handleDrag,
handleResizeStart,
handleResizeStop,
preferDragDir,
relocateModal,
isResizeable,
resizeableStyle,
} = useResizeableModal(elementRef, {
enableResizeable: true,
dragControls: dragController,
dragController,
} = useModalResizeAndDrag(elementRef, {
resizeable: true,
draggable: true,
})
const availableSettings = useAvailableSettings()
@@ -64,15 +64,7 @@ export function SettingModalLayout(
draggable: state.modalDraggable,
overlay: state.modalOverlay,
}))
const handleDrag: PointerEventHandler<HTMLDivElement> = useCallback(
(e) => {
if (draggable) {
dragController.start(e)
relocateModal()
}
},
[dragController, draggable, relocateModal],
)
const measureDragConstraints = useCallback((constraints: BoundingBox) => {
if (getOS() === "Windows") {
return {
@@ -2,6 +2,7 @@ import { Logo } from "@follow/components/icons/logo.jsx"
import { Button } from "@follow/components/ui/button/index.js"
import { styledButtonVariant } from "@follow/components/ui/button/variants.js"
import { Divider } from "@follow/components/ui/divider/index.js"
import { MODE, ModeEnum } from "@follow/shared/constants"
import { getCurrentEnvironment } from "@follow/utils/environment"
import PKG, { repository } from "@pkg"
import { useQuery } from "@tanstack/react-query"
@@ -30,7 +31,7 @@ export const SettingAbout = () => {
<div className="flex grow flex-col">
<div className="text-lg font-bold">
{APP_NAME} {!import.meta.env.PROD ? `(${import.meta.env.MODE})` : ""}
{APP_NAME} {MODE !== ModeEnum.production ? `(${MODE})` : ""}
</div>
<div className="flex flex-wrap items-center gap-2">
{appVersion && (
@@ -10,7 +10,7 @@ import {
} from "@follow/components/ui/select/index.jsx"
import { ResponsiveSelect } from "@follow/components/ui/select/responsive.js"
import { useIsDark, useThemeAtomValue } from "@follow/hooks"
import { IN_ELECTRON } from "@follow/shared/constants"
import { ELECTRON_BUILD, IN_ELECTRON } from "@follow/shared/constants"
import { capitalizeFirstLetter, getOS } from "@follow/utils/utils"
import dayjs from "dayjs"
import { useForceUpdate } from "framer-motion"
@@ -28,7 +28,6 @@ import {
useUISettingValue,
} from "~/atoms/settings/ui"
import { useCurrentModal, useModalStack } from "~/components/ui/modal/stacked/hooks"
import { isElectronBuild } from "~/constants"
import { useSetTheme } from "~/hooks/common"
import { useShowCustomizeToolbarModal } from "~/modules/customize-toolbar/modal"
@@ -117,7 +116,7 @@ export const SettingAppearance = () => {
defineItem("guessCodeLanguage", {
label: t("appearance.guess_code_language.label"),
hide: !isElectronBuild,
hide: !ELECTRON_BUILD,
description: t("appearance.guess_code_language.description"),
}),
@@ -13,6 +13,7 @@ import { Input } from "@follow/components/ui/input/Input.js"
import { Label } from "@follow/components/ui/label/index.jsx"
import { Radio, RadioGroup } from "@follow/components/ui/radio-group/index.js"
import { Slider } from "@follow/components/ui/slider/index.js"
import { ELECTRON_BUILD } from "@follow/shared/constants"
import { env } from "@follow/shared/env.desktop"
import { zodResolver } from "@hookform/resolvers/zod"
import { useQuery } from "@tanstack/react-query"
@@ -22,7 +23,6 @@ import { z } from "zod"
import { setGeneralSetting, useGeneralSettingValue } from "~/atoms/settings/general"
import { useModalStack } from "~/components/ui/modal/stacked/hooks"
import { isElectronBuild } from "~/constants"
import { exportDB } from "~/database"
import { initAnalytics } from "~/initialize/analytics"
import { tipcClient } from "~/lib/client"
@@ -118,17 +118,17 @@ export const SettingDataControl = () => {
},
},
isElectronBuild && {
ELECTRON_BUILD && {
type: "title",
value: t("general.cache"),
},
isElectronBuild && AppCacheLimit,
isElectronBuild ? CleanElectronCache : CleanCacheStorage,
isElectronBuild && {
ELECTRON_BUILD && AppCacheLimit,
ELECTRON_BUILD ? CleanElectronCache : CleanCacheStorage,
ELECTRON_BUILD && {
type: "title",
value: t("general.data_file.label"),
},
isElectronBuild && {
ELECTRON_BUILD && {
label: t("general.log_file.label"),
description: t("general.log_file.description"),
buttonText: t("general.log_file.button"),
@@ -2,7 +2,7 @@ import { useMobile } from "@follow/components/hooks/useMobile.js"
import { ResponsiveSelect } from "@follow/components/ui/select/responsive.js"
import { UserRole } from "@follow/constants"
import { useTypeScriptHappyCallback } from "@follow/hooks"
import { LANGUAGE_MAP } from "@follow/shared"
import { ACTION_LANGUAGE_MAP } from "@follow/shared"
import { IN_ELECTRON } from "@follow/shared/constants"
import { cn } from "@follow/utils/utils"
import { useQuery } from "@tanstack/react-query"
@@ -302,7 +302,7 @@ const ActionLanguageSelector = () => {
}}
items={[
{ label: t("general.action_language.default"), value: DEFAULT_ACTION_LANGUAGE },
...Object.values(LANGUAGE_MAP),
...Object.values(ACTION_LANGUAGE_MAP),
]}
/>
</div>
@@ -31,6 +31,7 @@ import { usePresentUserProfileModal, useTOTPModalWrapper } from "~/modules/profi
import { UserAvatar } from "~/modules/user/UserAvatar"
import { Queries } from "~/queries"
const numberFormatter = new Intl.NumberFormat("en-US")
export const SettingInvitations = () => {
const { t } = useTranslation("settings")
const invitations = useAuthQuery(Queries.invitations.list())
@@ -66,7 +67,7 @@ export const SettingInvitations = () => {
<Trans
ns="settings"
values={{
limitation: limitation.data,
limitation: numberFormatter.format(limitation.data ?? 0),
}}
i18nKey="invitation.limitationMessage"
/>
@@ -162,7 +162,9 @@ export const SettingLists = () => {
</span>
</TooltipTrigger>
<TooltipPortal>
<TooltipContent>{t(views[row.view]!.name as any)}</TooltipContent>
<TooltipContent>
{t(views[row.view]!.name, { ns: "common" })}
</TooltipContent>
</TooltipPortal>
</Tooltip>
</TableCell>
@@ -46,7 +46,9 @@ export const ViewSelectorRadioGroup = forwardRef<
{cloneElement(view.icon, {
className: `text-lg ${view.icon?.props?.className ?? ""}`,
})}
<span className="mt-1 hidden text-xs lg:inline">{t(view.name as any)}</span>
<span className="mt-1 hidden text-xs lg:inline">
{t(view.name, { ns: "common" })}
</span>
</label>
</div>
))}
@@ -240,7 +240,7 @@ function FeedCategoryImpl({ data: ids, view, categoryOpenStateData }: FeedCatego
submenu: views
.filter((v) => v.view !== view)
.map((v) => ({
label: t(v.name as any),
label: t(v.name, { ns: "common" }),
type: "text" as const,
shortcut: (v.view + 1).toString(),
icon: v.icon,
@@ -96,7 +96,7 @@ const FeedListImpl = ({ className, view }: { className?: string; view: number })
<span className="ml-2">
{t("words.all", { ns: "common" })}
{t("space", { ns: "common" })}
{t(views[view]!.name as any)}
{t(views[view]!.name, { ns: "common" })}
</span>
</button>
<SortableFeedList

Some files were not shown because too many files have changed in this diff Show More