refactor(api): unify routes under /api/v1/d, agent, relay, tunnel

Remove the /openflare prefix from management APIs (/api/v1/d/*) and move
Agent, Relay, and Tunnel protocol endpoints under /api/v1. Update Wavelet
frontend services and node client binaries to match.
This commit is contained in:
ryan
2026-06-19 11:08:06 +08:00
parent 6bd7dc91fc
commit 71ebfa555f
48 changed files with 18463 additions and 21924 deletions
@@ -26,7 +26,7 @@ function buildSearchParams(filters: object): Record<string, unknown> {
}
export class AccessLogService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/access-logs';
protected static override readonly basePath: string = '/api/v1/d/access-logs';
static list(filters: AccessLogFilters = {}): Promise<AccessLogList> {
return this.get<AccessLogList>('/', buildSearchParams(filters));
@@ -7,7 +7,7 @@ import type {
} from './types';
export class ApplyLogService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/apply-logs';
protected static override readonly basePath: string = '/api/v1/d/apply-logs';
static list(query: ApplyLogListQuery = {}): Promise<ApplyLogList> {
const params: Record<string, unknown> = {};
@@ -1,5 +1,5 @@
import {BaseService} from '@/lib/services/core';
export class OpenFlareBaseService extends BaseService {
protected static override readonly basePath: string = '/api/v1/openflare';
protected static override readonly basePath: string = '/api/v1/d';
}
@@ -11,7 +11,7 @@ import type {
} from './types';
export class ConfigVersionService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/config-versions';
protected static override readonly basePath: string = '/api/v1/d/config-versions';
static list(): Promise<ConfigVersionSummary[]> {
return this.get<ConfigVersionSummary[]>('/');
@@ -231,7 +231,7 @@ function normalizeDashboardOverview(
}
export class DashboardService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/dashboard';
protected static override readonly basePath: string = '/api/v1/d/dashboard';
static async getOverview(): Promise<DashboardOverview | null> {
const overview = await this.get<
@@ -2,7 +2,7 @@ import {OpenFlareBaseService} from './base.service';
import type {DnsAccountItem, DnsAccountMutationPayload} from './types';
export class DnsAccountService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/dns-accounts';
protected static override readonly basePath: string = '/api/v1/d/dns-accounts';
static async list(): Promise<DnsAccountItem[]> {
return this.get<DnsAccountItem[]>('/');
@@ -10,7 +10,7 @@ import type {
} from './types';
export class NodeService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/nodes';
protected static override readonly basePath: string = '/api/v1/d/nodes';
static async listNodes(): Promise<NodeItem[]> {
return this.get<NodeItem[]>('/');
@@ -8,7 +8,7 @@ import type {
} from './types';
export class OptionService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/option';
protected static override readonly basePath: string = '/api/v1/d/option';
static list(): Promise<OptionItem[]> {
return this.get<OptionItem[]>('/');
@@ -2,7 +2,7 @@ import {OpenFlareBaseService} from './base.service';
import type {OriginDetail, OriginItem, OriginMutationPayload} from './types';
export class OriginService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/origins';
protected static override readonly basePath: string = '/api/v1/d/origins';
static list(): Promise<OriginItem[]> {
return this.get<OriginItem[]>('/');
@@ -13,7 +13,7 @@ import type {
} from './types';
export class PagesService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/pages';
protected static override readonly basePath: string = '/api/v1/d/pages';
static listProjects(): Promise<PagesProject[]> {
return this.get<PagesProject[]>('/');
@@ -2,7 +2,7 @@ import {OpenFlareBaseService} from './base.service';
import type {ProxyRouteItem, ProxyRouteMutationPayload} from './types';
export class ProxyRouteService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/proxy-routes';
protected static override readonly basePath: string = '/api/v1/d/proxy-routes';
static async list(): Promise<ProxyRouteItem[]> {
return this.get<ProxyRouteItem[]>('/');
@@ -10,7 +10,7 @@ import type {
} from './types';
class AcmeAccountApi extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/acme-accounts';
protected static override readonly basePath: string = '/api/v1/d/acme-accounts';
static getDefault(): Promise<AcmeAccountItem> {
return this.get<AcmeAccountItem>('/default');
@@ -18,7 +18,7 @@ class AcmeAccountApi extends OpenFlareBaseService {
}
export class TlsCertificateService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/tls-certificates';
protected static override readonly basePath: string = '/api/v1/d/tls-certificates';
static async list(): Promise<TlsCertificateItem[]> {
return this.get<TlsCertificateItem[]>('/');
@@ -8,10 +8,10 @@ import {OpenFlareBaseService} from './base.service';
import type {LatestReleaseInfo, ReleaseChannel, UpgradeStreamSnapshot, UploadedServerBinaryInfo} from './types';
/**
* OpenFlare 服务端升级 API(`/api/v1/openflare/update/*`)。
* OpenFlare 服务端升级 API(`/api/v1/d/update/*`)。
*/
export class UpdateService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/update';
protected static override readonly basePath: string = '/api/v1/d/update';
private static getApiUrl(path: string): string {
const baseURL = getApiBaseUrl();
@@ -1,7 +1,7 @@
import {OpenFlareBaseService} from './base.service';
export class UptimeKumaService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/uptimekuma';
protected static override readonly basePath: string = '/api/v1/d/uptimekuma';
static sync(): Promise<void> {
return this.post<void>('/sync');
@@ -11,7 +11,7 @@ import type {
} from './types';
export class WafService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/waf';
protected static override readonly basePath: string = '/api/v1/d/waf';
static async listRuleGroups(): Promise<WAFRuleGroup[]> {
return this.get<WAFRuleGroup[]>('/rule-groups');
@@ -6,7 +6,7 @@ import type {
} from './types';
export class WebsiteService extends OpenFlareBaseService {
protected static override readonly basePath: string = '/api/v1/openflare/managed-domains';
protected static override readonly basePath: string = '/api/v1/d/managed-domains';
static async list(): Promise<ManagedDomainItem[]> {
return this.get<ManagedDomainItem[]>('/');