+1








913b1178c8
* fix(path): change path package to pathe * fix: handle special chat in filename, fixed #3342 - Integrated @sindresorhus/slugify to format file names based on titles. - Updated pnpm-lock.yaml to include new dependencies. - Minor adjustments in package.json files to ensure consistency. Signed-off-by: Innei <tukon479@gmail.com> * fix: add eslint rule for use pathe first * refactor: useWhoami from user store (#4061) * refactor: useWhoami from user store * update * update * update * update * return all * fix: invalidate entries query after unsubscribe * feat: implement imperative modal (#4041) * feat: implement ImperativeModalProvider with modal context and controls * fix: make onClose prop optional for bottom modal * chore: add ImperativeModalProvider to context providers * feat: wrap BottomModal content in KeyboardAvoidingView for better keyboard handling * chore: add polyfill for Promise.withResolvers * fix: wrap ImperativeModal in a View and update onClose to accept modal ID * feat: implement ImperativeModal with context and modal control hooks * refactor: redesign imperative modal with root-siblings * fix: wrap BottomModal in a View to resolve rendering issues on Android * refactor: replace Alert.prompt with modalPrompt for category creation and renaming * fix(desktop): show login modal when auth fail * feat: invalidate entry readability cache * refactor: long press to open text select sheet for ai summary * feat: new domain folo.is * fix: enhance auth client with mobile-specific headers (#4064) * feat(desktop): add missing i18n key (#4066) * feat: update twitter handle * docs: use google play badge * feat: add hideAvatar prop to ProfileSettingForm for conditional avatar display Signed-off-by: Innei <tukon479@gmail.com> * docs: update images * feat(ssr): add Google Analytics tracking to index.html - Integrated Google Tag Manager for enhanced tracking and analytics capabilities. - Added asynchronous loading of gtag.js and configuration for tracking ID G-DZMBZBW3EC. Signed-off-by: Innei <tukon479@gmail.com> * chore: Update Japanese Languages (#4078) * chore: update ja.json * chore: update 6 ja.json files chore: update and bump 6 ja.json files. * chore: update error/ja.json fix locale/error/ja.json * chore: auto-fix linting and formatting issues * chore: update app/ja.json * chore: update ja.json * chore: update ja.json * chore: update ja.json and tested local. * chore: update ja.json update settings/ja.json * feat(i18n): update Japanese locale files with new error messages and dialog options * chore(vscode): set default formatter for JSON and JSONC files * Remove JSON and JSONC formatter settings so sorry, @hyoban 😢 Perhaps my local settings are in. I have restored it to the original. Thanks for your kindness. You have always been a great help. * chore: auto-fix linting and formatting issues * chore: update ja.json sync and update settings/ja.json * chore: update Japanese translations for clarity and consistency * chore: update some ja.json * chore(locales): update Japanese translations with new entry actions and settings * fix: update Japanese translations for user actions and login prompts * feat(locales): add Japanese translations for login and registration features * feat(locales): update Japanese translations for RSSHub and related settings * chore: auto-fix linting and formatting issues * feat(i18n): update Japanese locale with new toolbar customization and profile link social fields * feat(locales): update Japanese translations for search results and two-factor authentication * feat: 日本語ローカライズの更新 --------- Co-authored-by: dai <dai@users.noreply.github.com> Co-authored-by: Innei <i@innei.in> Co-authored-by: Innei <Innei@users.noreply.github.com> * feat(desktop): real user deletion * feat(mobile): real user deletion * feat(settings): add accent color customization and update UI components - Introduced accent color setting to allow users to customize the app's interface. - Updated various components to utilize the new accent color, including buttons, sliders, and text elements. - Added translations for accent color settings in English, Japanese, and Chinese. - Refactored related styles in Tailwind CSS configuration to support the new accent color feature. Signed-off-by: Innei <tukon479@gmail.com> * fix: update text styling for feed parameters message * feat: use insertedBefore for mark above read * feat(mobile): use insertedBefore for mark above read * fix: improved lightbox component for iOS (#4089) * feat: replace Image component with ProxyImage for improved performance and styling * fix: update Image component style prop * fix: improved layout in ImageItem component * feat: integrate animated ref for media preview in EntryPictureItem * fix: option can not be press when out of screen in the FlatList * fix: lint * fix: types * fix: update lock * fix: lint * chore: auto-fix linting and formatting issues --------- Signed-off-by: Innei <tukon479@gmail.com> Co-authored-by: Innei <tukon479@gmail.com> Co-authored-by: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Co-authored-by: Whitewater <me@waterwater.moe> Co-authored-by: lawvs <18554747+lawvs@users.noreply.github.com> Co-authored-by: DIYgod <i@diygod.me> Co-authored-by: Konv Suu <2583695112@qq.com> Co-authored-by: dai <dosada@gmail.com> Co-authored-by: dai <dai@users.noreply.github.com> Co-authored-by: Innei <i@innei.in> Co-authored-by: Innei <Innei@users.noreply.github.com>
320 lines
9.4 KiB
TypeScript
320 lines
9.4 KiB
TypeScript
import "dotenv/config"
|
|
|
|
import crypto from "node:crypto"
|
|
import fs, { readdirSync } from "node:fs"
|
|
import { cp, readdir } from "node:fs/promises"
|
|
|
|
import { FuseV1Options, FuseVersion } from "@electron/fuses"
|
|
import { MakerAppX } from "@electron-forge/maker-appx"
|
|
import { MakerDMG } from "@electron-forge/maker-dmg"
|
|
import { MakerPKG } from "@electron-forge/maker-pkg"
|
|
import { MakerSquirrel } from "@electron-forge/maker-squirrel"
|
|
import { MakerZIP } from "@electron-forge/maker-zip"
|
|
import { FusesPlugin } from "@electron-forge/plugin-fuses"
|
|
import type { ForgeConfig } from "@electron-forge/shared-types"
|
|
import MakerAppImage from "@pengx17/electron-forge-maker-appimage"
|
|
import setLanguages from "electron-packager-languages"
|
|
import yaml from "js-yaml"
|
|
import path, { resolve } from "pathe"
|
|
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 = {
|
|
darwin: "macos",
|
|
linux: "linux",
|
|
win32: "windows",
|
|
}
|
|
const ymlMapsMap = {
|
|
darwin: "latest-mac.yml",
|
|
linux: "latest-linux.yml",
|
|
win32: "latest.yml",
|
|
}
|
|
|
|
const keepModules = new Set(["font-list", "vscode-languagedetection"])
|
|
const keepLanguages = new Set(["en", "en_GB", "en-US", "en_US"])
|
|
|
|
// remove folders & files not to be included in the app
|
|
async function cleanSources(buildPath, _electronVersion, platform, _arch, callback) {
|
|
// folders & files to be included in the app
|
|
const appItems = new Set(["dist", "node_modules", "package.json", "resources"])
|
|
|
|
if (platform === "darwin" || platform === "mas") {
|
|
const frameworkResourcePath = resolve(
|
|
buildPath,
|
|
"../../Frameworks/Electron Framework.framework/Versions/A/Resources",
|
|
)
|
|
|
|
for (const file of readdirSync(frameworkResourcePath)) {
|
|
if (file.endsWith(".lproj") && !keepLanguages.has(file.split(".")[0]!)) {
|
|
rimrafSync(resolve(frameworkResourcePath, file))
|
|
}
|
|
}
|
|
}
|
|
|
|
// Keep only node_modules to be included in the app
|
|
|
|
await Promise.all([
|
|
...(await readdir(buildPath).then((items) =>
|
|
items.filter((item) => !appItems.has(item)).map((item) => rimraf(path.join(buildPath, item))),
|
|
)),
|
|
...(await readdir(path.join(buildPath, "node_modules")).then((items) =>
|
|
items
|
|
.filter((item) => !keepModules.has(item))
|
|
.map((item) => rimraf(path.join(buildPath, "node_modules", item))),
|
|
)),
|
|
])
|
|
|
|
// copy needed node_modules to be included in the app
|
|
await Promise.all(
|
|
Array.from(keepModules.values()).map((item) => {
|
|
// Check is exist
|
|
if (fs.existsSync(path.join(buildPath, "node_modules", item))) {
|
|
// eslint-disable-next-line array-callback-return
|
|
return
|
|
}
|
|
return cp(
|
|
path.join(process.cwd(), "../../node_modules", item),
|
|
path.join(buildPath, "node_modules", item),
|
|
{
|
|
recursive: true,
|
|
},
|
|
)
|
|
}),
|
|
)
|
|
|
|
callback()
|
|
}
|
|
|
|
const noopAfterCopy = (_buildPath, _electronVersion, _platform, _arch, callback) => callback()
|
|
|
|
const ignorePattern = new RegExp(`^/node_modules/(?!${[...keepModules].join("|")})`)
|
|
|
|
const config: ForgeConfig = {
|
|
packagerConfig: {
|
|
name: isStaging ? "Folo Staging" : "Folo",
|
|
appCategoryType: "public.app-category.news",
|
|
buildVersion: process.env.BUILD_VERSION || undefined,
|
|
appBundleId: "is.follow",
|
|
icon: isStaging ? "resources/icon-staging" : "resources/icon",
|
|
extraResource: ["./resources/app-update.yml"],
|
|
protocols: [
|
|
{
|
|
name: "Folo",
|
|
schemes: ["follow"],
|
|
},
|
|
{
|
|
name: "Folo",
|
|
schemes: ["folo"],
|
|
},
|
|
],
|
|
|
|
afterCopy: [
|
|
cleanSources,
|
|
process.platform !== "win32" ? noopAfterCopy : setLanguages([...keepLanguages.values()]),
|
|
],
|
|
asar: true,
|
|
ignore: [ignorePattern],
|
|
|
|
prune: true,
|
|
extendInfo: {
|
|
ITSAppUsesNonExemptEncryption: false,
|
|
},
|
|
osxSign: {
|
|
optionsForFile:
|
|
platform === "mas"
|
|
? (filePath) => {
|
|
const entitlements = filePath.includes(".app/")
|
|
? "build/entitlements.mas.child.plist"
|
|
: "build/entitlements.mas.plist"
|
|
return {
|
|
hardenedRuntime: false,
|
|
entitlements,
|
|
}
|
|
}
|
|
: () => ({
|
|
entitlements: "build/entitlements.mac.plist",
|
|
}),
|
|
keychain: process.env.OSX_SIGN_KEYCHAIN_PATH,
|
|
identity: process.env.OSX_SIGN_IDENTITY,
|
|
provisioningProfile: process.env.OSX_SIGN_PROVISIONING_PROFILE_PATH,
|
|
},
|
|
...(process.env.APPLE_ID &&
|
|
process.env.APPLE_PASSWORD &&
|
|
process.env.APPLE_TEAM_ID && {
|
|
osxNotarize: {
|
|
appleId: process.env.APPLE_ID!,
|
|
appleIdPassword: process.env.APPLE_PASSWORD!,
|
|
teamId: process.env.APPLE_TEAM_ID!,
|
|
},
|
|
}),
|
|
},
|
|
rebuildConfig: {},
|
|
makers: [
|
|
new MakerZIP({}, ["darwin"]),
|
|
new MakerDMG(
|
|
{
|
|
overwrite: true,
|
|
background: "static/dmg-background.png",
|
|
icon: "static/dmg-icon.icns",
|
|
iconSize: 160,
|
|
additionalDMGOptions: {
|
|
window: {
|
|
size: {
|
|
width: 660,
|
|
height: 400,
|
|
},
|
|
},
|
|
},
|
|
contents: (opts) => [
|
|
{
|
|
x: 180,
|
|
y: 170,
|
|
type: "file",
|
|
path: (opts as any).appPath,
|
|
},
|
|
{
|
|
x: 480,
|
|
y: 170,
|
|
type: "link",
|
|
path: "/Applications",
|
|
},
|
|
],
|
|
},
|
|
["darwin", "mas"],
|
|
),
|
|
new MakerSquirrel({
|
|
name: "Folo",
|
|
setupIcon: isStaging ? "resources/icon-staging.ico" : "resources/icon.ico",
|
|
iconUrl: "https://app.folo.is/favicon.ico",
|
|
}),
|
|
new MakerAppImage({
|
|
config: {
|
|
icons: [
|
|
{
|
|
file: isStaging ? "resources/icon-staging.png" : "resources/icon.png",
|
|
size: 256,
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
new MakerPKG(
|
|
{
|
|
name: "Folo",
|
|
keychain: process.env.KEYCHAIN_PATH,
|
|
},
|
|
["mas"],
|
|
),
|
|
new MakerAppX({
|
|
publisher: "CN=7CBBEB6A-9B0E-4387-BAE3-576D0ACA279E",
|
|
packageDisplayName: "Folo - Follow everything in one place",
|
|
devCert: "build/dev.pfx",
|
|
assets: "static/appx",
|
|
// @ts-ignore
|
|
publisherDisplayName: "Natural Selection Labs",
|
|
identityName: "NaturalSelectionLabs.Follow-Yourfavoritesinoneinbo",
|
|
packageBackgroundColor: "#FF5C00",
|
|
protocol: "follow", // TODO: use custom appx manifest to support both follow and folo
|
|
}),
|
|
],
|
|
plugins: [
|
|
// Fuses are used to enable/disable various Electron functionality
|
|
// at package time, before code signing the application
|
|
new FusesPlugin({
|
|
version: FuseVersion.V1,
|
|
[FuseV1Options.RunAsNode]: false,
|
|
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
|
|
[FuseV1Options.EnableNodeCliInspectArguments]: false,
|
|
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
|
|
[FuseV1Options.OnlyLoadAppFromAsar]: true,
|
|
}),
|
|
],
|
|
publishers: [
|
|
{
|
|
name: "@electron-forge/publisher-github",
|
|
config: {
|
|
repository: {
|
|
owner: "RSSNext",
|
|
name: "follow",
|
|
},
|
|
draft: true,
|
|
},
|
|
},
|
|
],
|
|
hooks: {
|
|
postMake: async (_config, makeResults) => {
|
|
const yml: {
|
|
version?: string
|
|
files: {
|
|
url: string
|
|
sha512: string
|
|
size: number
|
|
}[]
|
|
releaseDate?: string
|
|
} = {
|
|
version: makeResults[0]?.packageJSON?.version,
|
|
files: [],
|
|
}
|
|
let basePath = ""
|
|
makeResults = makeResults.map((result) => {
|
|
result.artifacts = result.artifacts.map((artifact) => {
|
|
if (artifactRegex.test(artifact)) {
|
|
if (!basePath) {
|
|
basePath = path.dirname(artifact)
|
|
}
|
|
const newArtifact = `${path.dirname(artifact)}/${
|
|
result.packageJSON.productName
|
|
}-${result.packageJSON.version}-${
|
|
platformNamesMap[result.platform]
|
|
}-${result.arch}${path.extname(artifact)}`
|
|
fs.renameSync(artifact, newArtifact)
|
|
|
|
try {
|
|
const fileData = fs.readFileSync(newArtifact)
|
|
const hash = crypto.createHash("sha512").update(fileData).digest("base64")
|
|
const { size } = fs.statSync(newArtifact)
|
|
|
|
yml.files.push({
|
|
url: path.basename(newArtifact),
|
|
sha512: hash,
|
|
size,
|
|
})
|
|
} catch {
|
|
console.error(`Failed to hash ${newArtifact}`)
|
|
}
|
|
return newArtifact
|
|
} else {
|
|
return artifact
|
|
}
|
|
})
|
|
return result
|
|
})
|
|
yml.releaseDate = new Date().toISOString()
|
|
|
|
if (makeResults[0]?.platform && ymlMapsMap[makeResults[0].platform] && basePath) {
|
|
const ymlPath = path.join(basePath, ymlMapsMap[makeResults[0].platform])
|
|
|
|
const ymlStr = yaml.dump(yml, {
|
|
lineWidth: -1,
|
|
})
|
|
fs.writeFileSync(ymlPath, ymlStr)
|
|
|
|
makeResults.push({
|
|
artifacts: [ymlPath],
|
|
platform: makeResults[0]!.platform,
|
|
arch: makeResults[0]!.arch,
|
|
packageJSON: makeResults[0]!.packageJSON,
|
|
})
|
|
}
|
|
|
|
return makeResults
|
|
},
|
|
},
|
|
}
|
|
|
|
export default config
|