From 3e69e1c3c3ac52f5efc2217295237ef9249ec99d Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Tue, 2 Jul 2024 16:07:24 +0200 Subject: [PATCH] Remove local httpd features and experimental features Updates API version to 2.0.0 --- config/custom-environment-variables.json | 5 - config/default.json | 4 +- config/test.json | 1 - http-client/index.ts | 2 + http-client/lib/profile.ts | 11 +- http-client/lib/project/patch.ts | 1 + http-client/lib/shared.ts | 19 +- src/App.svelte | 11 +- src/App/Header.svelte | 76 +-- src/App/Header/Authenticate.svelte | 80 --- src/App/Header/Breadcrumbs.svelte | 6 +- src/App/Header/Breadcrumbs/NodeSegment.svelte | 15 +- .../Header/Breadcrumbs/ProjectSegment.svelte | 2 +- src/App/Header/NodeInfo.svelte | 80 --- src/App/Settings.svelte | 43 -- src/components/Button.svelte | 2 +- src/components/Comment.svelte | 100 +-- src/components/CommentToggleInput.svelte | 61 -- src/components/ConnectInstructions.svelte | 73 --- src/components/ExtendedTextarea.svelte | 254 -------- src/components/ProjectCard.svelte | 10 - src/components/ReactionSelector.svelte | 72 --- src/components/Reactions.svelte | 30 +- src/components/Textarea.svelte | 138 ---- src/components/Thread.svelte | 65 +- src/lib/appearance.ts | 22 - src/lib/file.ts | 52 +- src/lib/httpd.ts | 246 ------- src/lib/projects.ts | 36 -- src/lib/roles.ts | 41 -- src/lib/router.ts | 36 +- src/lib/router/definitions.ts | 21 +- src/lib/utils.ts | 14 +- src/modals/AuthenticatedModal.svelte | 10 - src/modals/AuthenticationErrorModal.svelte | 36 -- src/views/home/Index.svelte | 146 +---- src/views/home/components/FilterButton.svelte | 105 --- .../home/components/NewProjectButton.svelte | 38 -- .../components/PreferredSeedDropdown.svelte | 25 - src/views/home/router.ts | 42 +- src/views/nodes/View.svelte | 31 +- src/views/projects/Cob/AssigneeInput.svelte | 210 ------ src/views/projects/Cob/Assignees.svelte | 68 ++ src/views/projects/Cob/CobStateButton.svelte | 71 --- src/views/projects/Cob/Embeds.svelte | 2 +- src/views/projects/Cob/InlineLabels.svelte | 25 + src/views/projects/Cob/LabelInput.svelte | 181 ------ src/views/projects/Cob/Labels.svelte | 62 +- src/views/projects/Cob/Revision.svelte | 101 +-- src/views/projects/Header/SeedButton.svelte | 153 ----- src/views/projects/Header/ShareButton.svelte | 189 ------ src/views/projects/History.svelte | 3 +- src/views/projects/Issue.svelte | 550 +--------------- src/views/projects/Issue/IssueTeaser.svelte | 11 +- src/views/projects/Issue/New.svelte | 164 ----- src/views/projects/Issues.svelte | 30 +- src/views/projects/Patch.svelte | 603 +----------------- src/views/projects/Patch/PatchTeaser.svelte | 13 +- src/views/projects/Patches.svelte | 42 +- src/views/projects/Share.svelte | 49 +- src/views/projects/Sidebar.svelte | 2 + src/views/projects/Sidebar/ContextRepo.svelte | 7 + src/views/projects/Source.svelte | 3 +- .../projects/Source/ProjectNameHeader.svelte | 6 - src/views/projects/error.ts | 19 +- src/views/projects/router.ts | 71 +-- tests/e2e/landingPage.spec.ts | 8 +- tests/e2e/node.spec.ts | 18 +- tests/e2e/project.spec.ts | 3 - tests/support/fixtures.ts | 69 +- tests/support/globalSetup.ts | 13 +- tests/support/peerManager.ts | 81 +-- tests/unit/router.test.ts | 8 - tests/unit/utils.test.ts | 2 +- 74 files changed, 421 insertions(+), 4478 deletions(-) delete mode 100644 src/App/Header/Authenticate.svelte delete mode 100644 src/App/Header/NodeInfo.svelte delete mode 100644 src/components/CommentToggleInput.svelte delete mode 100644 src/components/ConnectInstructions.svelte delete mode 100644 src/components/ExtendedTextarea.svelte delete mode 100644 src/components/ReactionSelector.svelte delete mode 100644 src/components/Textarea.svelte delete mode 100644 src/lib/httpd.ts delete mode 100644 src/lib/projects.ts delete mode 100644 src/lib/roles.ts delete mode 100644 src/modals/AuthenticatedModal.svelte delete mode 100644 src/modals/AuthenticationErrorModal.svelte delete mode 100644 src/views/home/components/FilterButton.svelte delete mode 100644 src/views/home/components/NewProjectButton.svelte delete mode 100644 src/views/projects/Cob/AssigneeInput.svelte create mode 100644 src/views/projects/Cob/Assignees.svelte delete mode 100644 src/views/projects/Cob/CobStateButton.svelte create mode 100644 src/views/projects/Cob/InlineLabels.svelte delete mode 100644 src/views/projects/Cob/LabelInput.svelte delete mode 100644 src/views/projects/Header/SeedButton.svelte delete mode 100644 src/views/projects/Header/ShareButton.svelte delete mode 100644 src/views/projects/Issue/New.svelte diff --git a/config/custom-environment-variables.json b/config/custom-environment-variables.json index 4076b2e04b..f8590c9f7e 100644 --- a/config/custom-environment-variables.json +++ b/config/custom-environment-variables.json @@ -3,7 +3,6 @@ "fallbackPublicExplorer": "FALLBACK_PUBLIC_EXPLORER", "apiVersion": "API_VERSION", "defaultHttpdPort": "DEFAULT_HTTPD_PORT", - "defaultLocalHttpdPort": "DEFAULT_LOCAL_HTTPD_PORT", "defaultHttpdHostname": "DEFAULT_HTTPD_HOSTNAME", "defaultHttpdScheme": "DEFAULT_HTTPD_SCHEME", "defaultNodePort": "DEFAULT_NODE_PORT", @@ -13,10 +12,6 @@ } }, "supportWebsite": "SUPPORT_WEBSITE", - "reactions": { - "__name": "REACTIONS", - "__format": "json" - }, "fallbackPreferredSeed": { "__name": "FALLBACK_PREFERRED_SEED", "__format": "json" diff --git a/config/default.json b/config/default.json index ce446f0152..b4b07826e3 100644 --- a/config/default.json +++ b/config/default.json @@ -1,9 +1,8 @@ { "nodes": { "fallbackPublicExplorer": "https://app.radicle.xyz/nodes/$host/$rid$path", - "apiVersion": "1.2.0", + "apiVersion": "2.0.0", "defaultHttpdPort": 443, - "defaultLocalHttpdPort": 8080, "defaultHttpdHostname": "seed.radicle.garden", "defaultHttpdScheme": "https", "defaultNodePort": 8776, @@ -18,7 +17,6 @@ ] }, "supportWebsite": "https://radicle.zulipchat.com", - "reactions": ["👍", "👎", "😄", "🎉", "🙁", "🚀", "👀"], "fallbackPreferredSeed": { "hostname": "seed.radicle.garden", "port": 443, diff --git a/config/test.json b/config/test.json index 7e9033abcb..c88f25948d 100644 --- a/config/test.json +++ b/config/test.json @@ -1,7 +1,6 @@ { "nodes": { "defaultHttpdPort": 8081, - "defaultLocalHttpdPort": 8081, "defaultHttpdHostname": "127.0.0.1", "defaultHttpdScheme": "http", "pinned": [ diff --git a/http-client/index.ts b/http-client/index.ts index 87b33c240e..bd83a75c9b 100644 --- a/http-client/index.ts +++ b/http-client/index.ts @@ -9,6 +9,7 @@ import type { TreeStats, } from "./lib/project.js"; import type { + Config, SuccessResponse, CodeLocation, Range, @@ -65,6 +66,7 @@ export type { Commit, CommitBlob, CommitHeader, + Config, DefaultSeedingPolicy, Diff, DiffBlob, diff --git a/http-client/lib/profile.ts b/http-client/lib/profile.ts index 692a130601..43f0776602 100644 --- a/http-client/lib/profile.ts +++ b/http-client/lib/profile.ts @@ -1,16 +1,11 @@ import type { Fetcher, RequestOptions } from "./fetcher.js"; import type { z } from "zod"; -import { array, boolean, object, string } from "zod"; -import { nodeConfigSchema } from "./shared.js"; +import { object, string } from "zod"; +import { configSchema } from "./shared.js"; const profileSchema = object({ - config: object({ - publicExplorer: string(), - preferredSeeds: array(string()), - cli: object({ hints: boolean() }), - node: nodeConfigSchema, - }), + config: configSchema, home: string(), }); diff --git a/http-client/lib/project/patch.ts b/http-client/lib/project/patch.ts index 7f41ddf9b3..faec6206c2 100644 --- a/http-client/lib/project/patch.ts +++ b/http-client/lib/project/patch.ts @@ -50,6 +50,7 @@ export type Verdict = "accept" | "reject"; const reviewSchema = object({ author: authorSchema, + id: string(), verdict: optional(union([literal("accept"), literal("reject")]).nullable()), comments: array(commentSchema), summary: string().nullable(), diff --git a/http-client/lib/shared.ts b/http-client/lib/shared.ts index 3ecd701e9a..a83e723ebb 100644 --- a/http-client/lib/shared.ts +++ b/http-client/lib/shared.ts @@ -1,6 +1,6 @@ import type { ZodSchema, z } from "zod"; -import { array, literal, number, object, string, union } from "zod"; +import { array, boolean, literal, number, object, string, union } from "zod"; export interface SuccessResponse { success: true; @@ -87,6 +87,23 @@ export const nodeConfigSchema = object({ export type DefaultSeedingPolicy = z.infer; +export const configSchema = object({ + publicExplorer: string(), + preferredSeeds: array(string()), + cli: object({ hints: boolean() }), + web: object({ + pinned: object({ + repositories: array(string()), + }), + imageUrl: string().optional(), + name: string().optional(), + description: string().optional(), + }), + node: nodeConfigSchema, +}); + +export type Config = z.infer; + export const rangeSchema = union([ object({ type: literal("lines"), diff --git a/src/App.svelte b/src/App.svelte index 14df38fb72..0859beff50 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -2,7 +2,6 @@ import Plausible from "plausible-tracker"; import * as router from "@app/lib/router"; - import * as httpd from "@app/lib/httpd"; import { unreachable } from "@app/lib/utils"; import { codeFont, theme } from "@app/lib/appearance"; @@ -16,12 +15,10 @@ import Home from "@app/views/home/Index.svelte"; import Issue from "@app/views/projects/Issue.svelte"; import Issues from "@app/views/projects/Issues.svelte"; - import NewIssue from "@app/views/projects/Issue/New.svelte"; import Nodes from "@app/views/nodes/View.svelte"; import NotFound from "@app/views/NotFound.svelte"; import Patch from "@app/views/projects/Patch.svelte"; import Patches from "@app/views/projects/Patches.svelte"; - import Session from "@app/views/session/Index.svelte"; import Source from "@app/views/projects/Source.svelte"; import Error from "@app/views/error/View.svelte"; @@ -29,7 +26,7 @@ const activeRouteStore = router.activeRouteStore; - void httpd.initialize().finally(() => void router.loadFromLocation()); + void router.loadFromLocation(); if (import.meta.env.PROD) { const plausible = Plausible({ domain: "app.radicle.xyz" }); @@ -63,11 +60,9 @@ {:else if $activeRouteStore.resource === "home"} - + {:else if $activeRouteStore.resource === "nodes"} -{:else if $activeRouteStore.resource === "session"} - {:else if $activeRouteStore.resource === "project.source"} {:else if $activeRouteStore.resource === "project.history"} @@ -76,8 +71,6 @@ {:else if $activeRouteStore.resource === "project.issues"} -{:else if $activeRouteStore.resource === "project.newIssue"} - {:else if $activeRouteStore.resource === "project.issue"} {:else if $activeRouteStore.resource === "project.patches"} diff --git a/src/App/Header.svelte b/src/App/Header.svelte index 201d15af72..1831df5da8 100644 --- a/src/App/Header.svelte +++ b/src/App/Header.svelte @@ -1,86 +1,34 @@
-
- - - - -
- -
- {#if $experimental} - {#if $httpdStore.state === "stopped"} - - -
- -
-
- {:else} - - - {/if} - {/if} -
+ + + +
diff --git a/src/App/Header/Authenticate.svelte b/src/App/Header/Authenticate.svelte deleted file mode 100644 index 054973b39e..0000000000 --- a/src/App/Header/Authenticate.svelte +++ /dev/null @@ -1,80 +0,0 @@ - - - - -{#if $httpdStore.state === "authenticated"} - - - -
-
Authenticated as
-
- - { - void httpd.disconnect(); - closeFocused(); - }}> - Disconnect - -
-
-
-{:else} - - -
- -
-
-{/if} diff --git a/src/App/Header/Breadcrumbs.svelte b/src/App/Header/Breadcrumbs.svelte index 64ffccc006..e79596775e 100644 --- a/src/App/Header/Breadcrumbs.svelte +++ b/src/App/Header/Breadcrumbs.svelte @@ -22,13 +22,13 @@ } -{#if $activeRouteStore.resource === "booting" || $activeRouteStore.resource === "home" || $activeRouteStore.resource === "session" || $activeRouteStore.resource === "error" || $activeRouteStore.resource === "notFound"} +{#if $activeRouteStore.resource === "booting" || $activeRouteStore.resource === "home" || $activeRouteStore.resource === "error" || $activeRouteStore.resource === "notFound"} {:else if $activeRouteStore.resource === "nodes"} -{:else if $activeRouteStore.resource === "project.source" || $activeRouteStore.resource === "project.history" || $activeRouteStore.resource === "project.commit" || $activeRouteStore.resource === "project.issues" || $activeRouteStore.resource === "project.newIssue" || $activeRouteStore.resource === "project.issue" || $activeRouteStore.resource === "project.patches" || $activeRouteStore.resource === "project.patch"} +{:else if $activeRouteStore.resource === "project.source" || $activeRouteStore.resource === "project.history" || $activeRouteStore.resource === "project.commit" || $activeRouteStore.resource === "project.issues" || $activeRouteStore.resource === "project.issue" || $activeRouteStore.resource === "project.patches" || $activeRouteStore.resource === "project.patch"}