Skip to content

Commit

Permalink
Remove local httpd features and experimental features
Browse files Browse the repository at this point in the history
Updates API version to 2.0.0
  • Loading branch information
sebastinez committed Jul 3, 2024
1 parent 7c24876 commit eee594c
Show file tree
Hide file tree
Showing 73 changed files with 420 additions and 4,477 deletions.
5 changes: 0 additions & 5 deletions config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -13,10 +12,6 @@
}
},
"supportWebsite": "SUPPORT_WEBSITE",
"reactions": {
"__name": "REACTIONS",
"__format": "json"
},
"fallbackPreferredSeed": {
"__name": "FALLBACK_PREFERRED_SEED",
"__format": "json"
Expand Down
4 changes: 1 addition & 3 deletions config/default.json
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -18,7 +17,6 @@
]
},
"supportWebsite": "https://radicle.zulipchat.com",
"reactions": ["👍", "👎", "😄", "🎉", "🙁", "🚀", "👀"],
"fallbackPreferredSeed": {
"hostname": "seed.radicle.garden",
"port": 443,
Expand Down
1 change: 0 additions & 1 deletion config/test.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"nodes": {
"defaultHttpdPort": 8081,
"defaultLocalHttpdPort": 8081,
"defaultHttpdHostname": "127.0.0.1",
"defaultHttpdScheme": "http",
"pinned": [
Expand Down
2 changes: 2 additions & 0 deletions http-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {
TreeStats,
} from "./lib/project.js";
import type {
Config,
SuccessResponse,
CodeLocation,
Range,
Expand Down Expand Up @@ -65,6 +66,7 @@ export type {
Commit,
CommitBlob,
CommitHeader,
Config,
DefaultSeedingPolicy,
Diff,
DiffBlob,
Expand Down
11 changes: 3 additions & 8 deletions http-client/lib/profile.ts
Original file line number Diff line number Diff line change
@@ -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(),
});

Expand Down
1 change: 1 addition & 0 deletions http-client/lib/project/patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
19 changes: 18 additions & 1 deletion http-client/lib/shared.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -87,6 +87,23 @@ export const nodeConfigSchema = object({

export type DefaultSeedingPolicy = z.infer<typeof defaultSeedingPolicySchema>;

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<typeof configSchema>;

export const rangeSchema = union([
object({
type: literal("lines"),
Expand Down
11 changes: 2 additions & 9 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -16,20 +15,18 @@
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";
import Loading from "@app/components/Loading.svelte";
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" });
Expand Down Expand Up @@ -63,11 +60,9 @@
<Loading />
</div>
{:else if $activeRouteStore.resource === "home"}
<Home {...$activeRouteStore.params} />
<Home />
{:else if $activeRouteStore.resource === "nodes"}
<Nodes {...$activeRouteStore.params} />
{:else if $activeRouteStore.resource === "session"}
<Session activeRoute={$activeRouteStore} />
{:else if $activeRouteStore.resource === "project.source"}
<Source {...$activeRouteStore.params} />
{:else if $activeRouteStore.resource === "project.history"}
Expand All @@ -76,8 +71,6 @@
<Commit {...$activeRouteStore.params} />
{:else if $activeRouteStore.resource === "project.issues"}
<Issues {...$activeRouteStore.params} />
{:else if $activeRouteStore.resource === "project.newIssue"}
<NewIssue {...$activeRouteStore.params} />
{:else if $activeRouteStore.resource === "project.issue"}
<Issue {...$activeRouteStore.params} />
{:else if $activeRouteStore.resource === "project.patches"}
Expand Down
76 changes: 12 additions & 64 deletions src/App/Header.svelte
Original file line number Diff line number Diff line change
@@ -1,86 +1,34 @@
<script lang="ts">
import type { HttpdState } from "@app/lib/httpd";
import { httpdStore } from "@app/lib/httpd";
import Authenticate from "./Header/Authenticate.svelte";
import Breadcrumbs from "./Header/Breadcrumbs.svelte";
import Button from "@app/components/Button.svelte";
import IconSmall from "@app/components/IconSmall.svelte";
import Link from "@app/components/Link.svelte";
import NodeInfo from "@app/App/Header/NodeInfo.svelte";
import Popover from "@app/components/Popover.svelte";
import ConnectInstructions from "@app/components/ConnectInstructions.svelte";
import { experimental } from "@app/lib/appearance";
const buttonTitle: Record<HttpdState["state"], string> = {
stopped: "radicle-httpd is stopped",
running: "radicle-httpd is running",
authenticated: "radicle-httpd is running - signed in",
};
</script>

<style>
header {
display: flex;
justify-content: space-between;
align-items: center;
gap: 0.5rem;
margin: 0;
padding: 0.5rem 1rem;
height: 3.5rem;
}
.left,
.right {
display: flex;
align-items: center;
gap: 0.5rem;
}
.logo {
height: var(--button-regular-height);
margin: 0 0.5rem;
}
.connect-popover {
max-width: 20rem;
}
</style>

<header>
<div class="left">
<Link
style="display: flex; align-items: center;"
route={{ resource: "home" }}>
<img
width="24"
height="24"
class="logo"
alt="Radicle logo"
src="/radicle.svg" />
</Link>
<Breadcrumbs />
</div>

<div class="right">
{#if $experimental}
{#if $httpdStore.state === "stopped"}
<Popover popoverPositionTop="2.5rem" popoverPositionRight="0">
<Button
slot="toggle"
let:toggle
on:click={toggle}
title={buttonTitle[$httpdStore.state]}
variant="naked-toggle">
<IconSmall name="device" />
Connect
</Button>
<div slot="popover" class="connect-popover">
<ConnectInstructions />
</div>
</Popover>
{:else}
<NodeInfo node={$httpdStore.node} />
<Authenticate />
{/if}
{/if}
</div>
<Link
style="display: flex; align-items: center;"
route={{ resource: "home" }}>
<img
width="24"
height="24"
class="logo"
alt="Radicle logo"
src="/radicle.svg" />
</Link>
<Breadcrumbs />
</header>
80 changes: 0 additions & 80 deletions src/App/Header/Authenticate.svelte

This file was deleted.

6 changes: 3 additions & 3 deletions src/App/Header/Breadcrumbs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
}
</style>

{#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"}
<!-- Don't render breadcrumbs for these routes. -->
{:else if $activeRouteStore.resource === "nodes"}
<div class="breadcrumbs">
<NodeSegment baseUrl={$activeRouteStore.params.baseUrl} showLocalNode />
<NodeSegment baseUrl={$activeRouteStore.params.baseUrl} />
</div>
{: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"}
<div class="breadcrumbs">
<NodeSegment baseUrl={$activeRouteStore.params.baseUrl} />

Expand Down
Loading

0 comments on commit eee594c

Please sign in to comment.