Complete removal of http and protocol from public

This commit is contained in:
Owen
2026-05-27 17:19:04 -07:00
parent 6d491b7bb9
commit 0ff0e83c9f
24 changed files with 169 additions and 131 deletions

View File

@@ -146,7 +146,7 @@ function MaintenanceSectionForm({
}
}
if (!resource.http) {
if (!["http", "ssh", "rdp", "vnc"].includes(resource.mode)) {
return null;
}
@@ -176,7 +176,9 @@ function MaintenanceSectionForm({
render={({ field }) => {
const isDisabled =
!isPaidUser(tierMatrix.maintencePage) ||
resource.http === false;
!["http", "ssh", "rdp", "vnc"].includes(
resource.mode
);
return (
<FormItem>
@@ -462,14 +464,14 @@ export default function GeneralForm() {
.refine(
(data) => {
// For non-HTTP resources, proxyPort should be defined
if (!resource.http) {
if (!["http", "ssh", "rdp", "vnc"].includes(resource.mode)) {
return data.proxyPort !== undefined;
}
// For HTTP resources, proxyPort should be undefined
return data.proxyPort === undefined;
},
{
message: !resource.http
message: !["http", "ssh", "rdp", "vnc"].includes(resource.mode)
? "Port number is required for non-HTTP resources"
: "Port number should not be set for HTTP resources",
path: ["proxyPort"]
@@ -623,7 +625,9 @@ export default function GeneralForm() {
/>
</div>
{!resource.http && (
{!["http", "ssh", "rdp", "vnc"].includes(
resource.mode
) && (
<>
<FormField
control={form.control}
@@ -672,7 +676,9 @@ export default function GeneralForm() {
</>
)}
{resource.http && (
{["http", "ssh", "rdp", "vnc"].includes(
resource.mode
) && (
<div className="space-y-4">
<div id="resource-domain-picker">
<DomainPicker

View File

@@ -130,20 +130,20 @@ export default function ReverseProxyTargetsPage(props: {
<SettingsContainer>
<ProxyResourceTargetsForm
orgId={params.orgId}
isHttp={resource.http}
isHttp={["http", "ssh", "rdp", "vnc"].includes(resource.mode)}
initialTargets={remoteTargets}
resource={resource}
updateResource={updateResource}
/>
{resource.http && (
{["http", "ssh", "rdp", "vnc"].includes(resource.mode) && (
<ProxyResourceHttpForm
resource={resource}
updateResource={updateResource}
/>
)}
{!resource.http && resource.protocol == "tcp" && (
{resource.mode == "tcp" && (
<ProxyResourceProtocolForm
resource={resource}
updateResource={updateResource}

View File

@@ -91,7 +91,7 @@ export default async function ResourceLayout(props: ResourceLayoutProps) {
}
];
if (resource.http) {
if (["http", "ssh", "rdp", "vnc"].includes(resource.mode)) {
navItems.push({
title: t("authentication"),
href: `/{orgId}/settings/resources/proxy/{niceId}/authentication`

View File

@@ -149,7 +149,7 @@ export default function ResourceRules(props: {
resolver: zodResolver(addRuleSchema),
defaultValues: {
action: "ACCEPT",
match: resource.http && resource.mode == "http" ? "PATH" : "IP",
match: resource.mode == "http" ? "PATH" : "IP",
value: ""
}
});
@@ -577,7 +577,7 @@ export default function ResourceRules(props: {
<SelectValue />
</SelectTrigger>
<SelectContent>
{resource.http && resource.mode == "http" && (
{resource.mode == "http" && (
<SelectItem value="PATH">
{RuleMatch.PATH}
</SelectItem>
@@ -1037,15 +1037,14 @@ export default function ResourceRules(props: {
<SelectValue />
</SelectTrigger>
<SelectContent>
{resource.http &&
resource.mode ==
"http" && (
<SelectItem value="PATH">
{
RuleMatch.PATH
}
</SelectItem>
)}
{resource.mode ==
"http" && (
<SelectItem value="PATH">
{
RuleMatch.PATH
}
</SelectItem>
)}
<SelectItem value="IP">
{RuleMatch.IP}
</SelectItem>

View File

@@ -108,11 +108,11 @@ export default async function ProxyResourcesPage(
orgId: params.orgId,
nice: resource.niceId,
domain: `${resource.ssl ? "https://" : "http://"}${toUnicode(resource.fullDomain || "")}`,
protocol: resource.protocol,
proxyPort: resource.proxyPort,
http: resource.http,
labels: resource.labels,
authState: !resource.http
authState: !["http", "ssh", "rdp", "vnc"].includes(
resource.mode || ""
)
? "none"
: resource.sso ||
resource.pincodeId !== null ||

View File

@@ -49,7 +49,7 @@ type Resource = {
domain: string;
enabled: boolean;
protected: boolean;
protocol: string;
mode: string; // "http", "tcp", "udp", "rdp", "vnc", "ssh"
// Auth method fields
sso?: boolean;
password?: boolean;
@@ -64,7 +64,6 @@ type SiteResource = {
name: string;
destination: string;
mode: string;
protocol: string | null;
ssl: boolean;
fullDomain: string | null;
enabled: boolean;
@@ -882,21 +881,6 @@ export default function MemberResourcesPortal({
}
</span>
</div>
{siteResource.protocol && (
<div>
<span className="font-medium">
{t(
"protocol"
)}
:
</span>
<span className="ml-2 text-muted-foreground uppercase">
{
siteResource.protocol
}
</span>
</div>
)}
<div>
<span className="font-medium">
{t(
@@ -954,7 +938,7 @@ export default function MemberResourcesPortal({
siteResource.fullDomain ? (
/* HTTP mode - show as clickable link */
<CopyToClipboard
text={`${siteResource.ssl ? "https" : (siteResource.protocol ?? "http")}://${siteResource.fullDomain}`}
text={`${siteResource.ssl ? "https" : (siteResource.mode ?? "http")}://${siteResource.fullDomain}`}
isLink={true}
/>
) : siteResource.alias ? (
@@ -1037,7 +1021,7 @@ export default function MemberResourcesPortal({
<Button
onClick={() =>
window.open(
`${siteResource.ssl ? "https" : (siteResource.protocol ?? "http")}://${siteResource.fullDomain}`,
`${siteResource.ssl ? "https" : (siteResource.mode ?? "http")}://${siteResource.fullDomain}`,
"_blank"
)
}

View File

@@ -90,8 +90,6 @@ export type ResourceRow = {
domain: string;
mode: string | null;
authState: string;
http: boolean;
protocol: string;
proxyPort: number | null;
enabled: boolean;
domainId?: string;
@@ -365,11 +363,11 @@ export default function ProxyResourcesTable({
const resourceRow = row.original;
return (
<span>
{resourceRow.http
{resourceRow.mode == "http"
? resourceRow.ssl
? "HTTPS"
: "HTTP"
: resourceRow.protocol.toUpperCase()}
: resourceRow.mode?.toUpperCase()}
</span>
);
}
@@ -412,7 +410,7 @@ export default function ProxyResourcesTable({
),
cell: ({ row }) => {
const resourceRow = row.original;
if (!resourceRow.http || resourceRow.mode !== "http") {
if (resourceRow.mode !== "http") {
return <span>-</span>;
}
return (
@@ -443,7 +441,7 @@ export default function ProxyResourcesTable({
header: () => <span className="p-3">{t("uptime30d")}</span>,
cell: ({ row }) => {
const resourceRow = row.original;
if (!resourceRow.http || resourceRow.mode !== "http") {
if (resourceRow.mode !== "http") {
return <span>-</span>;
}
return (
@@ -458,7 +456,11 @@ export default function ProxyResourcesTable({
cell: ({ row }) => {
const resourceRow = row.original;
if (!resourceRow.http) {
if (
!["http", "ssh", "rdp", "vnc"].includes(
resourceRow.mode || ""
)
) {
return (
<div className="flex items-center gap-2 min-w-0">
<CopyToClipboard
@@ -975,7 +977,7 @@ function ResourceEnabledForm({
resource,
onToggleResourceEnabled
}: ResourceEnabledFormProps) {
const enabled = resource.http
const enabled = ["http", "ssh", "rdp", "vnc"].includes(resource.mode || "")
? !!resource.domainId && resource.enabled
: resource.enabled;
const [optimisticEnabled, setOptimisticEnabled] = useOptimistic(enabled);
@@ -993,7 +995,10 @@ function ResourceEnabledForm({
<Switch
checked={optimisticEnabled}
disabled={
(resource.http && !resource.domainId) ||
(["http", "ssh", "rdp", "vnc"].includes(
resource.mode || ""
) &&
!resource.domainId) ||
optimisticEnabled !== enabled
}
name="enabled"

View File

@@ -31,12 +31,14 @@ export default function ResourceInfoBox({}: ResourceInfoBoxType) {
const fullUrl = `${resource.ssl ? "https" : "http"}://${toUnicode(resource.fullDomain || "")}`;
const showCertificate = !!(
resource.http &&
["http", "ssh", "rdp", "vnc"].includes(resource.mode) &&
resource.domainId &&
resource.fullDomain &&
build != "oss"
);
const showType = !!(resource.http && resource.mode);
const showType = !!(
["http", "ssh", "rdp", "vnc"].includes(resource.mode) && resource.mode
);
const showHealth =
!["ssh", "rdp", "vnc"].includes(resource.mode || "") &&
!!resource.health &&
@@ -64,7 +66,7 @@ export default function ResourceInfoBox({}: ResourceInfoBoxType) {
</span>
</InfoSectionContent>
</InfoSection> */}
{resource.http ? (
{["http", "ssh", "rdp", "vnc"].includes(resource.mode) ? (
<>
<InfoSection>
<InfoSectionTitle>URL</InfoSectionTitle>
@@ -124,7 +126,7 @@ export default function ResourceInfoBox({}: ResourceInfoBoxType) {
</InfoSectionTitle>
<InfoSectionContent>
<span className="inline-flex items-center">
{resource.protocol.toUpperCase()}
{resource.mode?.toUpperCase()}
</span>
</InfoSectionContent>
</InfoSection>

View File

@@ -44,13 +44,13 @@ function isSafeUrlForLink(href: string): boolean {
const OVERVIEW_META_CLASS = "w-full min-w-0 text-muted-foreground text-sm";
function publicProtocolLabel(r: PublicResourceRow): string {
if (r.http) {
if (r.mode == "http") {
return r.ssl ? "HTTPS" : "HTTP";
}
const p = (r.protocol || "").toLowerCase();
const p = (r.mode || "").toLowerCase();
if (p === "tcp") return "TCP";
if (p === "udp") return "UDP";
return (r.protocol || "—").toUpperCase();
return (r.mode || "—").toUpperCase();
}
function PublicResourceMeta({ resource: r }: { resource: PublicResourceRow }) {
@@ -91,7 +91,7 @@ function PrivateResourceMeta({ row }: { row: SiteResourceRow }) {
function PublicAccessMethod({ resource: r }: { resource: PublicResourceRow }) {
const t = useTranslations();
if (!r.http) {
if (!["http", "ssh", "rdp", "vnc"].includes(r.mode || "")) {
return (
<CopyToClipboard
text={r.proxyPort?.toString() ?? ""}