@yufengtadian/freedom-cli 1.12.16 → 1.12.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -3
- package/lib/build.js +132 -12
- package/lib/cli.js +94 -4
- package/lib/config.js +12 -1
- package/lib/init.js +9 -1
- package/lib/security.js +150 -0
- package/lib/utils.js +5 -2
- package/lib/verify.js +236 -0
- package/package.json +39 -39
- package/shell/win-x64/freedom-shell.exe +0 -0
- package/templates/go/build_all.txt +0 -0
- package/templates/go/build_err.txt +0 -0
- package/templates/go/pkg/freedom/anti_debug_other.go +8 -0
- package/templates/go/pkg/freedom/anti_debug_windows.go +39 -0
- package/templates/go/pkg/freedom/assets/freedom.js +19 -16
- package/templates/go/pkg/freedom/backend_proc.go +7 -1
- package/templates/go/pkg/freedom/center_windows.go +36 -18
- package/templates/go/pkg/freedom/center_windows_test.go +32 -0
- package/templates/go/pkg/freedom/configfile.go +56 -7
- package/templates/go/pkg/freedom/freedom.go +70 -8
- package/templates/go/pkg/freedom/security.go +227 -0
- package/templates/go/pkg/freedom/security_test.go +153 -0
- package/templates/go/pkg/freedom/syscap_other.go +10 -0
- package/templates/go/pkg/freedom/syscap_windows.go +653 -0
- package/templates/go/pkg/freedom/tray_other.go +10 -0
- package/templates/go/pkg/freedom/tray_windows.go +506 -0
- package/templates/go/pkg/freedom/window_windows.go +28 -16
- package/templates/go/temp_vet_test/main.go +40 -0
- package/templates/go/test_err.txt +0 -0
- package/templates/go/vet_err.txt +1 -0
- package/templates/go/vet_err2.txt +2 -0
- package/templates/project/freedom.config.js +8 -0
- package/templates/project-minimal/freedom.config.js +58 -0
- package/templates/project-minimal/index.html +41 -0
- package/templates/project-minimal/package.json +14 -0
- package/templates/project-minimal/src/main.js +19 -0
- package/templates/project-minimal/vite.config.js +18 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Freedom App</title>
|
|
7
|
+
<style>
|
|
8
|
+
/* 极简模板:使用系统原生标题栏(titlebar: 'native'),无自绘标题栏 / 无演示内容 */
|
|
9
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
10
|
+
html, body { height: 100%; }
|
|
11
|
+
body {
|
|
12
|
+
font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
|
|
13
|
+
background: #111827;
|
|
14
|
+
color: #e5e7eb;
|
|
15
|
+
display: flex; align-items: center; justify-content: center;
|
|
16
|
+
min-height: 100%;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
user-select: none;
|
|
19
|
+
}
|
|
20
|
+
.center { text-align: center; }
|
|
21
|
+
h1 { font-size: 26px; font-weight: 700; }
|
|
22
|
+
.desc { margin-top: 10px; color: #9ca3af; font-size: 14px; }
|
|
23
|
+
button {
|
|
24
|
+
margin-top: 18px; padding: 9px 20px; border: none; border-radius: 8px;
|
|
25
|
+
background: #6366f1; color: #fff; font-size: 14px; cursor: pointer;
|
|
26
|
+
}
|
|
27
|
+
button:hover { background: #4f46e5; }
|
|
28
|
+
.result { margin-top: 10px; color: #a5b4fc; font-size: 13px; }
|
|
29
|
+
</style>
|
|
30
|
+
</head>
|
|
31
|
+
<body>
|
|
32
|
+
<div class="center">
|
|
33
|
+
<h1>Freedom App</h1>
|
|
34
|
+
<div class="desc">你的桌面应用已就绪(极简模板,系统原生标题栏)。</div>
|
|
35
|
+
<button id="pingBtn">测试桥接</button>
|
|
36
|
+
<div class="result" id="result">点击上方按钮验证前后端桥接。</div>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<script type="module" src="/src/main.js"></script>
|
|
40
|
+
</body>
|
|
41
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Freedom 前端入口(极简模板)。
|
|
2
|
+
// window.freedom 由壳层注入,无需 import:
|
|
3
|
+
// call(method, ...args) -> Promise 调用后端方法
|
|
4
|
+
// on(event, cb) / off(event, cb) 订阅 / 取消订阅后端事件
|
|
5
|
+
// window.minimize() / maximize() / close() 等窗口控制(frameless 模式下自绘按钮用)
|
|
6
|
+
|
|
7
|
+
// 桥接自检:__freedom__ping 是壳注入的全局函数,优先直调;
|
|
8
|
+
// 低版本壳不存在时回退经 bridge 路由(壳层 bridge 对 ping 特判兼容)。
|
|
9
|
+
document.getElementById('pingBtn').addEventListener('click', async () => {
|
|
10
|
+
const el = document.getElementById('result');
|
|
11
|
+
try {
|
|
12
|
+
const r = (typeof window.__freedom__ping === 'function')
|
|
13
|
+
? await window.__freedom__ping()
|
|
14
|
+
: await window.freedom.call('__freedom__ping');
|
|
15
|
+
el.textContent = '桥接正常:' + r;
|
|
16
|
+
} catch (e) {
|
|
17
|
+
el.textContent = '桥接异常:' + e.message;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import { viteSingleFile } from 'vite-plugin-singlefile';
|
|
3
|
+
|
|
4
|
+
// 单文件打包:把所有 JS/CSS 内联进一个 index.html,
|
|
5
|
+
// 便于 freedom CLI 嵌入 Go 壳层(内存加载,无本地端口)。
|
|
6
|
+
// outDir 指向临时构建区 .freedom/vite-dist,最终产物由 freedom build 统一输出到
|
|
7
|
+
// freedom.config.js 的 outDir(默认 dist/,可设为项目根目录)。
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
plugins: [viteSingleFile()],
|
|
10
|
+
build: {
|
|
11
|
+
target: 'esnext',
|
|
12
|
+
outDir: '.freedom/vite-dist',
|
|
13
|
+
assetsInlineLimit: 100000000,
|
|
14
|
+
chunkSizeWarningLimit: 100000000,
|
|
15
|
+
cssCodeSplit: false,
|
|
16
|
+
reportCompressedSize: false,
|
|
17
|
+
},
|
|
18
|
+
});
|