add snippets to create resource

This commit is contained in:
miloschwartz 2025-04-28 21:45:43 -04:00
parent 599d0a52bf
commit 18e6f16ce7
No known key found for this signature in database
5 changed files with 634 additions and 496 deletions

View file

@ -137,7 +137,8 @@ LQIDAQAB
hostId: this.hostId, hostId: this.hostId,
isHostLicensed: true, isHostLicensed: true,
isLicenseValid: false, isLicenseValid: false,
maxSites: undefined maxSites: undefined,
usedSites: siteCount.value
}; };
try { try {

View file

@ -67,6 +67,12 @@ import { SwitchInput } from "@app/components/SwitchInput";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { isTargetValid } from "@server/lib/validators"; import { isTargetValid } from "@server/lib/validators";
import { tlsNameSchema } from "@server/lib/schemas"; import { tlsNameSchema } from "@server/lib/schemas";
import { ChevronsUpDown } from "lucide-react";
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger
} from "@app/components/ui/collapsible";
const addTargetSchema = z.object({ const addTargetSchema = z.object({
ip: z.string().refine(isTargetValid), ip: z.string().refine(isTargetValid),
@ -145,6 +151,7 @@ export default function ReverseProxyTargets(props: {
const [proxySettingsLoading, setProxySettingsLoading] = useState(false); const [proxySettingsLoading, setProxySettingsLoading] = useState(false);
const [pageLoading, setPageLoading] = useState(true); const [pageLoading, setPageLoading] = useState(true);
const [isAdvancedOpen, setIsAdvancedOpen] = useState(false);
const router = useRouter(); const router = useRouter();
const addTargetForm = useForm({ const addTargetForm = useForm({
@ -589,26 +596,57 @@ export default function ReverseProxyTargets(props: {
</FormItem> </FormItem>
)} )}
/> />
<FormField <Collapsible
control={tlsSettingsForm.control} open={isAdvancedOpen}
name="tlsServerName" onOpenChange={setIsAdvancedOpen}
render={({ field }) => ( className="space-y-2"
<FormItem> >
<FormLabel> <div className="flex items-center justify-between space-x-4">
TLS Server Name (SNI) <CollapsibleTrigger asChild>
</FormLabel> <Button
<FormControl> variant="text"
<Input {...field} /> size="sm"
</FormControl> className="p-0 flex items-center justify-start gap-2 w-full"
<FormDescription> >
The TLS Server Name to use <h4 className="text-sm font-semibold">
for SNI. Leave empty to use Advanced TLS Settings
the default. </h4>
</FormDescription> <div>
<FormMessage /> <ChevronsUpDown className="h-4 w-4" />
</FormItem> <span className="sr-only">
)} Toggle
/> </span>
</div>
</Button>
</CollapsibleTrigger>
</div>
<CollapsibleContent className="space-y-2">
<FormField
control={
tlsSettingsForm.control
}
name="tlsServerName"
render={({ field }) => (
<FormItem>
<FormLabel>
TLS Server Name
(SNI)
</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormDescription>
The TLS Server Name
to use for SNI.
Leave empty to use
the default.
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
</CollapsibleContent>
</Collapsible>
</form> </form>
</Form> </Form>
</SettingsSectionForm> </SettingsSectionForm>

File diff suppressed because it is too large Load diff

View file

@ -57,9 +57,7 @@ import {
import { CheckIcon, ChevronsUpDown } from "lucide-react"; import { CheckIcon, ChevronsUpDown } from "lucide-react";
import { Checkbox } from "@app/components/ui/checkbox"; import { Checkbox } from "@app/components/ui/checkbox";
import { GenerateAccessTokenResponse } from "@server/routers/accessToken"; import { GenerateAccessTokenResponse } from "@server/routers/accessToken";
import { import { constructShareLink } from "@app/lib/shareLinks";
constructShareLink
} from "@app/lib/shareLinks";
import { ShareLinkRow } from "./ShareLinksTable"; import { ShareLinkRow } from "./ShareLinksTable";
import { QRCodeCanvas, QRCodeSVG } from "qrcode.react"; import { QRCodeCanvas, QRCodeSVG } from "qrcode.react";
import { import {
@ -528,11 +526,9 @@ export default function CreateShareLinkForm({
accessTokenId accessTokenId
} }
token={accessToken} token={accessToken}
resourceUrl={ resourceUrl={form.getValues(
form.getValues( "resourceUrl"
"resourceUrl" )}
)
}
/> />
</div> </div>
</div> </div>

View file

@ -33,9 +33,10 @@ export default function LicenseViolation() {
return ( return (
<div className="fixed bottom-0 left-0 right-0 w-full bg-yellow-500 text-black p-4 text-center z-50"> <div className="fixed bottom-0 left-0 right-0 w-full bg-yellow-500 text-black p-4 text-center z-50">
<p> <p>
License Violation: Using {licenseStatus.usedSites} sites License Violation: This server is using{" "}
exceeds your licensed limit of {licenseStatus.maxSites}{" "} {licenseStatus.usedSites} sites which exceeds its licensed
sites. Follow license terms to continue using all features. limit of {licenseStatus.maxSites} sites. Follow license
terms to continue using all features.
</p> </p>
</div> </div>
); );