feat: brand-new interface (#158)

This was initally generated by ai, but later has been heavily edited.
The reason why it has been implemented is that there are plans to
implement more features to ui, but it becomes hard to add new features
to plain js, so I decided to rewrite it in typescript.

Yet because it is still ai slop, it is still possible to enable old
interface via configuration, even though new interface is turned on by
default to get feedback
This commit is contained in:
2026-03-06 00:59:10 +02:00
committed by GitHub
parent db46147f0d
commit a05eab9042
158 changed files with 5965 additions and 306 deletions

View File

@@ -0,0 +1,88 @@
/*
* Copyright (c) 2021-2026 ahriman team.
*
* This file is part of ahriman
* (see https://github.com/arcan1s/ahriman).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import type { Client } from "api/client/Client";
import type { AURPackage } from "models/AURPackage";
import type { PackageActionRequest } from "models/PackageActionRequest";
import type { PGPKey } from "models/PGPKey";
import type { PGPKeyRequest } from "models/PGPKeyRequest";
import type { RepositoryId } from "models/RepositoryId";
export class ServiceClient {
protected client: Client;
constructor(client: Client) {
this.client = client;
}
async servicePackageAdd(repository: RepositoryId, data: PackageActionRequest): Promise<void> {
return this.client.request("/api/v1/service/add", { method: "POST", query: repository.toQuery(), json: data });
}
async servicePackagePatchRemove(packageBase: string, key: string): Promise<void> {
return this.client.request(`/api/v1/packages/${encodeURIComponent(packageBase)}/patches/${encodeURIComponent(key)}`, {
method: "DELETE",
});
}
async servicePackageRemove(repository: RepositoryId, packages: string[]): Promise<void> {
return this.client.request("/api/v1/service/remove", {
method: "POST",
query: repository.toQuery(),
json: { packages },
});
}
async servicePackageRequest(repository: RepositoryId, data: PackageActionRequest): Promise<void> {
return this.client.request("/api/v1/service/request", {
method: "POST",
query: repository.toQuery(),
json: data,
});
}
async servicePackageSearch(query: string): Promise<AURPackage[]> {
return this.client.request<AURPackage[]>("/api/v1/service/search", { query: { for: query } });
}
async servicePackageUpdate(repository: RepositoryId, data: PackageActionRequest): Promise<void> {
return this.client.request("/api/v1/service/update", {
method: "POST",
query: repository.toQuery(),
json: data,
});
}
async servicePGPFetch(key: string, server: string): Promise<PGPKey> {
return this.client.request<PGPKey>("/api/v1/service/pgp", { query: { key, server } });
}
async servicePGPImport(data: PGPKeyRequest): Promise<void> {
return this.client.request("/api/v1/service/pgp", { method: "POST", json: data });
}
async serviceRebuild(repository: RepositoryId, packages: string[]): Promise<void> {
return this.client.request("/api/v1/service/rebuild", {
method: "POST",
query: repository.toQuery(),
json: { packages },
});
}
}