diff --git a/config/index.js b/config/index.js index cea3e2e..e57290b 100644 --- a/config/index.js +++ b/config/index.js @@ -36,25 +36,6 @@ const config = { chunkFilename: "static/css/[name].[contenthash:8].css", }, ]); - - const WebpackObfuscator = require("webpack-obfuscator"); - chain.plugin("obfuscator").use(WebpackObfuscator, [ - { - rotateStringArray: true, - stringArray: true, - stringArrayThreshold: 0.5, - compact: true, - controlFlowFlattening: false, - deadCodeInjection: false, - debugProtection: false, - disableConsoleOutput: true, - selfDefending: false, - simplify: true, - target: "browser", - disableOptimizations: true, - }, - ["**/*.js", "!node_modules/**"], - ]); } chain.module diff --git a/package.json b/package.json index f77387f..7c9d978 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "animate.css": "^4.1.1", "github-markdown-css": "^5.6.1", "marked": "^14.1.2", + "pocketbase": "^0.26.8", "raw-loader": "^4.0.2", "react": "^18.0.0", "react-dom": "^18.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 561fbfb..cfaaf91 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -62,6 +62,9 @@ importers: marked: specifier: ^14.1.2 version: 14.1.4 + pocketbase: + specifier: ^0.26.8 + version: 0.26.8 raw-loader: specifier: ^4.0.2 version: 4.0.2(webpack@5.104.1(@swc/core@1.3.96)) @@ -5032,7 +5035,7 @@ packages: glob@7.1.6: resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} @@ -7297,6 +7300,9 @@ packages: resolution: {integrity: sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==} engines: {node: '>=4.0.0'} + pocketbase@0.26.8: + resolution: {integrity: sha512-aQ/ewvS7ncvAE8wxoW10iAZu6ElgbeFpBhKPnCfvRovNzm2gW8u/sQNPGN6vNgVEagz44kK//C61oKjfa+7Low==} + posix-character-classes@0.1.1: resolution: {integrity: sha512-xTgYBc3fuo7Yt7JbiuFxSYGToMoz8fLoE6TC9Wx1P/u+LfeThMOAqmuyECnlBaaJb+u1m9hHiXUEtwW4OzfUJg==} engines: {node: '>=0.10.0'} @@ -8883,6 +8889,7 @@ packages: tar@6.2.1: resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} engines: {node: '>=10'} + deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me taro-ui@3.3.0: resolution: {integrity: sha512-M4tf2OEy1BzmeFyvF0kFOgzzW1Lc86TlQ5UwZh4cNMkuViqGId/DLqY0iMlqAjfXstRn0x4HaFFw91xfLqkPzg==} @@ -11541,7 +11548,7 @@ snapshots: '@babel/template': 7.27.2 '@react-native/babel-plugin-codegen': 0.73.4(@babel/preset-env@7.28.5(@babel/core@7.28.5)) babel-plugin-transform-flow-enums: 0.0.2(@babel/core@7.28.5) - react-refresh: 0.14.0 + react-refresh: 0.14.2 transitivePeerDependencies: - '@babel/preset-env' - supports-color @@ -14847,7 +14854,7 @@ snapshots: dotenv-expand@11.0.7: dependencies: - dotenv: 16.4.7 + dotenv: 16.6.1 dotenv-expand@9.0.0: {} @@ -17154,7 +17161,7 @@ snapshots: '@babel/register': 7.28.3(@babel/core@7.28.5) babel-core: 7.0.0-bridge.0(@babel/core@7.28.5) colors: 1.4.0 - flow-parser: 0.121.0 + flow-parser: 0.206.0 graceful-fs: 4.2.11 micromatch: 3.1.10 neo-async: 2.6.2 @@ -18707,6 +18714,8 @@ snapshots: pngjs@3.4.0: {} + pocketbase@0.26.8: {} + posix-character-classes@0.1.1: {} possible-typed-array-names@1.1.0: {} diff --git a/src/app.js b/src/app.js index 3d0fb49..b071b44 100644 --- a/src/app.js +++ b/src/app.js @@ -6,14 +6,20 @@ import 'taro-ui/dist/style/index.scss' const isProd = process.env.NODE_ENV === 'production' if (isProd) { - const SDK = require('sr-sdk-h5').default - window.srt = new SDK({ - token: 'bi72fccc7184ef45f9', - debug: false, - autoTrack: true, - autoStart: true, - appid: '' - }) + try { + const SDK = require('sr-sdk-h5').default + if (typeof SDK === 'function') { + window.srt = new SDK({ + token: 'bi72fccc7184ef45f9', + debug: false, + autoTrack: true, + autoStart: true, + appid: '' + }) + } + } catch (e) { + console.warn('sr-sdk-h5 init skip:', e) + } } class App extends Component { diff --git a/src/index.html b/src/index.html index d391728..abb1f90 100644 --- a/src/index.html +++ b/src/index.html @@ -1,21 +1,23 @@ + + 数字游民:地理套利与自动化杠杆 - - - - - + + +
+ + diff --git a/src/pages/book/index.tsx b/src/pages/book/index.tsx index 5c0cef0..bbaaace 100644 --- a/src/pages/book/index.tsx +++ b/src/pages/book/index.tsx @@ -8,7 +8,10 @@ import { chunks as infoChunks, headers as infoHeaders } from "./info.md"; import hackrobot from "../../images/hackrobot.jpg"; const PB_URL = "https://pocketbase.hackrobot.cn"; -const pb = new PocketBase(PB_URL); +function getPb() { + const PB = typeof window !== "undefined" && window.PocketBase; + return PB ? new PB(PB_URL) : null; +} const LazyChunk = React.memo(({ html, estimatedHeight, forceVisible }) => { const [visible, setVisible] = useState(forceVisible); @@ -70,6 +73,8 @@ const Book = () => { const checkPaymentFromPB = async (uid) => { try { + const pb = getPb(); + if (!pb) return getLocalPaidType(); const records = await pb.collection("payments").getList(1, 1, { filter: `user_id = "${uid}"`, sort: "-created",