mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 09:47:40 +00:00
chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -44,16 +44,12 @@ export function createBrowserProfilesService(ctx: BrowserRouteContext) {
|
||||
return await ctx.listProfiles();
|
||||
};
|
||||
|
||||
const createProfile = async (
|
||||
params: CreateProfileParams,
|
||||
): Promise<CreateProfileResult> => {
|
||||
const createProfile = async (params: CreateProfileParams): Promise<CreateProfileResult> => {
|
||||
const name = params.name.trim();
|
||||
const rawCdpUrl = params.cdpUrl?.trim() || undefined;
|
||||
|
||||
if (!isValidProfileName(name)) {
|
||||
throw new Error(
|
||||
"invalid profile name: use lowercase letters, numbers, and hyphens only",
|
||||
);
|
||||
throw new Error("invalid profile name: use lowercase letters, numbers, and hyphens only");
|
||||
}
|
||||
|
||||
const state = ctx.state();
|
||||
@@ -70,9 +66,7 @@ export function createBrowserProfilesService(ctx: BrowserRouteContext) {
|
||||
|
||||
const usedColors = getUsedColors(resolvedProfiles);
|
||||
const profileColor =
|
||||
params.color && HEX_COLOR_RE.test(params.color)
|
||||
? params.color
|
||||
: allocateColor(usedColors);
|
||||
params.color && HEX_COLOR_RE.test(params.color) ? params.color : allocateColor(usedColors);
|
||||
|
||||
let profileConfig: BrowserProfileConfig;
|
||||
if (rawCdpUrl) {
|
||||
@@ -80,9 +74,7 @@ export function createBrowserProfilesService(ctx: BrowserRouteContext) {
|
||||
profileConfig = { cdpUrl: parsed.normalized, color: profileColor };
|
||||
} else {
|
||||
const usedPorts = getUsedPorts(resolvedProfiles);
|
||||
const range = deriveDefaultBrowserCdpPortRange(
|
||||
state.resolved.controlPort,
|
||||
);
|
||||
const range = deriveDefaultBrowserCdpPortRange(state.resolved.controlPort);
|
||||
const cdpPort = allocateCdpPort(usedPorts, range);
|
||||
if (cdpPort === null) {
|
||||
throw new Error("no available CDP ports in range");
|
||||
@@ -119,9 +111,7 @@ export function createBrowserProfilesService(ctx: BrowserRouteContext) {
|
||||
};
|
||||
};
|
||||
|
||||
const deleteProfile = async (
|
||||
nameRaw: string,
|
||||
): Promise<DeleteProfileResult> => {
|
||||
const deleteProfile = async (nameRaw: string): Promise<DeleteProfileResult> => {
|
||||
const name = nameRaw.trim();
|
||||
if (!name) throw new Error("profile name is required");
|
||||
if (!isValidProfileName(name)) {
|
||||
|
||||
Reference in New Issue
Block a user