8000 fix(collector): open the omp credentials database by plain path so Linux SQLite reads it by InfinityPacer · Pull Request #69 · InfinityPacer/meterleaf · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/collector/omp.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createHash } from "node:crypto";
import { closeSync, existsSync, openSync, readSync, statSync } from "node:fs";
import { join } from "node:path";
import { pathToFileURL } from "node:url";
import { Database } from "bun:sqlite";
import type { IngestAccount, IngestUsage } from "../shared/ingest";
import {
Expand Down Expand Up @@ -203,9 +202,8 @@ export function readOmpAgyLabels(path: string): Map<number, string> {
if (!existsSync(path)) return labels;
let db: Database | null = null;
try {
db = new Database(`${pathToFileURL(path).href}?mode=ro`, {
readonly: true,
});
// 用普通路径只读打开:Linux 上的 SQLite 默认不解析 file: URI 参数。
db = new Database(path, { readonly: true });
const rows = db
.query<{ id: number; identity_key: string }, [string]>(
"SELECT id, identity_key FROM auth_credentials WHERE provider = ? AND identity_key LIKE 'email:%'",
Expand Down
Loading
0