Skip to content

Commit

Permalink
Merge branch 'dev' into dashboard-user-edit
Browse files Browse the repository at this point in the history
  • Loading branch information
fomalhautb committed Nov 11, 2024
2 parents ba5f323 + 91dd23c commit 7bd37da
Show file tree
Hide file tree
Showing 174 changed files with 10,080 additions and 5,123 deletions.
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"cSpell.words": [
"cjsx",
"clsx",
"cmdk",
"codegen",
"Crudl",
"ctsx",
Expand All @@ -20,6 +21,7 @@
"INBUCKET",
"Jwks",
"JWTs",
"katex",
"lucide",
"Luma",
"midfix",
Expand All @@ -39,18 +41,21 @@
"pageleave",
"pageview",
"pkcco",
"PKCE",
"posthog",
"Proxied",
"psql",
"qrcode",
"quetzallabs",
"rehype",
"reqs",
"RPID",
"simplewebauthn",
"stackframe",
"supabase",
"Svix",
"tailwindcss",
"tanstack",
"totp",
"tsup",
"typecheck",
Expand All @@ -60,7 +65,8 @@
"webapi",
"webauthn",
"Whitespaces",
"wolfgunblood"
"wolfgunblood",
"zustand"
],
"[typescript]": {
"editor.codeActionsOnSave": {
Expand Down
27 changes: 27 additions & 0 deletions apps/backend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# @stackframe/stack-backend

## 2.6.22

### Patch Changes

- Bugfixes
- Updated dependencies
- @stackframe/stack-emails@2.6.22
- @stackframe/stack-shared@2.6.22

## 2.6.21

### Patch Changes

- Fixed inviteUser
- Updated dependencies
- @stackframe/stack-emails@2.6.21
- @stackframe/stack-shared@2.6.21

## 2.6.20

### Patch Changes

- Next.js 15 fixes
- Updated dependencies
- @stackframe/stack-emails@2.6.20
- @stackframe/stack-shared@2.6.20

## 2.6.19

### Patch Changes
Expand Down
5 changes: 3 additions & 2 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stackframe/stack-backend",
"version": "2.6.19",
"version": "2.6.22",
"private": true,
"scripts": {
"clean": "rimraf .next && rimraf node_modules",
Expand Down Expand Up @@ -60,6 +60,7 @@
"pg": "^8.11.3",
"posthog-node": "^4.1.0",
"react": "^18.2",
"react-dom": "^18.2",
"semver": "^7.6.3",
"server-only": "^0.0.1",
"sharp": "^0.32.6",
Expand All @@ -71,7 +72,7 @@
"@simplewebauthn/types": "^11.0.0",
"@types/node": "^20.8.10",
"@types/nodemailer": "^6.4.14",
"@types/react": "^18.2.66",
"@types/react": "^18.3.12",
"@types/semver": "^7.5.8",
"concurrently": "^8.2.2",
"glob": "^10.4.1",
Expand Down
1 change: 0 additions & 1 deletion apps/dashboard/.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ STACK_SECRET_SERVER_KEY=# enter your Stack secret client key here. For local dev
NEXT_PUBLIC_STACK_SVIX_SERVER_URL=# For prod, leave it empty. For local development, use `http://localhost:8113`

# Misc, optional
STACK_ACCESS_TOKEN_EXPIRATION_TIME=# enter the expiration time for the access token here. Optional, don't specify it for default value
NEXT_PUBLIC_STACK_HEAD_TAGS=[{ "tagName": "script", "attributes": {}, "innerHTML": "// insert head tags here" }]
STACK_DEVELOPMENT_TRANSLATION_LOCALE=# enter the locale to use for the translation provider here, for example: de-DE. Only works during development, not in production. Optional, by default don't translate
33 changes: 33 additions & 0 deletions apps/dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# @stackframe/stack-dashboard

## 2.6.22

### Patch Changes

- Bugfixes
- Updated dependencies
- @stackframe/stack-emails@2.6.22
- @stackframe/stack-shared@2.6.22
- @stackframe/stack-ui@2.6.22
- @stackframe/stack@2.6.22

## 2.6.21

### Patch Changes

- Fixed inviteUser
- Updated dependencies
- @stackframe/stack-emails@2.6.21
- @stackframe/stack-shared@2.6.21
- @stackframe/stack-ui@2.6.21
- @stackframe/stack@2.6.21

## 2.6.20

### Patch Changes

- Next.js 15 fixes
- Updated dependencies
- @stackframe/stack-emails@2.6.20
- @stackframe/stack-shared@2.6.20
- @stackframe/stack-ui@2.6.20
- @stackframe/stack@2.6.20

## 2.6.19

### Patch Changes
Expand Down
10 changes: 5 additions & 5 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stackframe/stack-dashboard",
"version": "2.6.19",
"version": "2.6.22",
"private": true,
"scripts": {
"clean": "rimraf .next && rimraf node_modules",
Expand All @@ -22,13 +22,13 @@
"@next/bundle-analyzer": "^14.0.3",
"@next/mdx": "^14",
"@node-oauth/oauth2-server": "^5.1.0",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-icons": "^1.3.1",
"@sentry/nextjs": "^7.105.0",
"@stackframe/stack": "workspace:*",
"@stackframe/stack-emails": "workspace:*",
"@stackframe/stack-shared": "workspace:*",
"@stackframe/stack-ui": "workspace:*",
"@tanstack/react-table": "^8.17.0",
"@tanstack/react-table": "^8.20.5",
"@vercel/analytics": "^1.2.2",
"@vercel/speed-insights": "^1.0.12",
"bcrypt": "^5.1.1",
Expand All @@ -46,7 +46,7 @@
"posthog-js": "^1.149.1",
"react": "^18.2",
"react-dom": "^18",
"react-hook-form": "^7.51.4",
"react-hook-form": "^7.53.1",
"react-icons": "^5.0.1",
"rehype-katex": "^7",
"remark-gfm": "^4",
Expand All @@ -63,7 +63,7 @@
"@types/canvas-confetti": "^1.6.4",
"@types/node": "^20.8.10",
"@types/nodemailer": "^6.4.14",
"@types/react": "^18.2.66",
"@types/react": "^18.3.12",
"@types/react-dom": "^18",
"autoprefixer": "^10.4.17",
"glob": "^10.4.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"use client";
import { SmartFormDialog } from "@/components/form-dialog";
import { FormDialog } from "@/components/form-dialog";
import { InputField, SwitchField } from "@/components/form-fields";
import { SettingCard, SettingSwitch } from "@/components/settings";
import { AdminDomainConfig, AdminProject } from "@stackframe/stack";
import { urlSchema } from "@stackframe/stack-shared/dist/schema-fields";
import { ActionCell, ActionDialog, Alert, Button, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Typography } from "@stackframe/stack-ui";
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionCell, ActionDialog, Alert, Button, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Typography } from "@stackframe/stack-ui";
import React from "react";
import * as yup from "yup";
import { PageLayout } from "../page-layout";
Expand All @@ -28,48 +29,29 @@ function EditDialog(props: {
}
)) {
const domainFormSchema = yup.object({
makeSureAlert: yup.mixed().meta({
stackFormFieldRender: () => (
<Alert>
Make sure this is a trusted domain or a URL that you control.
</Alert>
),
}),
domain: urlSchema
.matches(/^https:\/\//, "Origin must start with https://")
.url("Domain must be a valid URL")
.url("Invalid URL")
.transform((value) => 'https://' + value)
.notOneOf(
props.domains
.filter((_, i) => (props.type === 'update' && i !== props.editIndex) || props.type === 'create')
.map(({ domain }) => domain),
"Domain already exists"
)
.required()
.label("Origin (starts with https://)")
.meta({
stackFormFieldPlaceholder: "https://example.com",
}).default(props.type === 'update' ? props.defaultDomain : ""),
.required(),
handlerPath: yup.string()
.matches(/^\//, "Handler path must start with /")
.required()
.label("Handler path (default: /handler)")
.default(props.type === 'update' ? props.defaultHandlerPath : "/handler"),
description: yup.mixed().meta({
stackFormFieldRender: () => (
<>
<Typography variant="secondary" type="footnote">
Note that sub-domains are not automatically added. Create two domains like www.example.com and example.com if you want to allow both.
</Typography>
<Typography variant="secondary" type="footnote">
{"You don't need to change the handler path unless you updated the path to the StackHandler."}
</Typography>
</>
),
}),
.required(),
addWww: yup.boolean(),
});

return <SmartFormDialog
return <FormDialog
open={props.open}
defaultValues={{
addWww: props.type === 'create',
domain: props.type === 'update' ? props.defaultDomain : undefined,
handlerPath: props.type === 'update' ? props.defaultHandlerPath : "/handler",
}}
onOpenChange={props.onOpenChange}
trigger={props.trigger}
title={(props.type === 'create' ? "Create" : "Update") + " domain and handler"}
Expand All @@ -79,10 +61,17 @@ function EditDialog(props: {
if (props.type === 'create') {
await props.project.update({
config: {
domains: [...props.domains, {
domain: values.domain,
handlerPath: values.handlerPath,
}],
domains: [
...props.domains,
{
domain: values.domain,
handlerPath: values.handlerPath,
},
...(values.addWww ? [{
domain: 'https://www.' + values.domain.slice(8),
handlerPath: values.handlerPath,
}] : []),
],
},
});
} else {
Expand All @@ -101,6 +90,47 @@ function EditDialog(props: {
});
}
}}
render={(form) => (
<>
<Alert>
Please ensure you own or have control over this domain. Note that each subdomain (e.g. blog.example.com, app.example.com) is treated as a distinct domain.
</Alert>
<InputField
label="Domain"
name="domain"
control={form.control}
prefixItem='https://'
placeholder='example.com'
/>

{props.type === 'create' &&
urlSchema.url().required().isValidSync('https://' + form.watch('domain')) &&
!((form.watch('domain') as any)?.startsWith('www.')) && (
<SwitchField
label={`Also add www.${form.watch('domain') as any ?? ''} to the trusted domains`}
name="addWww"
control={form.control}
/>
)}

<Accordion type="single" collapsible className="w-full">
<AccordionItem value="item-1">
<AccordionTrigger>Advanced</AccordionTrigger>
<AccordionContent>
<InputField
label="Handler path"
name="handlerPath"
control={form.control}
placeholder='/handler'
/>
<Typography variant="secondary" type="footnote">
only modify this if you changed the default handler path in your app
</Typography>
</AccordionContent>
</AccordionItem>
</Accordion>
</>
)}
/>;
}

Expand Down Expand Up @@ -200,15 +230,13 @@ export default function PageClient() {
<TableHeader>
<TableRow>
<TableHead className="w-[200px]">Domain</TableHead>
<TableHead className="w-[100px]">Handler</TableHead>
<TableHead></TableHead>
</TableRow>
</TableHeader>
<TableBody>
{domains.map(({ domain, handlerPath }, i) => (
<TableRow key={domain}>
<TableCell>{domain}</TableCell>
<TableCell>{handlerPath}</TableCell>
<TableCell className="flex justify-end gap-4">
<ActionMenu
domains={domains}
Expand Down
Loading

0 comments on commit 7bd37da

Please sign in to comment.