@wu529778790/open-im 1.7.1-beta.2 → 1.7.1-beta.3
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/dist/cli.js +7 -0
- package/dist/config-web.d.ts +1 -0
- package/dist/config-web.js +6 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -60,6 +60,13 @@ async function cmdStart() {
|
|
|
60
60
|
console.log("\nopen-im started in the background.");
|
|
61
61
|
console.log(` pid: ${child.pid}`);
|
|
62
62
|
console.log(` config page: ${getWebConfigUrl()}`);
|
|
63
|
+
if (process.env.OPEN_IM_WEB_HOST && process.env.OPEN_IM_WEB_HOST !== "127.0.0.1") {
|
|
64
|
+
console.log("");
|
|
65
|
+
console.log("NOTE:");
|
|
66
|
+
console.log(" The config page is bound to OPEN_IM_WEB_HOST.");
|
|
67
|
+
console.log(" A one-time login URL (with login_token) has been printed by the config-web server logger.");
|
|
68
|
+
console.log(" Please use that URL (replacing 127.0.0.1 with your server IP/hostname) for the first login.");
|
|
69
|
+
}
|
|
63
70
|
}
|
|
64
71
|
async function cmdStop() {
|
|
65
72
|
const status = getManagerStatus();
|
package/dist/config-web.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface StartedWebConfigServer {
|
|
|
5
5
|
close: () => Promise<void>;
|
|
6
6
|
url: string;
|
|
7
7
|
waitForResult: Promise<WebFlowResult>;
|
|
8
|
+
loginUrl?: string;
|
|
8
9
|
}
|
|
9
10
|
export declare function getHealthPlatformSnapshot(file: FileConfig, env?: NodeJS.ProcessEnv): Record<string, {
|
|
10
11
|
configured: boolean;
|
package/dist/config-web.js
CHANGED
|
@@ -830,6 +830,7 @@ export async function startWebConfigServer(options) {
|
|
|
830
830
|
if (timer)
|
|
831
831
|
clearTimeout(timer);
|
|
832
832
|
});
|
|
833
|
+
let loginUrlForReturn;
|
|
833
834
|
// 当绑定到非 127.0.0.1(例如 0.0.0.0)时,为远程访问生成一次性登录链接
|
|
834
835
|
if (host !== "127.0.0.1") {
|
|
835
836
|
const loginTtlMs = 15 * 60 * 1000; // 15 分钟内有效
|
|
@@ -837,6 +838,7 @@ export async function startWebConfigServer(options) {
|
|
|
837
838
|
const displayHost = host === "0.0.0.0" ? "127.0.0.1" : host;
|
|
838
839
|
const baseUrl = `http://${displayHost}:${port}`;
|
|
839
840
|
const loginUrl = `${baseUrl}/?login_token=${encodeURIComponent(loginToken)}`;
|
|
841
|
+
loginUrlForReturn = loginUrl;
|
|
840
842
|
log.info("━━━━━━━━ Web Config Login ━━━━━━━━");
|
|
841
843
|
log.info(`Host binding : ${host}`);
|
|
842
844
|
log.info(`Login URL : ${loginUrl}`);
|
|
@@ -854,13 +856,15 @@ export async function startWebConfigServer(options) {
|
|
|
854
856
|
settle("cancel");
|
|
855
857
|
},
|
|
856
858
|
url: `http://127.0.0.1:${port}`,
|
|
859
|
+
loginUrl: loginUrlForReturn,
|
|
857
860
|
waitForResult,
|
|
858
861
|
};
|
|
859
862
|
}
|
|
860
863
|
export async function runWebConfigFlow(options) {
|
|
861
864
|
const started = await startWebConfigServer(options);
|
|
862
|
-
|
|
863
|
-
|
|
865
|
+
const targetUrl = started.loginUrl ?? started.url;
|
|
866
|
+
openBrowser(targetUrl);
|
|
867
|
+
log.info(`Opened local configuration page: ${targetUrl}`);
|
|
864
868
|
log.info(process.env.OPEN_IM_NO_BROWSER === "1" ? "Browser launch disabled. Open the URL manually." : "Save the configuration in your browser to continue.");
|
|
865
869
|
return started.waitForResult;
|
|
866
870
|
}
|