Skip to content

Commit 0fd9773

Browse files
authored
Merge remote-tracking branch 'origin/dev' into pr@dev@fix_open_page_err
# Conflicts: # ui/composables/useAiPanel.test.ts
2 parents 18289b6 + ea710ae commit 0fd9773

244 files changed

Lines changed: 15220 additions & 5282 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎LICENSE‎

Lines changed: 675 additions & 21 deletions
Large diffs are not rendered by default.

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,6 @@ Report problems in [Issues](https://github.com/jumpserver/luna/issues). For usag
6666

6767
## License
6868

69-
[MIT](LICENSE)
69+
This project is licensed under the GNU General Public License version 3 (GPLv3), consistent with the [JumpServer main repository](https://github.com/jumpserver/jumpserver). See [LICENSE](LICENSE) for the full license text.
70+
71+
Third-party notices are retained in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).

‎README_CN.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,6 @@ pnpm electron:dev
6666

6767
## 许可证
6868

69-
[MIT](LICENSE)
69+
本项目采用 GNU General Public License version 3(GPLv3),与 [JumpServer 主库](https://github.com/jumpserver/jumpserver)保持一致。完整许可条款见 [LICENSE](LICENSE)。
70+
71+
第三方版权声明保留在 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。

‎THIRD_PARTY_NOTICES.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Third-party notices
2+
3+
The original Nuxt/Electron template carries the following MIT notice.
4+
This notice is retained for the template code; the project license is GPLv3 (see [LICENSE](LICENSE)).
5+
6+
MIT License
7+
8+
Copyright (c) 2024 Nicola Spadari<https://github.com/NicolaSpadari>
9+
10+
Permission is hereby granted, free of charge, to any person obtaining a copy
11+
of this software and associated documentation files (the "Software"), to deal
12+
in the Software without restriction, including without limitation the rights
13+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
copies of the Software, and to permit persons to whom the Software is
15+
furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included in all
18+
copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26+
SOFTWARE.

‎applets/weblite/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Core 连接令牌 → Tinker 领取并消费令牌
2424

2525
Tinker 原样传入 `asset`、`account`、`platform` 等通用连接数据,不识别 Applet 名称、不组装 Web 专属参数。WebLite 优先使用 `asset.spec_info` 的登录配置,未设置代填模式时回退到对应平台协议配置;安全模式来自平台配置,匿名账号 `@ANON` 关闭代填。数据通过管道传入,不进入命令行或环境变量。主进程读取并校验启动管道,渲染进程只获得显示配置。凭据只允许在资产或脚本明确指定的 origin 领取一次,关闭、失败或完成登录时释放引用。每次启动使用独立临时 profile 和内存网站 session,可并发运行。
2626

27+
基础代填的用户名、密码、提交、成功和交互区域选择器均可独立留空。未配置提交选择器时仅代填,保留页面输入并交还操作,用户可手动登录;此时不进入受保护的交互区域流程、不等待成功标记,也不会显示为已提交或登录成功。配置了提交选择器时仍按已配置的交互区域和成功标记执行自动登录。非空选择器仍需格式正确,已配置的登录元素仍需等待页面加载并通过校验。
28+
2729
Website 资产的 `allowed_urls` 为可选访问白名单:留空允许所有站点;配置后只允许导航到资产地址所属站点和列表中的 HTTP/HTTPS origin(协议、主机、端口,不含路径或通配符)。同一策略用于页面链接、重定向、弹窗和登录脚本中的 `open`;子页面和图片、脚本等资源不受此导航策略限制。Tinker 通过启动管道传入该字段,桌面客户端通过资产详情传入,共用浏览器导航校验。
2830

2931
HTTPS 资产支持自签名证书和私有 CA。仅在当前网站的独立 session 中,对资产地址、访问白名单和登录脚本 origin 明确指定的 HTTPS 主机放行 `ERR_CERT_AUTHORITY_INVALID`;独立浏览模式也支持地址栏手动输入的 HTTPS 主机。其他主机及其他证书错误继续使用 Chromium 校验。信任按主机匹配,不区分端口,不随页面重定向自动扩大,也不修改系统证书库。自签名的 SSO 中转站或资源主机需显式配置,或在发布机安装可信 CA。

‎applets/weblite/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"dependencies": {
1919
"@jumpserver/web-proxy": "workspace:*",
2020
"@nuxt/ui": "4.11.0",
21-
"vue": "^3.5.35"
21+
"vue": "^3.5.35",
22+
"vue-i18n": "^11.4.8"
2223
},
2324
"devDependencies": {
2425
"@electron/packager": "18.3.5",

‎applets/weblite/src/launch.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { webProxyNavigationPolicy } from "@jumpserver/web-proxy/script";
55

66
export function standaloneLaunch() {
77
return {
8+
language: undefined as string | undefined,
89
targetUrl: "https://www.jumpserver.org/",
910
safeMode: false,
1011
allowedUrls: [],
@@ -29,6 +30,7 @@ export function parseLaunch(value: unknown) {
2930
if (typeof data.safe_mode !== "boolean") throw new Error("缺少安全模式配置");
3031
const localSession = createLocalCredentialSession(target.toString(), data.login);
3132
return {
33+
language: typeof data.language === "string" ? data.language : undefined,
3234
targetUrl: target.toString(),
3335
safeMode: data.safe_mode,
3436
allowedUrls,
@@ -67,6 +69,7 @@ function appletLaunchData(data: Record<string, unknown>) {
6769
const anonymous = account.username === "@ANON";
6870
const config = anonymous ? { autofill: "none" } : spec.autofill ? spec : setting;
6971
return {
72+
language: object(data.connect_options ?? {}).lang,
7073
target_url: target.toString(),
7174
safe_mode: setting.safe_mode ?? false,
7275
allowed_urls: spec.allowed_urls,

‎applets/weblite/src/main.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ async function start() {
7676
if (closing || event.senderFrame !== win.webContents.mainFrame) throw new Error("无效的 Web applet 调用");
7777
if (command === "bootstrap")
7878
return {
79+
language: launch.language?.trim() || app.getLocale(),
7980
targetUrl: launch.targetUrl,
8081
proxyUrl: "",
8182
safeMode: launch.safeMode,
Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
<script setup lang="ts">
22
import { createWebProxyBridge } from "@jumpserver/web-proxy/bridge";
33
import WebProxySurface from "@jumpserver/web-proxy/surface";
4-
import { onMounted, ref } from "vue";
4+
import { computed, watchEffect } from "vue";
5+
import { useI18n } from "vue-i18n";
6+
import { toIntlLocale } from "../../../../i18n/language";
7+
import { getUiLocale } from "../../../../i18n/ui";
8+
defineProps<{ request: Record<string, any> }>();
9+
const { locale } = useI18n();
10+
const uiLocale = computed(() => getUiLocale(locale.value));
11+
watchEffect(() => {
12+
document.documentElement.lang = toIntlLocale(locale.value);
13+
});
514
const host = (window as any).webApplet;
615
const bridge = createWebProxyBridge(host.invoke, async (name, handler) => host.listen(name, handler));
7-
const request = ref();
8-
onMounted(async () => {
9-
request.value = await host.invoke("bootstrap");
10-
});
1116
</script>
1217

1318
<template>
14-
<UApp class="h-full">
15-
<WebProxySurface
16-
v-if="request"
17-
:request="request"
18-
:bridge="bridge"
19-
active
20-
supported
21-
:browsable="request.standalone"
22-
/>
19+
<UApp class="h-full" :locale="uiLocale">
20+
<WebProxySurface :request="request" :bridge="bridge" active supported :browsable="request.standalone" />
2321
</UApp>
2422
</template>
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
import { createApp } from "vue";
2+
import { createI18n } from "vue-i18n";
3+
import { normalizeLanguageCode } from "../../../../i18n/language";
24
import ui from "@nuxt/ui/vue-plugin";
35
import App from "./App.vue";
46
import "./style.css";
5-
createApp(App).use(ui).mount("#app");
7+
async function start() {
8+
// Resolve the launch language before mounting so no system-language frame flashes
9+
// when a client launches WebLite with a different language.
10+
const request = await (window as any).webApplet.invoke("bootstrap");
11+
const i18n = createI18n({
12+
legacy: false,
13+
locale: normalizeLanguageCode(request.language || navigator.language),
14+
fallbackLocale: "en"
15+
});
16+
createApp(App, { request }).use(i18n).use(ui).mount("#app");
17+
}
18+
void start();

0 commit comments

Comments
 (0)