mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-18 19:30:27 +08:00
Simplify sidebar context boxes
Also starts removing features that relied on the web client handling local httpd instances
This commit is contained in:
@@ -12,6 +12,7 @@ import type {
|
||||
SuccessResponse,
|
||||
CodeLocation,
|
||||
Range,
|
||||
SeedingPolicy,
|
||||
DefaultSeedingPolicy,
|
||||
} from "./lib/shared.js";
|
||||
import type { Comment, Embed, Reaction } from "./lib/project/comment.js";
|
||||
@@ -50,6 +51,7 @@ import { Fetcher } from "./lib/fetcher.js";
|
||||
import {
|
||||
nodeConfigSchema,
|
||||
scopeSchema,
|
||||
seedingPolicySchema,
|
||||
successResponseSchema,
|
||||
} from "./lib/shared.js";
|
||||
|
||||
@@ -85,6 +87,7 @@ export type {
|
||||
Remote,
|
||||
Review,
|
||||
Revision,
|
||||
SeedingPolicy,
|
||||
TreeStats,
|
||||
Tree,
|
||||
Verdict,
|
||||
@@ -211,14 +214,14 @@ export class HttpdClient {
|
||||
public async getPoliciesById(
|
||||
id: string,
|
||||
options?: RequestOptions,
|
||||
): Promise<NodePolicies["policy"][]> {
|
||||
): Promise<SeedingPolicy> {
|
||||
return this.#fetcher.fetchOk(
|
||||
{
|
||||
method: "GET",
|
||||
path: `node/policies/repos/${id}`,
|
||||
options,
|
||||
},
|
||||
array(nodePoliciesSchema.shape.policy),
|
||||
seedingPolicySchema,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,18 @@ export const successResponseSchema = object({
|
||||
|
||||
export const scopeSchema = union([literal("followed"), literal("all")]);
|
||||
|
||||
export const seedingPolicySchema = union([
|
||||
object({
|
||||
policy: literal("block"),
|
||||
}),
|
||||
object({
|
||||
policy: literal("allow"),
|
||||
scope: scopeSchema,
|
||||
}),
|
||||
]);
|
||||
|
||||
export type SeedingPolicy = z.infer<typeof seedingPolicySchema>;
|
||||
|
||||
const defaultSeedingPolicySchema = union([
|
||||
object({
|
||||
default: literal("block"),
|
||||
|
||||
Reference in New Issue
Block a user