This commit is contained in:
eric
2026-03-07 20:56:33 -06:00
parent 219785b1ba
commit cc1c93a9db
6 changed files with 41 additions and 37 deletions

View File

@@ -36,25 +36,6 @@ const config = {
chunkFilename: "static/css/[name].[contenthash:8].css", 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 chain.module

View File

@@ -47,6 +47,7 @@
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"github-markdown-css": "^5.6.1", "github-markdown-css": "^5.6.1",
"marked": "^14.1.2", "marked": "^14.1.2",
"pocketbase": "^0.26.8",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"react": "^18.0.0", "react": "^18.0.0",
"react-dom": "^18.0.0", "react-dom": "^18.0.0",

17
pnpm-lock.yaml generated
View File

@@ -62,6 +62,9 @@ importers:
marked: marked:
specifier: ^14.1.2 specifier: ^14.1.2
version: 14.1.4 version: 14.1.4
pocketbase:
specifier: ^0.26.8
version: 0.26.8
raw-loader: raw-loader:
specifier: ^4.0.2 specifier: ^4.0.2
version: 4.0.2(webpack@5.104.1(@swc/core@1.3.96)) version: 4.0.2(webpack@5.104.1(@swc/core@1.3.96))
@@ -5032,7 +5035,7 @@ packages:
glob@7.1.6: glob@7.1.6:
resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==} 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: glob@7.2.3:
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
@@ -7297,6 +7300,9 @@ packages:
resolution: {integrity: sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==} resolution: {integrity: sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==}
engines: {node: '>=4.0.0'} engines: {node: '>=4.0.0'}
pocketbase@0.26.8:
resolution: {integrity: sha512-aQ/ewvS7ncvAE8wxoW10iAZu6ElgbeFpBhKPnCfvRovNzm2gW8u/sQNPGN6vNgVEagz44kK//C61oKjfa+7Low==}
posix-character-classes@0.1.1: posix-character-classes@0.1.1:
resolution: {integrity: sha512-xTgYBc3fuo7Yt7JbiuFxSYGToMoz8fLoE6TC9Wx1P/u+LfeThMOAqmuyECnlBaaJb+u1m9hHiXUEtwW4OzfUJg==} resolution: {integrity: sha512-xTgYBc3fuo7Yt7JbiuFxSYGToMoz8fLoE6TC9Wx1P/u+LfeThMOAqmuyECnlBaaJb+u1m9hHiXUEtwW4OzfUJg==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@@ -8883,6 +8889,7 @@ packages:
tar@6.2.1: tar@6.2.1:
resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==}
engines: {node: '>=10'} 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: taro-ui@3.3.0:
resolution: {integrity: sha512-M4tf2OEy1BzmeFyvF0kFOgzzW1Lc86TlQ5UwZh4cNMkuViqGId/DLqY0iMlqAjfXstRn0x4HaFFw91xfLqkPzg==} resolution: {integrity: sha512-M4tf2OEy1BzmeFyvF0kFOgzzW1Lc86TlQ5UwZh4cNMkuViqGId/DLqY0iMlqAjfXstRn0x4HaFFw91xfLqkPzg==}
@@ -11541,7 +11548,7 @@ snapshots:
'@babel/template': 7.27.2 '@babel/template': 7.27.2
'@react-native/babel-plugin-codegen': 0.73.4(@babel/preset-env@7.28.5(@babel/core@7.28.5)) '@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) babel-plugin-transform-flow-enums: 0.0.2(@babel/core@7.28.5)
react-refresh: 0.14.0 react-refresh: 0.14.2
transitivePeerDependencies: transitivePeerDependencies:
- '@babel/preset-env' - '@babel/preset-env'
- supports-color - supports-color
@@ -14847,7 +14854,7 @@ snapshots:
dotenv-expand@11.0.7: dotenv-expand@11.0.7:
dependencies: dependencies:
dotenv: 16.4.7 dotenv: 16.6.1
dotenv-expand@9.0.0: {} dotenv-expand@9.0.0: {}
@@ -17154,7 +17161,7 @@ snapshots:
'@babel/register': 7.28.3(@babel/core@7.28.5) '@babel/register': 7.28.3(@babel/core@7.28.5)
babel-core: 7.0.0-bridge.0(@babel/core@7.28.5) babel-core: 7.0.0-bridge.0(@babel/core@7.28.5)
colors: 1.4.0 colors: 1.4.0
flow-parser: 0.121.0 flow-parser: 0.206.0
graceful-fs: 4.2.11 graceful-fs: 4.2.11
micromatch: 3.1.10 micromatch: 3.1.10
neo-async: 2.6.2 neo-async: 2.6.2
@@ -18707,6 +18714,8 @@ snapshots:
pngjs@3.4.0: {} pngjs@3.4.0: {}
pocketbase@0.26.8: {}
posix-character-classes@0.1.1: {} posix-character-classes@0.1.1: {}
possible-typed-array-names@1.1.0: {} possible-typed-array-names@1.1.0: {}

View File

@@ -6,14 +6,20 @@ import 'taro-ui/dist/style/index.scss'
const isProd = process.env.NODE_ENV === 'production' const isProd = process.env.NODE_ENV === 'production'
if (isProd) { if (isProd) {
const SDK = require('sr-sdk-h5').default try {
window.srt = new SDK({ const SDK = require('sr-sdk-h5').default
token: 'bi72fccc7184ef45f9', if (typeof SDK === 'function') {
debug: false, window.srt = new SDK({
autoTrack: true, token: 'bi72fccc7184ef45f9',
autoStart: true, debug: false,
appid: '' autoTrack: true,
}) autoStart: true,
appid: ''
})
}
} catch (e) {
console.warn('sr-sdk-h5 init skip:', e)
}
} }
class App extends Component { class App extends Component {

View File

@@ -1,21 +1,23 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"> <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
<title>数字游民:地理套利与自动化杠杆</title> <title>数字游民:地理套利与自动化杠杆</title>
<meta name="description" content="数字游民"> <meta name="description" content="数字游民">
<!-- Icons -->
<link rel="apple-touch-icon" href="https://minioweb.hackrobot.cn/hackrobot/phone2.png" /> <link rel="apple-touch-icon" href="https://minioweb.hackrobot.cn/hackrobot/phone2.png" />
<link rel="icon" sizes="192x192" href="https://minioweb.hackrobot.cn/hackrobot/phone2.png" /> <link rel="icon" sizes="192x192" href="https://minioweb.hackrobot.cn/hackrobot/phone2.png" />
<!-- ✅ 提前建立连接 -->
<link rel="preconnect" href="https://minioweb.hackrobot.cn" crossorigin> <link rel="preconnect" href="https://minioweb.hackrobot.cn" crossorigin>
<link rel="dns-prefetch" href="https://minioweb.hackrobot.cn"> <link rel="dns-prefetch" href="https://minioweb.hackrobot.cn">
<!-- ✅ 预加载 LCP 图片 (WebP 优先PNG 回退) -->
<link rel="preload" as="image" href="https://minioweb.hackrobot.cn/hackrobot/phone2.png" type="image/png" fetchpriority="high"> <link rel="preload" as="image" href="https://minioweb.hackrobot.cn/hackrobot/phone2.png" type="image/png" fetchpriority="high">
<!-- JS 注入 --> <script src="https://cdn.jsdelivr.net/npm/pocketbase/dist/pocketbase.umd.js"></script>
<script src="https://unpkg.com/pocketbase/dist/pocketbase.umd.js"></script>
<script><%= htmlWebpackPlugin.options.script %></script> <script><%= htmlWebpackPlugin.options.script %></script>
</head> </head>
<body>
<div id="app"></div>
</body>
</html>

View File

@@ -8,7 +8,10 @@ import { chunks as infoChunks, headers as infoHeaders } from "./info.md";
import hackrobot from "../../images/hackrobot.jpg"; import hackrobot from "../../images/hackrobot.jpg";
const PB_URL = "https://pocketbase.hackrobot.cn"; 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 LazyChunk = React.memo(({ html, estimatedHeight, forceVisible }) => {
const [visible, setVisible] = useState(forceVisible); const [visible, setVisible] = useState(forceVisible);
@@ -70,6 +73,8 @@ const Book = () => {
const checkPaymentFromPB = async (uid) => { const checkPaymentFromPB = async (uid) => {
try { try {
const pb = getPb();
if (!pb) return getLocalPaidType();
const records = await pb.collection("payments").getList(1, 1, { const records = await pb.collection("payments").getList(1, 1, {
filter: `user_id = "${uid}"`, filter: `user_id = "${uid}"`,
sort: "-created", sort: "-created",