mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 19:01:47 +03:00
chore: Lint extensions folder.
This commit is contained in:
@@ -36,7 +36,9 @@ export async function fetchBlueBubblesServerInfo(params: {
|
||||
}): Promise<BlueBubblesServerInfo | null> {
|
||||
const baseUrl = params.baseUrl?.trim();
|
||||
const password = params.password?.trim();
|
||||
if (!baseUrl || !password) return null;
|
||||
if (!baseUrl || !password) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const cacheKey = buildCacheKey(params.accountId);
|
||||
const cached = serverInfoCache.get(cacheKey);
|
||||
@@ -47,7 +49,9 @@ export async function fetchBlueBubblesServerInfo(params: {
|
||||
const url = buildBlueBubblesApiUrl({ baseUrl, path: "/api/v1/server/info", password });
|
||||
try {
|
||||
const res = await blueBubblesFetchWithTimeout(url, { method: "GET" }, params.timeoutMs ?? 5000);
|
||||
if (!res.ok) return null;
|
||||
if (!res.ok) {
|
||||
return null;
|
||||
}
|
||||
const payload = (await res.json().catch(() => null)) as Record<string, unknown> | null;
|
||||
const data = payload?.data as BlueBubblesServerInfo | undefined;
|
||||
if (data) {
|
||||
@@ -76,7 +80,9 @@ export function getCachedBlueBubblesServerInfo(accountId?: string): BlueBubblesS
|
||||
* Parse macOS version string (e.g., "15.0.1" or "26.0") into major version number.
|
||||
*/
|
||||
export function parseMacOSMajorVersion(version?: string | null): number | null {
|
||||
if (!version) return null;
|
||||
if (!version) {
|
||||
return null;
|
||||
}
|
||||
const match = /^(\d+)/.exec(version.trim());
|
||||
return match ? Number.parseInt(match[1], 10) : null;
|
||||
}
|
||||
@@ -87,7 +93,9 @@ export function parseMacOSMajorVersion(version?: string | null): number | null {
|
||||
*/
|
||||
export function isMacOS26OrHigher(accountId?: string): boolean {
|
||||
const info = getCachedBlueBubblesServerInfo(accountId);
|
||||
if (!info?.os_version) return false;
|
||||
if (!info?.os_version) {
|
||||
return false;
|
||||
}
|
||||
const major = parseMacOSMajorVersion(info.os_version);
|
||||
return major !== null && major >= 26;
|
||||
}
|
||||
@@ -104,8 +112,12 @@ export async function probeBlueBubbles(params: {
|
||||
}): Promise<BlueBubblesProbe> {
|
||||
const baseUrl = params.baseUrl?.trim();
|
||||
const password = params.password?.trim();
|
||||
if (!baseUrl) return { ok: false, error: "serverUrl not configured" };
|
||||
if (!password) return { ok: false, error: "password not configured" };
|
||||
if (!baseUrl) {
|
||||
return { ok: false, error: "serverUrl not configured" };
|
||||
}
|
||||
if (!password) {
|
||||
return { ok: false, error: "password not configured" };
|
||||
}
|
||||
const url = buildBlueBubblesApiUrl({ baseUrl, path: "/api/v1/ping", password });
|
||||
try {
|
||||
const res = await blueBubblesFetchWithTimeout(url, { method: "GET" }, params.timeoutMs);
|
||||
|
||||
Reference in New Issue
Block a user