收口 Rust Web 入口与 AI 写入链
- 将 3000 主入口继续收口到 mnote-web,补齐 /favicon.ico、/api/auth、session alias、AI run 等 Rust Web 路由边界。 - 更新登录页与 Convex Auth 代理,支持测试账号快速登录写入真实 Convex Auth cookie。 - 推进页面设置、Wolai 对齐、Phase 7 AI kernel/CLI-first 设计文档与相关 smoke 脚本。 - 更新 leptos-tiptap 生成资产、mnote-cli/bridge-runtime、前端依赖和 dev/prod 启动脚本。
This commit is contained in:
@@ -15,6 +15,21 @@
|
||||
const http = require("http");
|
||||
const net = require("net");
|
||||
const path = require("path");
|
||||
|
||||
// 说明:Next 当前 vendored 的 browserslist/baseline 提示会在进程启动早期输出,
|
||||
// 即使项目侧依赖已经升级也未必消失。这里默认静音这类“当前不可操作”的噪音;
|
||||
// 如需排查真实数据新鲜度,可在启动前显式传入 `false` 恢复原始警告。
|
||||
if (process.env.BROWSERSLIST_IGNORE_OLD_DATA === "false") {
|
||||
delete process.env.BROWSERSLIST_IGNORE_OLD_DATA;
|
||||
} else if (process.env.BROWSERSLIST_IGNORE_OLD_DATA === undefined) {
|
||||
process.env.BROWSERSLIST_IGNORE_OLD_DATA = "true";
|
||||
}
|
||||
if (process.env.BASELINE_BROWSER_MAPPING_IGNORE_OLD_DATA === "false") {
|
||||
delete process.env.BASELINE_BROWSER_MAPPING_IGNORE_OLD_DATA;
|
||||
} else if (process.env.BASELINE_BROWSER_MAPPING_IGNORE_OLD_DATA === undefined) {
|
||||
process.env.BASELINE_BROWSER_MAPPING_IGNORE_OLD_DATA = "true";
|
||||
}
|
||||
|
||||
const next = require("next");
|
||||
const { parse: parseUrl } = require("url");
|
||||
const { buildTreeShellRuntime } = require("./build-tree-shell-runtime");
|
||||
|
||||
@@ -13,11 +13,26 @@
|
||||
* - CONVEX_INTERNAL_URL:默认 http://127.0.0.1:3210
|
||||
*/
|
||||
|
||||
const http = require("http");
|
||||
const net = require("net");
|
||||
const path = require("path");
|
||||
const next = require("next");
|
||||
const { parse: parseUrl } = require("url");
|
||||
const http = require("http");
|
||||
const net = require("net");
|
||||
const path = require("path");
|
||||
|
||||
// 说明:Next 当前 vendored 的 browserslist/baseline 提示会在进程启动早期输出,
|
||||
// 即使项目侧依赖已经升级也未必消失。这里默认静音这类“当前不可操作”的噪音;
|
||||
// 如需排查真实数据新鲜度,可在启动前显式传入 `false` 恢复原始警告。
|
||||
if (process.env.BROWSERSLIST_IGNORE_OLD_DATA === "false") {
|
||||
delete process.env.BROWSERSLIST_IGNORE_OLD_DATA;
|
||||
} else if (process.env.BROWSERSLIST_IGNORE_OLD_DATA === undefined) {
|
||||
process.env.BROWSERSLIST_IGNORE_OLD_DATA = "true";
|
||||
}
|
||||
if (process.env.BASELINE_BROWSER_MAPPING_IGNORE_OLD_DATA === "false") {
|
||||
delete process.env.BASELINE_BROWSER_MAPPING_IGNORE_OLD_DATA;
|
||||
} else if (process.env.BASELINE_BROWSER_MAPPING_IGNORE_OLD_DATA === undefined) {
|
||||
process.env.BASELINE_BROWSER_MAPPING_IGNORE_OLD_DATA = "true";
|
||||
}
|
||||
|
||||
const next = require("next");
|
||||
const { parse: parseUrl } = require("url");
|
||||
|
||||
const ONLYOFFICE_PREFIX = "/onlyoffice-server";
|
||||
const CONVEX_PREFIX = "/convex";
|
||||
|
||||
@@ -5,53 +5,64 @@
|
||||
* 运行:node scripts/register-test-user.js
|
||||
*/
|
||||
|
||||
const TEST_CREDENTIALS = {
|
||||
email: "test@example.com",
|
||||
password: "Test123456",
|
||||
name: "测试用户",
|
||||
};
|
||||
const TEST_CREDENTIALS = {
|
||||
email: "mnote.e2e@example.com",
|
||||
password: "MnoteE2E123!",
|
||||
name: "mnote-e2e",
|
||||
};
|
||||
|
||||
async function registerTestUser() {
|
||||
const baseUrl = "http://localhost:3000";
|
||||
|
||||
console.log("正在注册测试账号...");
|
||||
console.log(`邮箱: ${TEST_CREDENTIALS.email}`);
|
||||
console.log(`密码: ${TEST_CREDENTIALS.password}`);
|
||||
|
||||
try {
|
||||
const response = await fetch(`${baseUrl}/api/auth/signin`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email: TEST_CREDENTIALS.email,
|
||||
password: TEST_CREDENTIALS.password,
|
||||
name: TEST_CREDENTIALS.name,
|
||||
flow: "signUp",
|
||||
}),
|
||||
});
|
||||
console.log(`密码: ${TEST_CREDENTIALS.password}`);
|
||||
|
||||
try {
|
||||
const response = await fetch(`${baseUrl}/api/auth`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
action: "auth:signIn",
|
||||
args: {
|
||||
provider: "password",
|
||||
params: {
|
||||
email: TEST_CREDENTIALS.email,
|
||||
password: TEST_CREDENTIALS.password,
|
||||
name: TEST_CREDENTIALS.name,
|
||||
flow: "signUp",
|
||||
},
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (response.ok) {
|
||||
console.log("✓ 测试账号注册成功!");
|
||||
console.log(`\n您现在可以使用以下凭据登录:`);
|
||||
console.log(` 邮箱: ${TEST_CREDENTIALS.email}`);
|
||||
console.log(` 密码: ${TEST_CREDENTIALS.password}`);
|
||||
console.log(`\n或在登录页面点击"测试账号快速登录"按钮。`);
|
||||
} else if (response.status === 501) {
|
||||
console.log("ℹ API 路由暂未实现,请通过浏览器手动注册:");
|
||||
console.log(` 1. 访问 http://localhost:3000/auth`);
|
||||
console.log(` 2. 点击"还没有账户?立即注册"`);
|
||||
console.log(` 3. 填写:`);
|
||||
console.log(` 邮箱: ${TEST_CREDENTIALS.email}`);
|
||||
console.log(` 密码: ${TEST_CREDENTIALS.password}`);
|
||||
console.log(` 姓名: ${TEST_CREDENTIALS.name}`);
|
||||
} else {
|
||||
console.error("✗ 注册失败:", result.error || result.message);
|
||||
}
|
||||
} catch (error) {
|
||||
if (response.ok) {
|
||||
console.log("✓ 测试账号注册成功!");
|
||||
console.log(`\n您现在可以使用以下凭据登录:`);
|
||||
console.log(` 邮箱: ${TEST_CREDENTIALS.email}`);
|
||||
console.log(` 密码: ${TEST_CREDENTIALS.password}`);
|
||||
console.log(`\n或在登录页面点击"测试账号快速登录"按钮。`);
|
||||
} else {
|
||||
const message = result?.error || result?.message || "";
|
||||
if (/already exists|已存在|已被使用|已被占用/i.test(message)) {
|
||||
console.log("ℹ 测试账号已存在,可直接使用:");
|
||||
console.log(` 邮箱: ${TEST_CREDENTIALS.email}`);
|
||||
console.log(` 密码: ${TEST_CREDENTIALS.password}`);
|
||||
return;
|
||||
}
|
||||
console.log("ℹ 自动注册失败,请通过浏览器手动注册:");
|
||||
console.log(` 1. 访问 http://localhost:3000/auth`);
|
||||
console.log(` 2. 点击"测试账号快速登录"或"还没有账户?立即注册"`);
|
||||
console.log(` 3. 填写:`);
|
||||
console.log(` 邮箱: ${TEST_CREDENTIALS.email}`);
|
||||
console.log(` 密码: ${TEST_CREDENTIALS.password}`);
|
||||
console.log(` 姓名: ${TEST_CREDENTIALS.name}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("✗ 请求失败:", error.message);
|
||||
console.log("\n请确保开发服务器正在运行 (pnpm dev)");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user