@cloud411716/fancy-webnovel 4.13.0 → 4.13.1
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/lib/material-db.js +8 -4
- package/package.json +1 -1
package/lib/material-db.js
CHANGED
|
@@ -42,12 +42,16 @@ export async function connectMaterial(root) {
|
|
|
42
42
|
await startServer(root);
|
|
43
43
|
const workspace = readWorkspace(root);
|
|
44
44
|
const secrets = readSecrets(root);
|
|
45
|
-
const
|
|
46
|
-
await db.connect(rpcUrl(workspace));
|
|
47
|
-
await db.signin({
|
|
45
|
+
const authentication = {
|
|
48
46
|
username: secrets.surreal?.username || 'root',
|
|
49
47
|
password: secrets.surreal?.password,
|
|
50
|
-
}
|
|
48
|
+
};
|
|
49
|
+
const db = new Surreal({ engines: { ...createRemoteEngines() } });
|
|
50
|
+
// Pass credentials as the connection auth provider, not as a one-off signin.
|
|
51
|
+
// SurrealDB tokens have a one-hour TTL; a job-store connection kept open
|
|
52
|
+
// across a long douyin crawl must be renewed automatically or later writes
|
|
53
|
+
// fail with "IAM error: Not enough permissions".
|
|
54
|
+
await db.connect(rpcUrl(workspace), { authentication });
|
|
51
55
|
const namespace = workspace.surreal?.namespace || 'fancy';
|
|
52
56
|
const database = materialDatabaseName(workspace);
|
|
53
57
|
await db.use({ namespace, database });
|