Compare commits
13
Commits
60f23923ad
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e31d787769 | ||
|
|
51b52abb15 | ||
|
|
af73a386ed | ||
|
|
b6e5d81dc0 | ||
|
|
cba6eddc56 | ||
|
|
56ed40e8b0 | ||
|
|
c3225a7b91 | ||
|
|
5001cae163 | ||
|
|
dacd374946 | ||
|
|
e85244e820 | ||
|
|
4b9690e064 | ||
|
|
7798432de6 | ||
|
|
4a4401ddb0 |
@@ -19,5 +19,10 @@ OIDC_CLIENT_ID=
|
|||||||
OIDC_CLIENT_SECRET=
|
OIDC_CLIENT_SECRET=
|
||||||
OIDC_PROVIDER_NAME=SSO
|
OIDC_PROVIDER_NAME=SSO
|
||||||
|
|
||||||
|
# Set to "true" to show on every link whether its address answers. The server then
|
||||||
|
# calls the addresses that users save as links, once a minute. Leave it off when
|
||||||
|
# people you do not trust can sign up: they could probe your network with it.
|
||||||
|
STATUS_CHECKS=false
|
||||||
|
|
||||||
# SearXNG instance (must be reachable from the browser and from this server)
|
# SearXNG instance (must be reachable from the browser and from this server)
|
||||||
SEARXNG_URL=
|
SEARXNG_URL=
|
||||||
|
|||||||
Generated
+12
@@ -0,0 +1,12 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Markdown personal settings
|
||||||
|
/markdown.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Ignored default folder with query files
|
||||||
|
/queries/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
Generated
+60
@@ -0,0 +1,60 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<option name="LINE_SEPARATOR" value=" " />
|
||||||
|
<HTMLCodeStyleSettings>
|
||||||
|
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
||||||
|
</HTMLCodeStyleSettings>
|
||||||
|
<JSCodeStyleSettings version="0">
|
||||||
|
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
|
||||||
|
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||||
|
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||||
|
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||||
|
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
||||||
|
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||||
|
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||||
|
</JSCodeStyleSettings>
|
||||||
|
<TypeScriptCodeStyleSettings version="0">
|
||||||
|
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
|
||||||
|
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||||
|
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||||
|
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||||
|
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
||||||
|
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||||
|
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||||
|
</TypeScriptCodeStyleSettings>
|
||||||
|
<VueCodeStyleSettings>
|
||||||
|
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
||||||
|
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
||||||
|
</VueCodeStyleSettings>
|
||||||
|
<codeStyleSettings language="HTML">
|
||||||
|
<option name="SOFT_MARGINS" value="80" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="INDENT_SIZE" value="2" />
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||||
|
<option name="TAB_SIZE" value="2" />
|
||||||
|
</indentOptions>
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="JavaScript">
|
||||||
|
<option name="SOFT_MARGINS" value="80" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="INDENT_SIZE" value="2" />
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||||
|
<option name="TAB_SIZE" value="2" />
|
||||||
|
</indentOptions>
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="TypeScript">
|
||||||
|
<option name="SOFT_MARGINS" value="80" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="INDENT_SIZE" value="2" />
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||||
|
<option name="TAB_SIZE" value="2" />
|
||||||
|
</indentOptions>
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="Vue">
|
||||||
|
<option name="SOFT_MARGINS" value="80" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||||
|
</indentOptions>
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
||||||
Generated
+5
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/dahoam.iml" filepath="$PROJECT_DIR$/.idea/dahoam.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="PrettierConfiguration">
|
||||||
|
<option name="myConfigurationMode" value="AUTOMATIC" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -89,12 +89,42 @@ scripts/sync-collabry.sh copies them from upstream at a pinned commit
|
|||||||
the migrations on start (`src/db/index.ts`).
|
the migrations on start (`src/db/index.ts`).
|
||||||
- [x] 12. Renamed from "Home Dashboard" to Dahoam (slug `dahoam`): package, compose project, tab title,
|
- [x] 12. Renamed from "Home Dashboard" to Dahoam (slug `dahoam`): package, compose project, tab title,
|
||||||
default dashboard name, docs, CI examples.
|
default dashboard name, docs, CI examples.
|
||||||
|
- [x] 13. Dashboards: table `dashboard`, `card.dashboardId`, `settings.defaultDashboardId`
|
||||||
|
(migration `0006_dashboards_icons` puts the existing cards on a dashboard "Home"). `/?d=<id>`
|
||||||
|
opens one, `/` the default. Switcher in the header, managed in Settings → Dashboards.
|
||||||
|
- [x] 14. Icons: the link dialog searches dashboard-icons (`src/lib/icons.ts` and its test) and
|
||||||
|
uploads custom icons (table `icon`, `/api/icon`, ≤ 1 MB, SVG allowed because it is served
|
||||||
|
sandboxed). `src/lib/upload.ts` holds the upload checks that wallpaper and icons share.
|
||||||
|
- [x] 15. A wallpaper per dashboard: `wallpaperUrl` and `wallpaperDim` move from `settings` to
|
||||||
|
`dashboard`, the `wallpaper` table is keyed by dashboard (migration `0007_dashboard_wallpaper`
|
||||||
|
copies what each user had to all their dashboards). `/settings?d=<id>` is the dashboard whose
|
||||||
|
wallpaper is shown, and where "Back to dashboard" goes.
|
||||||
|
- [x] 16. Cards are dragged by their title bar: `card.position` (migration `0008_card_position`),
|
||||||
|
`saveLayout` (was `moveLinks`) stores the order of the cards and of their links.
|
||||||
|
- [x] 17. Password change in Settings → Account (Better Auth `changePassword`, other sessions are
|
||||||
|
revoked). Hidden for accounts without a password (SSO only).
|
||||||
|
- [x] 18. The search bar opens links by name: `matchLinks` in `src/lib/search.ts`. A link whose name
|
||||||
|
or a word of it starts with the text is preselected, Enter opens it.
|
||||||
|
- [x] 19. Light icons: a link without an icon of its own uses the library's `-light` version when
|
||||||
|
there is one. The server keeps the library's names for a day (`src/lib/icon-library.ts`) and
|
||||||
|
sends `lightIcon` with each link.
|
||||||
|
- [x] 20. Status dots: `STATUS_CHECKS=true` turns them on (`src/lib/status.ts`, `getStatuses`).
|
||||||
|
Off by default, because the server then requests addresses that users chose.
|
||||||
|
- [x] 21. Export and import: `exportData` / `importData`, the file format and the bookmarks parser
|
||||||
|
in `src/lib/transfer.ts`. An import only adds dashboards.
|
||||||
|
- [x] 22. Cards move to another dashboard in the card dialog, dashboards are ordered with arrows
|
||||||
|
in Settings (`dashboard.position`, migration `0009_dashboard_position`), uploaded icons are
|
||||||
|
offered again in the link dialog (`getIcons`).
|
||||||
|
|
||||||
## Not doing (not asked)
|
## Not doing (not asked)
|
||||||
|
|
||||||
- Unraid version/uptime chip and the Sonarr/Plex notification pills from the screenshot
|
- Unraid version/uptime chip and the Sonarr/Plex notification pills from the screenshot
|
||||||
- Inline SearXNG result rendering (search opens the engine's result page)
|
- Inline SearXNG result rendering (search opens the engine's result page)
|
||||||
- Reordering the cards themselves (they stay in the order they were made), free placement with
|
- Free placement of cards with gaps in the grid, per-user SearXNG URL (SSRF risk — it is a server env)
|
||||||
gaps in the grid, per-user SearXNG URL (SSRF risk — it is a server env)
|
- Per dashboard clock or search engine (they stay per user), remembering the last opened
|
||||||
|
dashboard (it would work against the default dashboard, which opens)
|
||||||
|
- Links of other dashboards in the search bar, a keyword per link, a status history or alerts
|
||||||
|
- Info pills (Sonarr, SABnzbd, server status) and a Home Assistant card: each needs its own
|
||||||
|
integration and an API key on the server
|
||||||
- Email verification / password reset mail (needs an SMTP setup)
|
- Email verification / password reset mail (needs an SMTP setup)
|
||||||
- In CI: version tags and releases, a Helm chart, an image vulnerability scan (typst-workspace has all three)
|
- In CI: version tags and releases, a Helm chart, an image vulnerability scan (typst-workspace has all three)
|
||||||
|
|||||||
@@ -49,31 +49,66 @@ Build it yourself: `docker build -t dahoam .`
|
|||||||
| `DISABLE_SIGNUP` | `true` closes email/password registration. Set it after you made your account. |
|
| `DISABLE_SIGNUP` | `true` closes email/password registration. Set it after you made your account. |
|
||||||
| `OIDC_DISCOVERY_URL`, `OIDC_CLIENT_ID`, `OIDC_CLIENT_SECRET` | Turns on the SSO button. Redirect URI: `<BETTER_AUTH_URL>/api/auth/callback/sso` |
|
| `OIDC_DISCOVERY_URL`, `OIDC_CLIENT_ID`, `OIDC_CLIENT_SECRET` | Turns on the SSO button. Redirect URI: `<BETTER_AUTH_URL>/api/auth/callback/sso` |
|
||||||
| `OIDC_PROVIDER_NAME` | Text on the SSO button ("Continue with …") |
|
| `OIDC_PROVIDER_NAME` | Text on the SSO button ("Continue with …") |
|
||||||
|
| `STATUS_CHECKS` | `true` shows on every link whether its address answers. Off by default, see Notes. |
|
||||||
| `SEARXNG_URL` | Your SearXNG instance. Makes SearXNG selectable in Settings. |
|
| `SEARXNG_URL` | Your SearXNG instance. Makes SearXNG selectable in Settings. |
|
||||||
|
|
||||||
## Use
|
## Use
|
||||||
|
|
||||||
|
- **Dashboards** are separate sets of cards, for example Home and Work. Settings → Dashboards
|
||||||
|
adds, renames, orders and deletes them and sets the default, the one that opens when you
|
||||||
|
sign in.
|
||||||
|
With more than one, switch at the top of the page or with `/switch to work`. The address
|
||||||
|
of a dashboard (`/?d=…`) can be bookmarked. Every dashboard has its own wallpaper, clock
|
||||||
|
and search are the same on all.
|
||||||
- **Cards** group your links (Apps, Media, Bookmarks, ...). "New card" under the cards adds
|
- **Cards** group your links (Apps, Media, Bookmarks, ...). "New card" under the cards adds
|
||||||
one. Click a card's name to rename or delete it.
|
one. Click a card's name to rename or delete it, or to move it to another dashboard.
|
||||||
- **Links**: **+** at the top or on a card adds a link. Hover a link and click the pencil to
|
- **Links**: **+** at the top or on a card adds a link. Hover a link and click the pencil to
|
||||||
edit or delete it.
|
edit or delete it.
|
||||||
- **Move links** by dragging, inside a card or to another card. Touch: press and hold first.
|
- **Move links** by dragging, inside a card or to another card. Touch: press and hold first.
|
||||||
Keyboard: focus a link, Space picks it up, arrow keys move it, Space puts it down.
|
Keyboard: focus a link, Space picks it up, arrow keys move it, Space puts it down.
|
||||||
|
- **Move cards** by dragging their title bar, the links come along. Touch: press and hold
|
||||||
|
first. Keyboard: Space on the grip next to the plus, arrow keys, Space.
|
||||||
- **Icons**: leave the field empty and the icon is looked up by name in
|
- **Icons**: leave the field empty and the icon is looked up by name in
|
||||||
[dashboard-icons](https://github.com/homarr-labs/dashboard-icons), then from the
|
[dashboard-icons](https://github.com/homarr-labs/dashboard-icons), then from the
|
||||||
site's `/favicon.ico`. Or enter an icon name (`home-assistant`) or an image URL.
|
site's `/favicon.ico`. When the library has a light version of the icon (`github-light`),
|
||||||
- **Search**: `/` focuses the bar. `!w cats` uses DuckDuckGo bangs. `/plex` jumps to
|
that one is used, because the cards are dark. Or type in the field to search that library and click an icon,
|
||||||
a link, `/settings`, `/add link`, `/add card` and `/sign out` run commands.
|
paste an image URL, or upload your own image (PNG, JPEG, WebP, AVIF or SVG, up to 1 MB).
|
||||||
|
The images that you uploaded before are offered again under "Your images".
|
||||||
|
- **Status** (with `STATUS_CHECKS=true`): a green dot on a link means that its address
|
||||||
|
answers, a red ring that it does not. Checked once a minute.
|
||||||
|
- **Search**: `/` focuses the bar. `!w cats` uses DuckDuckGo bangs. `/settings`, `/add link`,
|
||||||
|
`/add card`, `/add dashboard` and `/sign out` run commands.
|
||||||
|
- **Open a link from the search bar**: type the start of its name (`jel` for Jellyfin). The
|
||||||
|
link is highlighted and Enter opens it. To search the web for the same word, press the up
|
||||||
|
arrow first, so that no row is highlighted. `/jel` shows only your links and commands.
|
||||||
- **Wallpaper**: Settings (or the pencil at the bottom right) takes an image URL or an
|
- **Wallpaper**: Settings (or the pencil at the bottom right) takes an image URL or an
|
||||||
upload (JPEG, PNG, WebP, AVIF, up to 10 MB).
|
upload (JPEG, PNG, WebP, AVIF, up to 10 MB). A slider sets how much it is darkened.
|
||||||
|
Each dashboard has its own: the pencil opens the one of the dashboard you are on, and
|
||||||
|
Settings → Wallpaper has a switch for the others.
|
||||||
|
- **Export and import**: Settings → Export and import downloads all dashboards with their
|
||||||
|
cards and links as one JSON file, and loads such a file again. It also takes the bookmarks
|
||||||
|
file that a browser exports (HTML) and makes a dashboard "Bookmarks" of it, with a card per
|
||||||
|
folder. An import adds dashboards and replaces nothing. Uploaded wallpapers and icons are
|
||||||
|
not part of an export.
|
||||||
|
- **Password**: Settings → Account changes it. That signs you out on your other devices.
|
||||||
|
- **Clock**: Settings has five fonts and three styles. Glass shows the wallpaper blurred
|
||||||
|
through the digits, Tinted takes its color from the wallpaper.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- Suggestions come from DuckDuckGo, or from SearXNG (`/autocompleter`) when it is the
|
- Suggestions come from DuckDuckGo, or from SearXNG (`/autocompleter`) when it is the
|
||||||
selected engine. The server fetches them, the browser never calls those hosts directly.
|
selected engine. The server fetches them, the browser never calls those hosts directly.
|
||||||
|
- Status checks: the server requests each link's address (a GET, redirects are not
|
||||||
|
followed, the answer is thrown away) and tells the browser only up or down. Up is any
|
||||||
|
answer below 500, and also a certificate that the server does not trust. Because users
|
||||||
|
choose the addresses, a user can find out which hosts and ports the server can reach.
|
||||||
|
Turn it on for people you trust, together with `DISABLE_SIGNUP=true`.
|
||||||
- SSO does not take over an existing password account with the same email
|
- SSO does not take over an existing password account with the same email
|
||||||
(Better Auth blocks it, because password emails are not verified). Use one or the other per email.
|
(Better Auth blocks it, because password emails are not verified). Use one or the other per email.
|
||||||
- Icon lookups send the link name to the jsDelivr CDN.
|
- Icon lookups send the link name to the jsDelivr CDN. The link dialog also loads the
|
||||||
|
library's list of icons from there, and so does the server, once a day.
|
||||||
|
- Uploaded icons are stored in Postgres and only their owner can load them. One that no
|
||||||
|
link uses any more is deleted with that user's next upload.
|
||||||
- UI components come from [collabry-components](https://git.nhaiden.io/niklas/collabry-components),
|
- UI components come from [collabry-components](https://git.nhaiden.io/niklas/collabry-components),
|
||||||
copied into `src/vendor/collabry` at a pinned commit. Add or update one with
|
copied into `src/vendor/collabry` at a pinned commit. Add or update one with
|
||||||
`scripts/sync-collabry.sh` (see `src/vendor/collabry/UPSTREAM.md`). The glass look is
|
`scripts/sync-collabry.sh` (see `src/vendor/collabry/UPSTREAM.md`). The glass look is
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE "settings" ADD COLUMN "clock_font" text DEFAULT 'serif' NOT NULL;--> statement-breakpoint
|
||||||
|
ALTER TABLE "settings" ADD COLUMN "clock_style" text DEFAULT 'solid' NOT NULL;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "settings" ADD COLUMN "wallpaper_dim" integer DEFAULT 40 NOT NULL;
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
CREATE TABLE "dashboard" (
|
||||||
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
|
"user_id" text NOT NULL,
|
||||||
|
"name" text NOT NULL,
|
||||||
|
"created_at" timestamp DEFAULT now() NOT NULL
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE TABLE "icon" (
|
||||||
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
|
"user_id" text NOT NULL,
|
||||||
|
"mime" text NOT NULL,
|
||||||
|
"data" "bytea" NOT NULL,
|
||||||
|
"created_at" timestamp DEFAULT now() NOT NULL
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "card" ADD COLUMN "dashboard_id" uuid;--> statement-breakpoint
|
||||||
|
-- Hand-written: the cards a user already has become that user's first dashboard, "Home".
|
||||||
|
INSERT INTO "dashboard" ("user_id", "name")
|
||||||
|
SELECT DISTINCT "user_id", 'Home' FROM "card";--> statement-breakpoint
|
||||||
|
UPDATE "card" SET "dashboard_id" = "dashboard"."id" FROM "dashboard"
|
||||||
|
WHERE "dashboard"."user_id" = "card"."user_id";--> statement-breakpoint
|
||||||
|
ALTER TABLE "card" ALTER COLUMN "dashboard_id" SET NOT NULL;--> statement-breakpoint
|
||||||
|
ALTER TABLE "settings" ADD COLUMN "default_dashboard_id" uuid;--> statement-breakpoint
|
||||||
|
ALTER TABLE "dashboard" ADD CONSTRAINT "dashboard_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "icon" ADD CONSTRAINT "icon_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||||
|
CREATE INDEX "dashboard_user_id_idx" ON "dashboard" USING btree ("user_id");--> statement-breakpoint
|
||||||
|
CREATE INDEX "icon_user_id_idx" ON "icon" USING btree ("user_id");--> statement-breakpoint
|
||||||
|
ALTER TABLE "card" ADD CONSTRAINT "card_dashboard_id_dashboard_id_fk" FOREIGN KEY ("dashboard_id") REFERENCES "public"."dashboard"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "settings" ADD CONSTRAINT "settings_default_dashboard_id_dashboard_id_fk" FOREIGN KEY ("default_dashboard_id") REFERENCES "public"."dashboard"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||||
|
CREATE INDEX "card_dashboard_id_idx" ON "card" USING btree ("dashboard_id");
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
-- Hand-written: the wallpaper moves from the user to the dashboard. Every dashboard of a
|
||||||
|
-- user starts with the wallpaper that the user had, so nothing looks different.
|
||||||
|
ALTER TABLE "dashboard" ADD COLUMN "wallpaper_url" text;--> statement-breakpoint
|
||||||
|
ALTER TABLE "dashboard" ADD COLUMN "wallpaper_dim" integer DEFAULT 40 NOT NULL;--> statement-breakpoint
|
||||||
|
-- a user who chose a wallpaper but has no dashboard yet keeps it too
|
||||||
|
INSERT INTO "dashboard" ("user_id", "name")
|
||||||
|
SELECT "user_id", 'Home' FROM "settings"
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM "dashboard" WHERE "dashboard"."user_id" = "settings"."user_id");--> statement-breakpoint
|
||||||
|
-- the address of an upload now names its dashboard: /api/wallpaper?d=<id>&v=<upload time>
|
||||||
|
UPDATE "dashboard" SET
|
||||||
|
"wallpaper_dim" = "settings"."wallpaper_dim",
|
||||||
|
"wallpaper_url" = CASE WHEN "settings"."wallpaper_url" LIKE '/api/wallpaper?v=%'
|
||||||
|
THEN replace("settings"."wallpaper_url", '?v=', '?d=' || "dashboard"."id" || '&v=')
|
||||||
|
ELSE "settings"."wallpaper_url" END
|
||||||
|
FROM "settings" WHERE "settings"."user_id" = "dashboard"."user_id";--> statement-breakpoint
|
||||||
|
ALTER TABLE "wallpaper" DROP CONSTRAINT "wallpaper_pkey";--> statement-breakpoint
|
||||||
|
ALTER TABLE "wallpaper" ADD COLUMN "dashboard_id" uuid;--> statement-breakpoint
|
||||||
|
-- one upload per user becomes one copy per dashboard of that user
|
||||||
|
INSERT INTO "wallpaper" ("dashboard_id", "user_id", "mime", "data")
|
||||||
|
SELECT "dashboard"."id", "wallpaper"."user_id", "wallpaper"."mime", "wallpaper"."data"
|
||||||
|
FROM "wallpaper" JOIN "dashboard" ON "dashboard"."user_id" = "wallpaper"."user_id";--> statement-breakpoint
|
||||||
|
DELETE FROM "wallpaper" WHERE "dashboard_id" IS NULL;--> statement-breakpoint
|
||||||
|
ALTER TABLE "wallpaper" ADD PRIMARY KEY ("dashboard_id");--> statement-breakpoint
|
||||||
|
ALTER TABLE "wallpaper" ADD CONSTRAINT "wallpaper_dashboard_id_dashboard_id_fk" FOREIGN KEY ("dashboard_id") REFERENCES "public"."dashboard"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "settings" DROP COLUMN "wallpaper_url";--> statement-breakpoint
|
||||||
|
ALTER TABLE "settings" DROP COLUMN "wallpaper_dim";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "card" ADD COLUMN "position" integer DEFAULT 0 NOT NULL;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "dashboard" ADD COLUMN "position" integer DEFAULT 0 NOT NULL;
|
||||||
@@ -0,0 +1,679 @@
|
|||||||
|
{
|
||||||
|
"id": "ac3af713-2f43-44c7-8e48-d840cfee12c0",
|
||||||
|
"prevId": "d6c6160d-4a0a-4e19-a093-40a1963aab9d",
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"tables": {
|
||||||
|
"public.account": {
|
||||||
|
"name": "account",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"account_id": {
|
||||||
|
"name": "account_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"provider_id": {
|
||||||
|
"name": "provider_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"access_token": {
|
||||||
|
"name": "access_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"refresh_token": {
|
||||||
|
"name": "refresh_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"id_token": {
|
||||||
|
"name": "id_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"access_token_expires_at": {
|
||||||
|
"name": "access_token_expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"refresh_token_expires_at": {
|
||||||
|
"name": "refresh_token_expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"scope": {
|
||||||
|
"name": "scope",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"name": "password",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"account_user_id_idx": {
|
||||||
|
"name": "account_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"account_user_id_user_id_fk": {
|
||||||
|
"name": "account_user_id_user_id_fk",
|
||||||
|
"tableFrom": "account",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.card": {
|
||||||
|
"name": "card",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"card_user_id_idx": {
|
||||||
|
"name": "card_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"card_user_id_user_id_fk": {
|
||||||
|
"name": "card_user_id_user_id_fk",
|
||||||
|
"tableFrom": "card",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.link": {
|
||||||
|
"name": "link",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"card_id": {
|
||||||
|
"name": "card_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"position": {
|
||||||
|
"name": "position",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"name": "url",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"icon": {
|
||||||
|
"name": "icon",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"link_user_id_idx": {
|
||||||
|
"name": "link_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"link_card_id_idx": {
|
||||||
|
"name": "link_card_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "card_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"link_user_id_user_id_fk": {
|
||||||
|
"name": "link_user_id_user_id_fk",
|
||||||
|
"tableFrom": "link",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"link_card_id_card_id_fk": {
|
||||||
|
"name": "link_card_id_card_id_fk",
|
||||||
|
"tableFrom": "link",
|
||||||
|
"tableTo": "card",
|
||||||
|
"columnsFrom": [
|
||||||
|
"card_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.session": {
|
||||||
|
"name": "session",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"expires_at": {
|
||||||
|
"name": "expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"token": {
|
||||||
|
"name": "token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"ip_address": {
|
||||||
|
"name": "ip_address",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"user_agent": {
|
||||||
|
"name": "user_agent",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"session_user_id_idx": {
|
||||||
|
"name": "session_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"session_user_id_user_id_fk": {
|
||||||
|
"name": "session_user_id_user_id_fk",
|
||||||
|
"tableFrom": "session",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"session_token_unique": {
|
||||||
|
"name": "session_token_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"token"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.settings": {
|
||||||
|
"name": "settings",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"name": "title",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'Dahoam'"
|
||||||
|
},
|
||||||
|
"search_engine": {
|
||||||
|
"name": "search_engine",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'duckduckgo'"
|
||||||
|
},
|
||||||
|
"wallpaper_url": {
|
||||||
|
"name": "wallpaper_url",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"clock_font": {
|
||||||
|
"name": "clock_font",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'serif'"
|
||||||
|
},
|
||||||
|
"clock_style": {
|
||||||
|
"name": "clock_style",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'solid'"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"settings_user_id_user_id_fk": {
|
||||||
|
"name": "settings_user_id_user_id_fk",
|
||||||
|
"tableFrom": "settings",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.user": {
|
||||||
|
"name": "user",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"name": "email",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"email_verified": {
|
||||||
|
"name": "email_verified",
|
||||||
|
"type": "boolean",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"image": {
|
||||||
|
"name": "image",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"user_email_unique": {
|
||||||
|
"name": "user_email_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"email"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.verification": {
|
||||||
|
"name": "verification",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"identifier": {
|
||||||
|
"name": "identifier",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"name": "value",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"expires_at": {
|
||||||
|
"name": "expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"verification_identifier_idx": {
|
||||||
|
"name": "verification_identifier_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "identifier",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.wallpaper": {
|
||||||
|
"name": "wallpaper",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"mime": {
|
||||||
|
"name": "mime",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"name": "data",
|
||||||
|
"type": "bytea",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"wallpaper_user_id_user_id_fk": {
|
||||||
|
"name": "wallpaper_user_id_user_id_fk",
|
||||||
|
"tableFrom": "wallpaper",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enums": {},
|
||||||
|
"schemas": {},
|
||||||
|
"sequences": {},
|
||||||
|
"roles": {},
|
||||||
|
"policies": {},
|
||||||
|
"views": {},
|
||||||
|
"_meta": {
|
||||||
|
"columns": {},
|
||||||
|
"schemas": {},
|
||||||
|
"tables": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,686 @@
|
|||||||
|
{
|
||||||
|
"id": "4df576be-2fef-462c-affd-4aff0ab26918",
|
||||||
|
"prevId": "ac3af713-2f43-44c7-8e48-d840cfee12c0",
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"tables": {
|
||||||
|
"public.account": {
|
||||||
|
"name": "account",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"account_id": {
|
||||||
|
"name": "account_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"provider_id": {
|
||||||
|
"name": "provider_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"access_token": {
|
||||||
|
"name": "access_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"refresh_token": {
|
||||||
|
"name": "refresh_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"id_token": {
|
||||||
|
"name": "id_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"access_token_expires_at": {
|
||||||
|
"name": "access_token_expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"refresh_token_expires_at": {
|
||||||
|
"name": "refresh_token_expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"scope": {
|
||||||
|
"name": "scope",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"name": "password",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"account_user_id_idx": {
|
||||||
|
"name": "account_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"account_user_id_user_id_fk": {
|
||||||
|
"name": "account_user_id_user_id_fk",
|
||||||
|
"tableFrom": "account",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.card": {
|
||||||
|
"name": "card",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"card_user_id_idx": {
|
||||||
|
"name": "card_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"card_user_id_user_id_fk": {
|
||||||
|
"name": "card_user_id_user_id_fk",
|
||||||
|
"tableFrom": "card",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.link": {
|
||||||
|
"name": "link",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"card_id": {
|
||||||
|
"name": "card_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"position": {
|
||||||
|
"name": "position",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"name": "url",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"icon": {
|
||||||
|
"name": "icon",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"link_user_id_idx": {
|
||||||
|
"name": "link_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"link_card_id_idx": {
|
||||||
|
"name": "link_card_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "card_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"link_user_id_user_id_fk": {
|
||||||
|
"name": "link_user_id_user_id_fk",
|
||||||
|
"tableFrom": "link",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"link_card_id_card_id_fk": {
|
||||||
|
"name": "link_card_id_card_id_fk",
|
||||||
|
"tableFrom": "link",
|
||||||
|
"tableTo": "card",
|
||||||
|
"columnsFrom": [
|
||||||
|
"card_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.session": {
|
||||||
|
"name": "session",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"expires_at": {
|
||||||
|
"name": "expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"token": {
|
||||||
|
"name": "token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"ip_address": {
|
||||||
|
"name": "ip_address",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"user_agent": {
|
||||||
|
"name": "user_agent",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"session_user_id_idx": {
|
||||||
|
"name": "session_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"session_user_id_user_id_fk": {
|
||||||
|
"name": "session_user_id_user_id_fk",
|
||||||
|
"tableFrom": "session",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"session_token_unique": {
|
||||||
|
"name": "session_token_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"token"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.settings": {
|
||||||
|
"name": "settings",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"name": "title",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'Dahoam'"
|
||||||
|
},
|
||||||
|
"search_engine": {
|
||||||
|
"name": "search_engine",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'duckduckgo'"
|
||||||
|
},
|
||||||
|
"wallpaper_url": {
|
||||||
|
"name": "wallpaper_url",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"wallpaper_dim": {
|
||||||
|
"name": "wallpaper_dim",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 40
|
||||||
|
},
|
||||||
|
"clock_font": {
|
||||||
|
"name": "clock_font",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'serif'"
|
||||||
|
},
|
||||||
|
"clock_style": {
|
||||||
|
"name": "clock_style",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'solid'"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"settings_user_id_user_id_fk": {
|
||||||
|
"name": "settings_user_id_user_id_fk",
|
||||||
|
"tableFrom": "settings",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.user": {
|
||||||
|
"name": "user",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"name": "email",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"email_verified": {
|
||||||
|
"name": "email_verified",
|
||||||
|
"type": "boolean",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"image": {
|
||||||
|
"name": "image",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"user_email_unique": {
|
||||||
|
"name": "user_email_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"email"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.verification": {
|
||||||
|
"name": "verification",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"identifier": {
|
||||||
|
"name": "identifier",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"name": "value",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"expires_at": {
|
||||||
|
"name": "expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"verification_identifier_idx": {
|
||||||
|
"name": "verification_identifier_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "identifier",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.wallpaper": {
|
||||||
|
"name": "wallpaper",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"mime": {
|
||||||
|
"name": "mime",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"name": "data",
|
||||||
|
"type": "bytea",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"wallpaper_user_id_user_id_fk": {
|
||||||
|
"name": "wallpaper_user_id_user_id_fk",
|
||||||
|
"tableFrom": "wallpaper",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enums": {},
|
||||||
|
"schemas": {},
|
||||||
|
"sequences": {},
|
||||||
|
"roles": {},
|
||||||
|
"policies": {},
|
||||||
|
"views": {},
|
||||||
|
"_meta": {
|
||||||
|
"columns": {},
|
||||||
|
"schemas": {},
|
||||||
|
"tables": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,883 @@
|
|||||||
|
{
|
||||||
|
"id": "7a2af09b-64c1-4ae0-8b47-a669a9e399f0",
|
||||||
|
"prevId": "4df576be-2fef-462c-affd-4aff0ab26918",
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"tables": {
|
||||||
|
"public.account": {
|
||||||
|
"name": "account",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"account_id": {
|
||||||
|
"name": "account_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"provider_id": {
|
||||||
|
"name": "provider_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"access_token": {
|
||||||
|
"name": "access_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"refresh_token": {
|
||||||
|
"name": "refresh_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"id_token": {
|
||||||
|
"name": "id_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"access_token_expires_at": {
|
||||||
|
"name": "access_token_expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"refresh_token_expires_at": {
|
||||||
|
"name": "refresh_token_expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"scope": {
|
||||||
|
"name": "scope",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"name": "password",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"account_user_id_idx": {
|
||||||
|
"name": "account_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"account_user_id_user_id_fk": {
|
||||||
|
"name": "account_user_id_user_id_fk",
|
||||||
|
"tableFrom": "account",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.card": {
|
||||||
|
"name": "card",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"dashboard_id": {
|
||||||
|
"name": "dashboard_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"card_user_id_idx": {
|
||||||
|
"name": "card_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"card_dashboard_id_idx": {
|
||||||
|
"name": "card_dashboard_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "dashboard_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"card_user_id_user_id_fk": {
|
||||||
|
"name": "card_user_id_user_id_fk",
|
||||||
|
"tableFrom": "card",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"card_dashboard_id_dashboard_id_fk": {
|
||||||
|
"name": "card_dashboard_id_dashboard_id_fk",
|
||||||
|
"tableFrom": "card",
|
||||||
|
"tableTo": "dashboard",
|
||||||
|
"columnsFrom": [
|
||||||
|
"dashboard_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.dashboard": {
|
||||||
|
"name": "dashboard",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"dashboard_user_id_idx": {
|
||||||
|
"name": "dashboard_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"dashboard_user_id_user_id_fk": {
|
||||||
|
"name": "dashboard_user_id_user_id_fk",
|
||||||
|
"tableFrom": "dashboard",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.icon": {
|
||||||
|
"name": "icon",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"mime": {
|
||||||
|
"name": "mime",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"name": "data",
|
||||||
|
"type": "bytea",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"icon_user_id_idx": {
|
||||||
|
"name": "icon_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"icon_user_id_user_id_fk": {
|
||||||
|
"name": "icon_user_id_user_id_fk",
|
||||||
|
"tableFrom": "icon",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.link": {
|
||||||
|
"name": "link",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"card_id": {
|
||||||
|
"name": "card_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"position": {
|
||||||
|
"name": "position",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"name": "url",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"icon": {
|
||||||
|
"name": "icon",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"link_user_id_idx": {
|
||||||
|
"name": "link_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"link_card_id_idx": {
|
||||||
|
"name": "link_card_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "card_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"link_user_id_user_id_fk": {
|
||||||
|
"name": "link_user_id_user_id_fk",
|
||||||
|
"tableFrom": "link",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"link_card_id_card_id_fk": {
|
||||||
|
"name": "link_card_id_card_id_fk",
|
||||||
|
"tableFrom": "link",
|
||||||
|
"tableTo": "card",
|
||||||
|
"columnsFrom": [
|
||||||
|
"card_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.session": {
|
||||||
|
"name": "session",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"expires_at": {
|
||||||
|
"name": "expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"token": {
|
||||||
|
"name": "token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"ip_address": {
|
||||||
|
"name": "ip_address",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"user_agent": {
|
||||||
|
"name": "user_agent",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"session_user_id_idx": {
|
||||||
|
"name": "session_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"session_user_id_user_id_fk": {
|
||||||
|
"name": "session_user_id_user_id_fk",
|
||||||
|
"tableFrom": "session",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"session_token_unique": {
|
||||||
|
"name": "session_token_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"token"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.settings": {
|
||||||
|
"name": "settings",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"name": "title",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'Dahoam'"
|
||||||
|
},
|
||||||
|
"default_dashboard_id": {
|
||||||
|
"name": "default_dashboard_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"search_engine": {
|
||||||
|
"name": "search_engine",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'duckduckgo'"
|
||||||
|
},
|
||||||
|
"wallpaper_url": {
|
||||||
|
"name": "wallpaper_url",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"wallpaper_dim": {
|
||||||
|
"name": "wallpaper_dim",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 40
|
||||||
|
},
|
||||||
|
"clock_font": {
|
||||||
|
"name": "clock_font",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'serif'"
|
||||||
|
},
|
||||||
|
"clock_style": {
|
||||||
|
"name": "clock_style",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'solid'"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"settings_user_id_user_id_fk": {
|
||||||
|
"name": "settings_user_id_user_id_fk",
|
||||||
|
"tableFrom": "settings",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"settings_default_dashboard_id_dashboard_id_fk": {
|
||||||
|
"name": "settings_default_dashboard_id_dashboard_id_fk",
|
||||||
|
"tableFrom": "settings",
|
||||||
|
"tableTo": "dashboard",
|
||||||
|
"columnsFrom": [
|
||||||
|
"default_dashboard_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "set null",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.user": {
|
||||||
|
"name": "user",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"name": "email",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"email_verified": {
|
||||||
|
"name": "email_verified",
|
||||||
|
"type": "boolean",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"image": {
|
||||||
|
"name": "image",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"user_email_unique": {
|
||||||
|
"name": "user_email_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"email"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.verification": {
|
||||||
|
"name": "verification",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"identifier": {
|
||||||
|
"name": "identifier",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"name": "value",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"expires_at": {
|
||||||
|
"name": "expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"verification_identifier_idx": {
|
||||||
|
"name": "verification_identifier_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "identifier",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.wallpaper": {
|
||||||
|
"name": "wallpaper",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"mime": {
|
||||||
|
"name": "mime",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"name": "data",
|
||||||
|
"type": "bytea",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"wallpaper_user_id_user_id_fk": {
|
||||||
|
"name": "wallpaper_user_id_user_id_fk",
|
||||||
|
"tableFrom": "wallpaper",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enums": {},
|
||||||
|
"schemas": {},
|
||||||
|
"sequences": {},
|
||||||
|
"roles": {},
|
||||||
|
"policies": {},
|
||||||
|
"views": {},
|
||||||
|
"_meta": {
|
||||||
|
"columns": {},
|
||||||
|
"schemas": {},
|
||||||
|
"tables": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,902 @@
|
|||||||
|
{
|
||||||
|
"id": "c89fef31-f0cf-4f87-8683-df4f9eb49fa8",
|
||||||
|
"prevId": "7a2af09b-64c1-4ae0-8b47-a669a9e399f0",
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"tables": {
|
||||||
|
"public.account": {
|
||||||
|
"name": "account",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"account_id": {
|
||||||
|
"name": "account_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"provider_id": {
|
||||||
|
"name": "provider_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"access_token": {
|
||||||
|
"name": "access_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"refresh_token": {
|
||||||
|
"name": "refresh_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"id_token": {
|
||||||
|
"name": "id_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"access_token_expires_at": {
|
||||||
|
"name": "access_token_expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"refresh_token_expires_at": {
|
||||||
|
"name": "refresh_token_expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"scope": {
|
||||||
|
"name": "scope",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"name": "password",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"account_user_id_idx": {
|
||||||
|
"name": "account_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"account_user_id_user_id_fk": {
|
||||||
|
"name": "account_user_id_user_id_fk",
|
||||||
|
"tableFrom": "account",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.card": {
|
||||||
|
"name": "card",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"dashboard_id": {
|
||||||
|
"name": "dashboard_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"card_user_id_idx": {
|
||||||
|
"name": "card_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"card_dashboard_id_idx": {
|
||||||
|
"name": "card_dashboard_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "dashboard_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"card_user_id_user_id_fk": {
|
||||||
|
"name": "card_user_id_user_id_fk",
|
||||||
|
"tableFrom": "card",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"card_dashboard_id_dashboard_id_fk": {
|
||||||
|
"name": "card_dashboard_id_dashboard_id_fk",
|
||||||
|
"tableFrom": "card",
|
||||||
|
"tableTo": "dashboard",
|
||||||
|
"columnsFrom": [
|
||||||
|
"dashboard_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.dashboard": {
|
||||||
|
"name": "dashboard",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"wallpaper_url": {
|
||||||
|
"name": "wallpaper_url",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"wallpaper_dim": {
|
||||||
|
"name": "wallpaper_dim",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 40
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"dashboard_user_id_idx": {
|
||||||
|
"name": "dashboard_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"dashboard_user_id_user_id_fk": {
|
||||||
|
"name": "dashboard_user_id_user_id_fk",
|
||||||
|
"tableFrom": "dashboard",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.icon": {
|
||||||
|
"name": "icon",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"mime": {
|
||||||
|
"name": "mime",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"name": "data",
|
||||||
|
"type": "bytea",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"icon_user_id_idx": {
|
||||||
|
"name": "icon_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"icon_user_id_user_id_fk": {
|
||||||
|
"name": "icon_user_id_user_id_fk",
|
||||||
|
"tableFrom": "icon",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.link": {
|
||||||
|
"name": "link",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"card_id": {
|
||||||
|
"name": "card_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"position": {
|
||||||
|
"name": "position",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"name": "url",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"icon": {
|
||||||
|
"name": "icon",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"link_user_id_idx": {
|
||||||
|
"name": "link_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"link_card_id_idx": {
|
||||||
|
"name": "link_card_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "card_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"link_user_id_user_id_fk": {
|
||||||
|
"name": "link_user_id_user_id_fk",
|
||||||
|
"tableFrom": "link",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"link_card_id_card_id_fk": {
|
||||||
|
"name": "link_card_id_card_id_fk",
|
||||||
|
"tableFrom": "link",
|
||||||
|
"tableTo": "card",
|
||||||
|
"columnsFrom": [
|
||||||
|
"card_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.session": {
|
||||||
|
"name": "session",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"expires_at": {
|
||||||
|
"name": "expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"token": {
|
||||||
|
"name": "token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"ip_address": {
|
||||||
|
"name": "ip_address",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"user_agent": {
|
||||||
|
"name": "user_agent",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"session_user_id_idx": {
|
||||||
|
"name": "session_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"session_user_id_user_id_fk": {
|
||||||
|
"name": "session_user_id_user_id_fk",
|
||||||
|
"tableFrom": "session",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"session_token_unique": {
|
||||||
|
"name": "session_token_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"token"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.settings": {
|
||||||
|
"name": "settings",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"name": "title",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'Dahoam'"
|
||||||
|
},
|
||||||
|
"default_dashboard_id": {
|
||||||
|
"name": "default_dashboard_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"search_engine": {
|
||||||
|
"name": "search_engine",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'duckduckgo'"
|
||||||
|
},
|
||||||
|
"clock_font": {
|
||||||
|
"name": "clock_font",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'serif'"
|
||||||
|
},
|
||||||
|
"clock_style": {
|
||||||
|
"name": "clock_style",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'solid'"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"settings_user_id_user_id_fk": {
|
||||||
|
"name": "settings_user_id_user_id_fk",
|
||||||
|
"tableFrom": "settings",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"settings_default_dashboard_id_dashboard_id_fk": {
|
||||||
|
"name": "settings_default_dashboard_id_dashboard_id_fk",
|
||||||
|
"tableFrom": "settings",
|
||||||
|
"tableTo": "dashboard",
|
||||||
|
"columnsFrom": [
|
||||||
|
"default_dashboard_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "set null",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.user": {
|
||||||
|
"name": "user",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"name": "email",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"email_verified": {
|
||||||
|
"name": "email_verified",
|
||||||
|
"type": "boolean",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"image": {
|
||||||
|
"name": "image",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"user_email_unique": {
|
||||||
|
"name": "user_email_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"email"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.verification": {
|
||||||
|
"name": "verification",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"identifier": {
|
||||||
|
"name": "identifier",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"name": "value",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"expires_at": {
|
||||||
|
"name": "expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"verification_identifier_idx": {
|
||||||
|
"name": "verification_identifier_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "identifier",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.wallpaper": {
|
||||||
|
"name": "wallpaper",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"dashboard_id": {
|
||||||
|
"name": "dashboard_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"mime": {
|
||||||
|
"name": "mime",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"name": "data",
|
||||||
|
"type": "bytea",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"wallpaper_dashboard_id_dashboard_id_fk": {
|
||||||
|
"name": "wallpaper_dashboard_id_dashboard_id_fk",
|
||||||
|
"tableFrom": "wallpaper",
|
||||||
|
"tableTo": "dashboard",
|
||||||
|
"columnsFrom": [
|
||||||
|
"dashboard_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"wallpaper_user_id_user_id_fk": {
|
||||||
|
"name": "wallpaper_user_id_user_id_fk",
|
||||||
|
"tableFrom": "wallpaper",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enums": {},
|
||||||
|
"schemas": {},
|
||||||
|
"sequences": {},
|
||||||
|
"roles": {},
|
||||||
|
"policies": {},
|
||||||
|
"views": {},
|
||||||
|
"_meta": {
|
||||||
|
"columns": {},
|
||||||
|
"schemas": {},
|
||||||
|
"tables": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,909 @@
|
|||||||
|
{
|
||||||
|
"id": "eddd02da-41ed-40a6-b0b0-e5976ea2c371",
|
||||||
|
"prevId": "c89fef31-f0cf-4f87-8683-df4f9eb49fa8",
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"tables": {
|
||||||
|
"public.account": {
|
||||||
|
"name": "account",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"account_id": {
|
||||||
|
"name": "account_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"provider_id": {
|
||||||
|
"name": "provider_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"access_token": {
|
||||||
|
"name": "access_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"refresh_token": {
|
||||||
|
"name": "refresh_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"id_token": {
|
||||||
|
"name": "id_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"access_token_expires_at": {
|
||||||
|
"name": "access_token_expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"refresh_token_expires_at": {
|
||||||
|
"name": "refresh_token_expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"scope": {
|
||||||
|
"name": "scope",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"name": "password",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"account_user_id_idx": {
|
||||||
|
"name": "account_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"account_user_id_user_id_fk": {
|
||||||
|
"name": "account_user_id_user_id_fk",
|
||||||
|
"tableFrom": "account",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.card": {
|
||||||
|
"name": "card",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"dashboard_id": {
|
||||||
|
"name": "dashboard_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"position": {
|
||||||
|
"name": "position",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"card_user_id_idx": {
|
||||||
|
"name": "card_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"card_dashboard_id_idx": {
|
||||||
|
"name": "card_dashboard_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "dashboard_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"card_user_id_user_id_fk": {
|
||||||
|
"name": "card_user_id_user_id_fk",
|
||||||
|
"tableFrom": "card",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"card_dashboard_id_dashboard_id_fk": {
|
||||||
|
"name": "card_dashboard_id_dashboard_id_fk",
|
||||||
|
"tableFrom": "card",
|
||||||
|
"tableTo": "dashboard",
|
||||||
|
"columnsFrom": [
|
||||||
|
"dashboard_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.dashboard": {
|
||||||
|
"name": "dashboard",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"wallpaper_url": {
|
||||||
|
"name": "wallpaper_url",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"wallpaper_dim": {
|
||||||
|
"name": "wallpaper_dim",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 40
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"dashboard_user_id_idx": {
|
||||||
|
"name": "dashboard_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"dashboard_user_id_user_id_fk": {
|
||||||
|
"name": "dashboard_user_id_user_id_fk",
|
||||||
|
"tableFrom": "dashboard",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.icon": {
|
||||||
|
"name": "icon",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"mime": {
|
||||||
|
"name": "mime",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"name": "data",
|
||||||
|
"type": "bytea",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"icon_user_id_idx": {
|
||||||
|
"name": "icon_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"icon_user_id_user_id_fk": {
|
||||||
|
"name": "icon_user_id_user_id_fk",
|
||||||
|
"tableFrom": "icon",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.link": {
|
||||||
|
"name": "link",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"card_id": {
|
||||||
|
"name": "card_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"position": {
|
||||||
|
"name": "position",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"name": "url",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"icon": {
|
||||||
|
"name": "icon",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"link_user_id_idx": {
|
||||||
|
"name": "link_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"link_card_id_idx": {
|
||||||
|
"name": "link_card_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "card_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"link_user_id_user_id_fk": {
|
||||||
|
"name": "link_user_id_user_id_fk",
|
||||||
|
"tableFrom": "link",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"link_card_id_card_id_fk": {
|
||||||
|
"name": "link_card_id_card_id_fk",
|
||||||
|
"tableFrom": "link",
|
||||||
|
"tableTo": "card",
|
||||||
|
"columnsFrom": [
|
||||||
|
"card_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.session": {
|
||||||
|
"name": "session",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"expires_at": {
|
||||||
|
"name": "expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"token": {
|
||||||
|
"name": "token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"ip_address": {
|
||||||
|
"name": "ip_address",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"user_agent": {
|
||||||
|
"name": "user_agent",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"session_user_id_idx": {
|
||||||
|
"name": "session_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"session_user_id_user_id_fk": {
|
||||||
|
"name": "session_user_id_user_id_fk",
|
||||||
|
"tableFrom": "session",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"session_token_unique": {
|
||||||
|
"name": "session_token_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"token"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.settings": {
|
||||||
|
"name": "settings",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"name": "title",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'Dahoam'"
|
||||||
|
},
|
||||||
|
"default_dashboard_id": {
|
||||||
|
"name": "default_dashboard_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"search_engine": {
|
||||||
|
"name": "search_engine",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'duckduckgo'"
|
||||||
|
},
|
||||||
|
"clock_font": {
|
||||||
|
"name": "clock_font",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'serif'"
|
||||||
|
},
|
||||||
|
"clock_style": {
|
||||||
|
"name": "clock_style",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'solid'"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"settings_user_id_user_id_fk": {
|
||||||
|
"name": "settings_user_id_user_id_fk",
|
||||||
|
"tableFrom": "settings",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"settings_default_dashboard_id_dashboard_id_fk": {
|
||||||
|
"name": "settings_default_dashboard_id_dashboard_id_fk",
|
||||||
|
"tableFrom": "settings",
|
||||||
|
"tableTo": "dashboard",
|
||||||
|
"columnsFrom": [
|
||||||
|
"default_dashboard_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "set null",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.user": {
|
||||||
|
"name": "user",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"name": "email",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"email_verified": {
|
||||||
|
"name": "email_verified",
|
||||||
|
"type": "boolean",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"image": {
|
||||||
|
"name": "image",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"user_email_unique": {
|
||||||
|
"name": "user_email_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"email"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.verification": {
|
||||||
|
"name": "verification",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"identifier": {
|
||||||
|
"name": "identifier",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"name": "value",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"expires_at": {
|
||||||
|
"name": "expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"verification_identifier_idx": {
|
||||||
|
"name": "verification_identifier_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "identifier",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.wallpaper": {
|
||||||
|
"name": "wallpaper",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"dashboard_id": {
|
||||||
|
"name": "dashboard_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"mime": {
|
||||||
|
"name": "mime",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"name": "data",
|
||||||
|
"type": "bytea",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"wallpaper_dashboard_id_dashboard_id_fk": {
|
||||||
|
"name": "wallpaper_dashboard_id_dashboard_id_fk",
|
||||||
|
"tableFrom": "wallpaper",
|
||||||
|
"tableTo": "dashboard",
|
||||||
|
"columnsFrom": [
|
||||||
|
"dashboard_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"wallpaper_user_id_user_id_fk": {
|
||||||
|
"name": "wallpaper_user_id_user_id_fk",
|
||||||
|
"tableFrom": "wallpaper",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enums": {},
|
||||||
|
"schemas": {},
|
||||||
|
"sequences": {},
|
||||||
|
"roles": {},
|
||||||
|
"policies": {},
|
||||||
|
"views": {},
|
||||||
|
"_meta": {
|
||||||
|
"columns": {},
|
||||||
|
"schemas": {},
|
||||||
|
"tables": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,916 @@
|
|||||||
|
{
|
||||||
|
"id": "c4525c58-c6aa-4d91-a377-92f7483f75fd",
|
||||||
|
"prevId": "eddd02da-41ed-40a6-b0b0-e5976ea2c371",
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"tables": {
|
||||||
|
"public.account": {
|
||||||
|
"name": "account",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"account_id": {
|
||||||
|
"name": "account_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"provider_id": {
|
||||||
|
"name": "provider_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"access_token": {
|
||||||
|
"name": "access_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"refresh_token": {
|
||||||
|
"name": "refresh_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"id_token": {
|
||||||
|
"name": "id_token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"access_token_expires_at": {
|
||||||
|
"name": "access_token_expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"refresh_token_expires_at": {
|
||||||
|
"name": "refresh_token_expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"scope": {
|
||||||
|
"name": "scope",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"name": "password",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"account_user_id_idx": {
|
||||||
|
"name": "account_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"account_user_id_user_id_fk": {
|
||||||
|
"name": "account_user_id_user_id_fk",
|
||||||
|
"tableFrom": "account",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.card": {
|
||||||
|
"name": "card",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"dashboard_id": {
|
||||||
|
"name": "dashboard_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"position": {
|
||||||
|
"name": "position",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"card_user_id_idx": {
|
||||||
|
"name": "card_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"card_dashboard_id_idx": {
|
||||||
|
"name": "card_dashboard_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "dashboard_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"card_user_id_user_id_fk": {
|
||||||
|
"name": "card_user_id_user_id_fk",
|
||||||
|
"tableFrom": "card",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"card_dashboard_id_dashboard_id_fk": {
|
||||||
|
"name": "card_dashboard_id_dashboard_id_fk",
|
||||||
|
"tableFrom": "card",
|
||||||
|
"tableTo": "dashboard",
|
||||||
|
"columnsFrom": [
|
||||||
|
"dashboard_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.dashboard": {
|
||||||
|
"name": "dashboard",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"position": {
|
||||||
|
"name": "position",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"wallpaper_url": {
|
||||||
|
"name": "wallpaper_url",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"wallpaper_dim": {
|
||||||
|
"name": "wallpaper_dim",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 40
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"dashboard_user_id_idx": {
|
||||||
|
"name": "dashboard_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"dashboard_user_id_user_id_fk": {
|
||||||
|
"name": "dashboard_user_id_user_id_fk",
|
||||||
|
"tableFrom": "dashboard",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.icon": {
|
||||||
|
"name": "icon",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"mime": {
|
||||||
|
"name": "mime",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"name": "data",
|
||||||
|
"type": "bytea",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"icon_user_id_idx": {
|
||||||
|
"name": "icon_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"icon_user_id_user_id_fk": {
|
||||||
|
"name": "icon_user_id_user_id_fk",
|
||||||
|
"tableFrom": "icon",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.link": {
|
||||||
|
"name": "link",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"card_id": {
|
||||||
|
"name": "card_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"position": {
|
||||||
|
"name": "position",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"name": "url",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"icon": {
|
||||||
|
"name": "icon",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"link_user_id_idx": {
|
||||||
|
"name": "link_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"link_card_id_idx": {
|
||||||
|
"name": "link_card_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "card_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"link_user_id_user_id_fk": {
|
||||||
|
"name": "link_user_id_user_id_fk",
|
||||||
|
"tableFrom": "link",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"link_card_id_card_id_fk": {
|
||||||
|
"name": "link_card_id_card_id_fk",
|
||||||
|
"tableFrom": "link",
|
||||||
|
"tableTo": "card",
|
||||||
|
"columnsFrom": [
|
||||||
|
"card_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.session": {
|
||||||
|
"name": "session",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"expires_at": {
|
||||||
|
"name": "expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"token": {
|
||||||
|
"name": "token",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"ip_address": {
|
||||||
|
"name": "ip_address",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"user_agent": {
|
||||||
|
"name": "user_agent",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"session_user_id_idx": {
|
||||||
|
"name": "session_user_id_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "user_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"session_user_id_user_id_fk": {
|
||||||
|
"name": "session_user_id_user_id_fk",
|
||||||
|
"tableFrom": "session",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"session_token_unique": {
|
||||||
|
"name": "session_token_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"token"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.settings": {
|
||||||
|
"name": "settings",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"name": "title",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'Dahoam'"
|
||||||
|
},
|
||||||
|
"default_dashboard_id": {
|
||||||
|
"name": "default_dashboard_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"search_engine": {
|
||||||
|
"name": "search_engine",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'duckduckgo'"
|
||||||
|
},
|
||||||
|
"clock_font": {
|
||||||
|
"name": "clock_font",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'serif'"
|
||||||
|
},
|
||||||
|
"clock_style": {
|
||||||
|
"name": "clock_style",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'solid'"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"settings_user_id_user_id_fk": {
|
||||||
|
"name": "settings_user_id_user_id_fk",
|
||||||
|
"tableFrom": "settings",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"settings_default_dashboard_id_dashboard_id_fk": {
|
||||||
|
"name": "settings_default_dashboard_id_dashboard_id_fk",
|
||||||
|
"tableFrom": "settings",
|
||||||
|
"tableTo": "dashboard",
|
||||||
|
"columnsFrom": [
|
||||||
|
"default_dashboard_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "set null",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.user": {
|
||||||
|
"name": "user",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"name": "email",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"email_verified": {
|
||||||
|
"name": "email_verified",
|
||||||
|
"type": "boolean",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"image": {
|
||||||
|
"name": "image",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {
|
||||||
|
"user_email_unique": {
|
||||||
|
"name": "user_email_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"email"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.verification": {
|
||||||
|
"name": "verification",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"identifier": {
|
||||||
|
"name": "identifier",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"name": "value",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"expires_at": {
|
||||||
|
"name": "expires_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"verification_identifier_idx": {
|
||||||
|
"name": "verification_identifier_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "identifier",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.wallpaper": {
|
||||||
|
"name": "wallpaper",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"dashboard_id": {
|
||||||
|
"name": "dashboard_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"user_id": {
|
||||||
|
"name": "user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"mime": {
|
||||||
|
"name": "mime",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"name": "data",
|
||||||
|
"type": "bytea",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"wallpaper_dashboard_id_dashboard_id_fk": {
|
||||||
|
"name": "wallpaper_dashboard_id_dashboard_id_fk",
|
||||||
|
"tableFrom": "wallpaper",
|
||||||
|
"tableTo": "dashboard",
|
||||||
|
"columnsFrom": [
|
||||||
|
"dashboard_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"wallpaper_user_id_user_id_fk": {
|
||||||
|
"name": "wallpaper_user_id_user_id_fk",
|
||||||
|
"tableFrom": "wallpaper",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enums": {},
|
||||||
|
"schemas": {},
|
||||||
|
"sequences": {},
|
||||||
|
"roles": {},
|
||||||
|
"policies": {},
|
||||||
|
"views": {},
|
||||||
|
"_meta": {
|
||||||
|
"columns": {},
|
||||||
|
"schemas": {},
|
||||||
|
"tables": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,6 +29,48 @@
|
|||||||
"when": 1794956525569,
|
"when": 1794956525569,
|
||||||
"tag": "0003_default_title",
|
"tag": "0003_default_title",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 4,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1795017311884,
|
||||||
|
"tag": "0004_clock",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 5,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1795017884385,
|
||||||
|
"tag": "0005_wallpaper_dim",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 6,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1795020380796,
|
||||||
|
"tag": "0006_dashboards_icons",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 7,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1795021173823,
|
||||||
|
"tag": "0007_dashboard_wallpaper",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 8,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1795106775546,
|
||||||
|
"tag": "0008_card_position",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 9,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1795285309906,
|
||||||
|
"tag": "0009_dashboard_position",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,8 @@
|
|||||||
"@dnd-kit/sortable": "^10.0.0",
|
"@dnd-kit/sortable": "^10.0.0",
|
||||||
"@dnd-kit/utilities": "^3.2.2",
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
"@fontsource-variable/inter": "^5.3.0",
|
"@fontsource-variable/inter": "^5.3.0",
|
||||||
|
"@fontsource-variable/nunito": "^5.3.0",
|
||||||
|
"@fontsource-variable/roboto-slab": "^5.3.0",
|
||||||
"@fontsource/dm-serif-display": "^5.3.0",
|
"@fontsource/dm-serif-display": "^5.3.0",
|
||||||
"@tailwindcss/vite": "^4",
|
"@tailwindcss/vite": "^4",
|
||||||
"@tanstack/react-devtools": "latest",
|
"@tanstack/react-devtools": "latest",
|
||||||
|
|||||||
Generated
+16
@@ -178,6 +178,12 @@ importers:
|
|||||||
'@fontsource-variable/inter':
|
'@fontsource-variable/inter':
|
||||||
specifier: ^5.3.0
|
specifier: ^5.3.0
|
||||||
version: 5.3.0
|
version: 5.3.0
|
||||||
|
'@fontsource-variable/nunito':
|
||||||
|
specifier: ^5.3.0
|
||||||
|
version: 5.3.0
|
||||||
|
'@fontsource-variable/roboto-slab':
|
||||||
|
specifier: ^5.3.0
|
||||||
|
version: 5.3.0
|
||||||
'@fontsource/dm-serif-display':
|
'@fontsource/dm-serif-display':
|
||||||
specifier: ^5.3.0
|
specifier: ^5.3.0
|
||||||
version: 5.3.0
|
version: 5.3.0
|
||||||
@@ -970,6 +976,12 @@ packages:
|
|||||||
'@fontsource-variable/inter@5.3.0':
|
'@fontsource-variable/inter@5.3.0':
|
||||||
resolution: {integrity: sha512-OupL48va4JNofb97w6NYeF9S7W/kHNKM0Er8Dem5nqi4jeOLrVJDoE8tZEpnMJmtkvNbB1EIPPwHcdkF6b1oUA==}
|
resolution: {integrity: sha512-OupL48va4JNofb97w6NYeF9S7W/kHNKM0Er8Dem5nqi4jeOLrVJDoE8tZEpnMJmtkvNbB1EIPPwHcdkF6b1oUA==}
|
||||||
|
|
||||||
|
'@fontsource-variable/nunito@5.3.0':
|
||||||
|
resolution: {integrity: sha512-tw0ch7evIDSwoeUy+0XzocYHfbRWLeCRPJy22KgbrLjDLAbNw/fErBiil10Ssrs3Sjr55zaZrr36a975j8cBkQ==}
|
||||||
|
|
||||||
|
'@fontsource-variable/roboto-slab@5.3.0':
|
||||||
|
resolution: {integrity: sha512-eByKAjLM9td0qsXCOZhlUGfhsjen//epd6/cAJOg+o73RtYBijrI1jz+lTp2X0ebwTCLmKB1+Kt/QiRMgmNPTw==}
|
||||||
|
|
||||||
'@fontsource/dm-serif-display@5.3.0':
|
'@fontsource/dm-serif-display@5.3.0':
|
||||||
resolution: {integrity: sha512-ecRclUcYeto9fB7ghkB36H4MtUoaUYFjjornWYYeLCMHzaWEDPk2kIWgZOq0mKBNRxclRSieKcFeLonlMYDTKg==}
|
resolution: {integrity: sha512-ecRclUcYeto9fB7ghkB36H4MtUoaUYFjjornWYYeLCMHzaWEDPk2kIWgZOq0mKBNRxclRSieKcFeLonlMYDTKg==}
|
||||||
|
|
||||||
@@ -4254,6 +4266,10 @@ snapshots:
|
|||||||
|
|
||||||
'@fontsource-variable/inter@5.3.0': {}
|
'@fontsource-variable/inter@5.3.0': {}
|
||||||
|
|
||||||
|
'@fontsource-variable/nunito@5.3.0': {}
|
||||||
|
|
||||||
|
'@fontsource-variable/roboto-slab@5.3.0': {}
|
||||||
|
|
||||||
'@fontsource/dm-serif-display@5.3.0': {}
|
'@fontsource/dm-serif-display@5.3.0': {}
|
||||||
|
|
||||||
'@humanfs/core@0.19.2':
|
'@humanfs/core@0.19.2':
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import {
|
|||||||
FieldError,
|
FieldError,
|
||||||
FieldLabel,
|
FieldLabel,
|
||||||
Input,
|
Input,
|
||||||
|
Select,
|
||||||
|
SelectOption,
|
||||||
} from "@/vendor/collabry/components/Field/Field"
|
} from "@/vendor/collabry/components/Field/Field"
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
@@ -21,19 +23,34 @@ import {
|
|||||||
|
|
||||||
export type CardTarget = { id: string; name: string; links: unknown[] } | "new"
|
export type CardTarget = { id: string; name: string; links: unknown[] } | "new"
|
||||||
|
|
||||||
/** `card` is the card to edit, "new" to add one, or null when closed. */
|
type Dashboards = { id: string; name: string }[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `card` is the card to edit, "new" to add one, or null when closed.
|
||||||
|
* `dashboardId` is the open dashboard: where a new card goes, and where a card is
|
||||||
|
* until another of `dashboards` is chosen for it.
|
||||||
|
*/
|
||||||
export function CardDialog({
|
export function CardDialog({
|
||||||
card,
|
card,
|
||||||
|
dashboardId,
|
||||||
|
dashboards,
|
||||||
onClose,
|
onClose,
|
||||||
}: {
|
}: {
|
||||||
card: CardTarget | null
|
card: CardTarget | null
|
||||||
|
dashboardId: string
|
||||||
|
dashboards: Dashboards
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Dialog open={!!card} onOpenChange={(open) => !open && onClose()}>
|
<Dialog open={!!card} onOpenChange={(open) => !open && onClose()}>
|
||||||
<GlassDialogContent>
|
<GlassDialogContent>
|
||||||
{card && (
|
{card && (
|
||||||
<CardForm card={card === "new" ? null : card} onClose={onClose} />
|
<CardForm
|
||||||
|
card={card === "new" ? null : card}
|
||||||
|
dashboardId={dashboardId}
|
||||||
|
dashboards={dashboards}
|
||||||
|
onClose={onClose}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</GlassDialogContent>
|
</GlassDialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@@ -42,9 +59,13 @@ export function CardDialog({
|
|||||||
|
|
||||||
function CardForm({
|
function CardForm({
|
||||||
card,
|
card,
|
||||||
|
dashboardId,
|
||||||
|
dashboards,
|
||||||
onClose,
|
onClose,
|
||||||
}: {
|
}: {
|
||||||
card: Exclude<CardTarget, "new"> | null
|
card: Exclude<CardTarget, "new"> | null
|
||||||
|
dashboardId: string
|
||||||
|
dashboards: Dashboards
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -71,8 +92,17 @@ function CardForm({
|
|||||||
<form
|
<form
|
||||||
onSubmit={(e) => {
|
onSubmit={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const name = String(new FormData(e.currentTarget).get("name"))
|
const form = new FormData(e.currentTarget)
|
||||||
void submit(() => saveCard({ data: { id: card?.id, name } }))
|
void submit(() =>
|
||||||
|
saveCard({
|
||||||
|
data: {
|
||||||
|
id: card?.id,
|
||||||
|
name: String(form.get("name")),
|
||||||
|
// without the field there is only one dashboard
|
||||||
|
dashboardId: String(form.get("dashboardId") ?? dashboardId),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
@@ -92,6 +122,18 @@ function CardForm({
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
{dashboards.length > 1 && (
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>Dashboard</FieldLabel>
|
||||||
|
<Select name="dashboardId" defaultValue={dashboardId}>
|
||||||
|
{dashboards.map((d) => (
|
||||||
|
<SelectOption key={d.id} value={d.id}>
|
||||||
|
{d.name}
|
||||||
|
</SelectOption>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</Field>
|
||||||
|
)}
|
||||||
{error && <FieldError role="alert">{error}</FieldError>}
|
{error && <FieldError role="alert">{error}</FieldError>}
|
||||||
</DialogBody>
|
</DialogBody>
|
||||||
<DialogFooter className="justify-between">
|
<DialogFooter className="justify-between">
|
||||||
|
|||||||
+110
-44
@@ -8,7 +8,6 @@ import {
|
|||||||
TouchSensor,
|
TouchSensor,
|
||||||
closestCenter,
|
closestCenter,
|
||||||
pointerWithin,
|
pointerWithin,
|
||||||
useDroppable,
|
|
||||||
useSensor,
|
useSensor,
|
||||||
useSensors,
|
useSensors,
|
||||||
} from "@dnd-kit/core"
|
} from "@dnd-kit/core"
|
||||||
@@ -21,13 +20,14 @@ import {
|
|||||||
SortableContext,
|
SortableContext,
|
||||||
rectSortingStrategy,
|
rectSortingStrategy,
|
||||||
sortableKeyboardCoordinates,
|
sortableKeyboardCoordinates,
|
||||||
|
useSortable,
|
||||||
} from "@dnd-kit/sortable"
|
} from "@dnd-kit/sortable"
|
||||||
import { Plus } from "lucide-react"
|
import { GripVertical, Plus } from "lucide-react"
|
||||||
import { glass } from "@/components/glass"
|
import { glass } from "@/components/glass"
|
||||||
import { LinkTile, TileFace } from "@/components/link-tile"
|
import { LinkTile, TileFace } from "@/components/link-tile"
|
||||||
import type { HomeLink } from "@/components/link-tile"
|
import type { HomeLink } from "@/components/link-tile"
|
||||||
import { moveLinks } from "@/lib/dashboard.functions"
|
import { saveLayout } from "@/lib/dashboard.functions"
|
||||||
import { drop, moveOver, order } from "@/lib/layout"
|
import { drop, moveCard, moveOver, order } from "@/lib/layout"
|
||||||
import { Button } from "@/vendor/collabry/components/Button/Button"
|
import { Button } from "@/vendor/collabry/components/Button/Button"
|
||||||
import { cn } from "@/vendor/collabry/lib/cn"
|
import { cn } from "@/vendor/collabry/lib/cn"
|
||||||
|
|
||||||
@@ -39,20 +39,25 @@ type Handlers = {
|
|||||||
onEditCard: (card: DashCard) => void
|
onEditCard: (card: DashCard) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The cards with their links. Links can be dragged inside a card and between cards. */
|
/**
|
||||||
|
* The cards with their links. Links can be dragged inside a card and between cards,
|
||||||
|
* cards by their title bar.
|
||||||
|
*/
|
||||||
export function CardGrid({
|
export function CardGrid({
|
||||||
cards: saved,
|
cards: saved,
|
||||||
onAddCard,
|
onAddCard,
|
||||||
...handlers
|
...handlers
|
||||||
}: { cards: DashCard[]; onAddCard: () => void } & Handlers) {
|
}: { cards: DashCard[]; onAddCard: () => void } & Handlers) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
// the layout while a link is dragged, and until the server has stored it
|
// the layout while a link or a card is dragged, and until the server has stored it
|
||||||
const [dragged, setDragged] = useState<DashCard[] | null>(null)
|
const [dragged, setDragged] = useState<DashCard[] | null>(null)
|
||||||
const [activeId, setActiveId] = useState<UniqueIdentifier | null>(null)
|
const [activeId, setActiveId] = useState<UniqueIdentifier | null>(null)
|
||||||
const drags = useRef(0)
|
const drags = useRef(0)
|
||||||
const cards = dragged ?? saved
|
const cards = dragged ?? saved
|
||||||
const links = cards.flatMap((c) => c.links)
|
const links = cards.flatMap((c) => c.links)
|
||||||
const active = links.find((l) => l.id === activeId)
|
const active = links.find((l) => l.id === activeId)
|
||||||
|
const activeCard = cards.find((c) => c.id === activeId)
|
||||||
|
const isCard = (id: UniqueIdentifier) => cards.some((c) => c.id === id)
|
||||||
|
|
||||||
const sensors = useSensors(
|
const sensors = useSensors(
|
||||||
// a few pixels of slack, so a plain click still opens the link
|
// a few pixels of slack, so a plain click still opens the link
|
||||||
@@ -82,10 +87,17 @@ export function CardGrid({
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
const cardArgs = only(cards.map((c) => c.id))
|
const cardArgs = only(cards.map((c) => c.id))
|
||||||
// the keyboard has no pointer: take the nearest card then
|
const dragsCard = isCard(args.active.id)
|
||||||
const hit = pointerWithin(cardArgs).at(0) ?? closestCenter(cardArgs).at(0)
|
// The keyboard has no pointer: take the nearest card then. A dragged card waits
|
||||||
|
// while the pointer is between cards: the nearest one could swap it back and forth.
|
||||||
|
const hit =
|
||||||
|
pointerWithin(cardArgs).at(0) ??
|
||||||
|
(dragsCard && args.pointerCoordinates
|
||||||
|
? undefined
|
||||||
|
: closestCenter(cardArgs).at(0))
|
||||||
const card = cards.find((c) => c.id === hit?.id)
|
const card = cards.find((c) => c.id === hit?.id)
|
||||||
if (!hit || !card) return []
|
if (!hit || !card) return []
|
||||||
|
if (dragsCard) return [hit]
|
||||||
const nearest = closestCenter(only(card.links.map((l) => l.id)))
|
const nearest = closestCenter(only(card.links.map((l) => l.id)))
|
||||||
return nearest.length ? nearest : [hit]
|
return nearest.length ? nearest : [hit]
|
||||||
}
|
}
|
||||||
@@ -97,7 +109,7 @@ export function CardGrid({
|
|||||||
setDragged(next)
|
setDragged(next)
|
||||||
const drag = drags.current
|
const drag = drags.current
|
||||||
// on failure the reload below puts the links back where they were
|
// on failure the reload below puts the links back where they were
|
||||||
await moveLinks({ data: { cards: order(next) } }).catch(() => {})
|
await saveLayout({ data: { cards: order(next) } }).catch(() => {})
|
||||||
await router.invalidate()
|
await router.invalidate()
|
||||||
// a newer drag owns the layout by now
|
// a newer drag owns the layout by now
|
||||||
if (drags.current === drag) setDragged(null)
|
if (drags.current === drag) setDragged(null)
|
||||||
@@ -110,12 +122,18 @@ export function CardGrid({
|
|||||||
cards.find((c) => c.id === id || c.links.some((l) => l.id === id))?.name
|
cards.find((c) => c.id === id || c.links.some((l) => l.id === id))?.name
|
||||||
const announcements: Announcements = {
|
const announcements: Announcements = {
|
||||||
onDragStart: ({ active: a }) => `Picked up ${name(a.id)}.`,
|
onDragStart: ({ active: a }) => `Picked up ${name(a.id)}.`,
|
||||||
onDragOver: ({ active: a, over }) =>
|
onDragOver: ({ active: a, over }) => {
|
||||||
over ? `${name(a.id)} is in ${cardName(over.id)}.` : undefined,
|
if (!over || over.id === a.id) return
|
||||||
|
return isCard(a.id)
|
||||||
|
? `${name(a.id)} took the place of ${name(over.id)}.`
|
||||||
|
: `${name(a.id)} is in ${cardName(over.id)}.`
|
||||||
|
},
|
||||||
onDragEnd: ({ active: a, over }) =>
|
onDragEnd: ({ active: a, over }) =>
|
||||||
over
|
isCard(a.id)
|
||||||
? `${name(a.id)} was put down in ${cardName(over.id)}.`
|
? `${name(a.id)} was put down.`
|
||||||
: `${name(a.id)} was put back.`,
|
: over
|
||||||
|
? `${name(a.id)} was put down in ${cardName(over.id)}.`
|
||||||
|
: `${name(a.id)} was put back.`,
|
||||||
onDragCancel: ({ active: a }) => `${name(a.id)} was put back.`,
|
onDragCancel: ({ active: a }) => `${name(a.id)} was put back.`,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +150,10 @@ export function CardGrid({
|
|||||||
setDragged(cards)
|
setDragged(cards)
|
||||||
}}
|
}}
|
||||||
onDragOver={({ active: a, over }) => {
|
onDragOver={({ active: a, over }) => {
|
||||||
if (over) setDragged(moveOver(cards, String(a.id), String(over.id)))
|
if (!over) return
|
||||||
|
// each of the two leaves the other kind of drag alone
|
||||||
|
const [id, overId] = [String(a.id), String(over.id)]
|
||||||
|
setDragged(moveCard(moveOver(cards, id, overId), id, overId))
|
||||||
}}
|
}}
|
||||||
onDragEnd={({ active: a, over }) =>
|
onDragEnd={({ active: a, over }) =>
|
||||||
finish(over ? drop(cards, String(a.id), String(over.id)) : cards)
|
finish(over ? drop(cards, String(a.id), String(over.id)) : cards)
|
||||||
@@ -142,18 +163,22 @@ export function CardGrid({
|
|||||||
setDragged(null)
|
setDragged(null)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* cards in a row share a height, so their edges line up */}
|
{/* A dragged card moves in the list itself (onDragOver), so no strategy shifts
|
||||||
<div className="flex w-full max-w-6xl flex-wrap justify-center gap-4">
|
the others: cards differ in size, and a shifted one would not fit its slot. */}
|
||||||
{cards.map((card) => (
|
<SortableContext items={cards.map((c) => c.id)} strategy={() => null}>
|
||||||
<CardPanel
|
{/* cards in a row share a height, so their edges line up */}
|
||||||
key={card.id}
|
<div className="flex w-full max-w-6xl flex-wrap justify-center gap-4">
|
||||||
card={card}
|
{cards.map((card) => (
|
||||||
// the card the dragged link would land in
|
<CardPanel
|
||||||
target={card.links.some((l) => l.id === activeId)}
|
key={card.id}
|
||||||
{...handlers}
|
card={card}
|
||||||
/>
|
// the card the dragged link would land in
|
||||||
))}
|
target={card.links.some((l) => l.id === activeId)}
|
||||||
</div>
|
{...handlers}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</SortableContext>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="mt-4 rounded-full text-white/60 hover:bg-white/10 hover:text-white"
|
className="mt-4 rounded-full text-white/60 hover:bg-white/10 hover:text-white"
|
||||||
@@ -162,17 +187,46 @@ export function CardGrid({
|
|||||||
<Plus className="size-4" /> New card
|
<Plus className="size-4" /> New card
|
||||||
</Button>
|
</Button>
|
||||||
<DragOverlay>
|
<DragOverlay>
|
||||||
{active && (
|
{/* one expression: an array of two empty ones would still count as a child */}
|
||||||
|
{active ? (
|
||||||
<TileFace
|
<TileFace
|
||||||
link={active}
|
link={active}
|
||||||
className="cursor-grabbing rounded-2xl bg-white/15 shadow-2xl"
|
className="cursor-grabbing rounded-2xl bg-white/15 shadow-2xl"
|
||||||
/>
|
/>
|
||||||
|
) : (
|
||||||
|
activeCard && <CardFace card={activeCard} />
|
||||||
)}
|
)}
|
||||||
</DragOverlay>
|
</DragOverlay>
|
||||||
</DndContext>
|
</DndContext>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 6rem is a tile's width. On a narrow screen fewer columns fit: they stay
|
||||||
|
// centered in the card, and a last row that is not full starts at the left.
|
||||||
|
const tiles =
|
||||||
|
"mx-auto grid max-w-full grid-cols-[repeat(auto-fill,6rem)] justify-center gap-y-2"
|
||||||
|
/** One column per link, at most 8. An empty card is as wide as two links. */
|
||||||
|
const tilesWidth = (card: DashCard) => ({
|
||||||
|
width: `${(Math.min(card.links.length, 8) || 2) * 6}rem`,
|
||||||
|
})
|
||||||
|
|
||||||
|
/** What follows the pointer while a card is dragged: the card without its buttons. */
|
||||||
|
function CardFace({ card }: { card: DashCard }) {
|
||||||
|
return (
|
||||||
|
// the overlay is as large as the card, h-full fills it for an empty card too
|
||||||
|
<div className={cn(glass, "h-full cursor-grabbing rounded-3xl p-2")}>
|
||||||
|
<div className="h-10 truncate pr-3.5 pl-5 text-sm leading-10 font-bold text-white/70">
|
||||||
|
{card.name}
|
||||||
|
</div>
|
||||||
|
<div style={tilesWidth(card)} className={tiles}>
|
||||||
|
{card.links.map((link) => (
|
||||||
|
<TileFace key={link.id} link={link} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function CardPanel({
|
function CardPanel({
|
||||||
card,
|
card,
|
||||||
target,
|
target,
|
||||||
@@ -181,11 +235,16 @@ function CardPanel({
|
|||||||
onEditCard,
|
onEditCard,
|
||||||
}: { card: DashCard; target: boolean } & Handlers) {
|
}: { card: DashCard; target: boolean } & Handlers) {
|
||||||
const titleId = useId()
|
const titleId = useId()
|
||||||
const { setNodeRef } = useDroppable({ id: card.id })
|
// `card` tells the link tiles that a card is dragged, see LinkTile
|
||||||
// one column per link, at most 8. An empty card is as wide as two links.
|
const { setNodeRef, setActivatorNodeRef, attributes, listeners, isDragging } =
|
||||||
const columns = Math.min(card.links.length, 8) || 2
|
useSortable({ id: card.id, data: { card: true } })
|
||||||
const subtle =
|
const subtle =
|
||||||
"rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-white/60"
|
"rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-white/60"
|
||||||
|
// shown on hover, always on touch
|
||||||
|
const action = cn(
|
||||||
|
subtle,
|
||||||
|
"grid size-7 flex-none place-items-center text-white/70 opacity-0 transition-opacity group-hover/card:opacity-100 hover:bg-white/10 hover:text-white focus-visible:opacity-100 pointer-coarse:opacity-100"
|
||||||
|
)
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
@@ -193,11 +252,16 @@ function CardPanel({
|
|||||||
className={cn(
|
className={cn(
|
||||||
glass,
|
glass,
|
||||||
"group/card max-w-full rounded-3xl p-2 transition-colors",
|
"group/card max-w-full rounded-3xl p-2 transition-colors",
|
||||||
target && "border-white/30"
|
target && "border-white/30",
|
||||||
|
isDragging && "opacity-40"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{/* the title starts where the first icon does, the plus ends where the last one does */}
|
{/* The title starts where the first icon does, the plus ends where the last one does.
|
||||||
<header className="flex h-10 min-w-48 items-center gap-2 pr-3.5 pl-5">
|
The whole bar drags the card. The keyboard picks it up on the grip only. */}
|
||||||
|
<header
|
||||||
|
{...listeners}
|
||||||
|
className="flex h-10 min-w-48 cursor-grab touch-manipulation items-center gap-2 pr-3.5 pl-5 select-none [-webkit-touch-callout:none]"
|
||||||
|
>
|
||||||
<h2 id={titleId} className="m-0 min-w-0 text-sm">
|
<h2 id={titleId} className="m-0 min-w-0 text-sm">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -211,14 +275,21 @@ function CardPanel({
|
|||||||
{card.name}
|
{card.name}
|
||||||
</button>
|
</button>
|
||||||
</h2>
|
</h2>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
ref={setActivatorNodeRef}
|
||||||
|
{...attributes}
|
||||||
|
aria-label={`Move ${card.name}`}
|
||||||
|
title="Drag to move this card"
|
||||||
|
className={cn(action, "ml-auto cursor-grab")}
|
||||||
|
>
|
||||||
|
<GripVertical className="size-4" />
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
aria-label={`Add a link to ${card.name}`}
|
aria-label={`Add a link to ${card.name}`}
|
||||||
onClick={() => onAddLink(card)}
|
onClick={() => onAddLink(card)}
|
||||||
className={cn(
|
className={action}
|
||||||
subtle,
|
|
||||||
"ml-auto grid size-7 flex-none place-items-center text-white/70 opacity-0 transition-opacity group-hover/card:opacity-100 hover:bg-white/10 hover:text-white focus-visible:opacity-100 pointer-coarse:opacity-100"
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
<Plus className="size-4" />
|
<Plus className="size-4" />
|
||||||
</button>
|
</button>
|
||||||
@@ -227,12 +298,7 @@ function CardPanel({
|
|||||||
items={card.links.map((l) => l.id)}
|
items={card.links.map((l) => l.id)}
|
||||||
strategy={rectSortingStrategy}
|
strategy={rectSortingStrategy}
|
||||||
>
|
>
|
||||||
{/* 6rem is a tile's width. On a narrow screen fewer columns fit: they stay
|
<div style={tilesWidth(card)} className={tiles}>
|
||||||
centered in the card, and a last row that is not full starts at the left. */}
|
|
||||||
<div
|
|
||||||
style={{ width: `${columns * 6}rem` }}
|
|
||||||
className="mx-auto grid max-w-full grid-cols-[repeat(auto-fill,6rem)] justify-center gap-y-2"
|
|
||||||
>
|
|
||||||
{card.links.map((link) => (
|
{card.links.map((link) => (
|
||||||
<LinkTile
|
<LinkTile
|
||||||
key={link.id}
|
key={link.id}
|
||||||
|
|||||||
+77
-14
@@ -1,4 +1,6 @@
|
|||||||
import { useSyncExternalStore } from "react"
|
import { useSyncExternalStore } from "react"
|
||||||
|
import { WallpaperImage } from "@/components/wallpaper"
|
||||||
|
import type { ClockFont, ClockStyle } from "@/lib/clock"
|
||||||
import { cn } from "@/vendor/collabry/lib/cn"
|
import { cn } from "@/vendor/collabry/lib/cn"
|
||||||
|
|
||||||
const subscribe = (tick: () => void) => {
|
const subscribe = (tick: () => void) => {
|
||||||
@@ -8,7 +10,29 @@ const subscribe = (tick: () => void) => {
|
|||||||
// changes once a minute, so the clock re-renders once a minute
|
// changes once a minute, so the clock re-renders once a minute
|
||||||
const currentMinute = () => Math.floor(Date.now() / 60_000)
|
const currentMinute = () => Math.floor(Date.now() / 60_000)
|
||||||
|
|
||||||
export function Clock() {
|
const FONTS: Record<ClockFont, string> = {
|
||||||
|
serif: "font-serif tracking-wide",
|
||||||
|
sans: "font-sans font-bold tracking-tight",
|
||||||
|
light: "font-sans font-extralight tracking-tight",
|
||||||
|
rounded: "font-rounded font-extrabold",
|
||||||
|
slab: "font-slab font-semibold",
|
||||||
|
}
|
||||||
|
|
||||||
|
// What the wallpaper looks like through the digits, and how much white is in the glass.
|
||||||
|
const GLASS: Record<Exclude<ClockStyle, "solid">, [string, string]> = {
|
||||||
|
glass: ["blur-xl saturate-150 brightness-150", "bg-white/45"],
|
||||||
|
tinted: ["blur-3xl saturate-150 brightness-150", "bg-white/20"],
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Clock({
|
||||||
|
font,
|
||||||
|
look,
|
||||||
|
wallpaper,
|
||||||
|
}: {
|
||||||
|
font: ClockFont
|
||||||
|
look: ClockStyle
|
||||||
|
wallpaper: string | null
|
||||||
|
}) {
|
||||||
// null on the server: its clock and locale are not the visitor's
|
// null on the server: its clock and locale are not the visitor's
|
||||||
const minute = useSyncExternalStore<number | null>(
|
const minute = useSyncExternalStore<number | null>(
|
||||||
subscribe,
|
subscribe,
|
||||||
@@ -29,14 +53,23 @@ export function Clock() {
|
|||||||
.trim()
|
.trim()
|
||||||
const period = parts.find((p) => p.type === "dayPeriod")?.value
|
const period = parts.find((p) => p.type === "dayPeriod")?.value
|
||||||
|
|
||||||
return (
|
// Each piece fades in by itself. Opacity on a common parent would cut the
|
||||||
<div
|
// glass off from the wallpaper it blends with.
|
||||||
className={cn(
|
const fade = cn("transition-opacity duration-500", !now && "opacity-0")
|
||||||
"flex flex-col items-center text-white transition-opacity duration-500 [text-shadow:0_2px_24px_rgb(0_0_0/0.45)]",
|
const digits = (
|
||||||
!now && "opacity-0"
|
<>
|
||||||
|
{time || "0:00"}
|
||||||
|
{period && (
|
||||||
|
<span className="absolute top-1 left-full ml-2 text-xl tracking-normal sm:top-3 sm:ml-4 sm:text-3xl">
|
||||||
|
{period}
|
||||||
|
</span>
|
||||||
)}
|
)}
|
||||||
>
|
</>
|
||||||
<p className="text-lg font-medium sm:text-xl">
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col items-center text-white [text-shadow:0_2px_24px_rgb(0_0_0/0.45)]">
|
||||||
|
<p className={cn("text-lg font-medium sm:text-xl", fade)}>
|
||||||
{now
|
{now
|
||||||
? now.toLocaleDateString(undefined, {
|
? now.toLocaleDateString(undefined, {
|
||||||
weekday: "long",
|
weekday: "long",
|
||||||
@@ -47,13 +80,43 @@ export function Clock() {
|
|||||||
</p>
|
</p>
|
||||||
<time
|
<time
|
||||||
dateTime={now?.toISOString()}
|
dateTime={now?.toISOString()}
|
||||||
className="relative mt-2 font-serif text-7xl leading-none tracking-wide sm:text-[9.5rem]"
|
className={cn(
|
||||||
|
"relative mt-2 text-7xl leading-none sm:text-[9.5rem]",
|
||||||
|
FONTS[font]
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{time || "0:00"}
|
{look === "solid" ? (
|
||||||
{period && (
|
<span className={cn("block", fade)}>{digits}</span>
|
||||||
<span className="absolute top-1 left-full ml-2 text-xl tracking-normal sm:top-3 sm:ml-4 sm:text-3xl">
|
) : (
|
||||||
{period}
|
<>
|
||||||
</span>
|
{/* the real text: it sets the size and casts the shadow */}
|
||||||
|
<span className={cn("block text-transparent", fade)}>{digits}</span>
|
||||||
|
{/* The glass. A blurred copy of the wallpaper lies exactly on the real
|
||||||
|
one. Multiplying it with white digits on black leaves it only inside
|
||||||
|
the digits, and screen drops the black. The clip keeps the copy
|
||||||
|
inside the clock, with room for AM/PM on the right. */}
|
||||||
|
<span
|
||||||
|
aria-hidden
|
||||||
|
className="absolute inset-0 isolate mix-blend-screen [clip-path:inset(-0.1em_-1em_-0.1em_-0.1em)] [text-shadow:none]"
|
||||||
|
>
|
||||||
|
<span className={cn("fixed inset-0", fade)}>
|
||||||
|
<WallpaperImage src={wallpaper} className={GLASS[look][0]} />
|
||||||
|
<span className={cn("fixed inset-0", GLASS[look][1])} />
|
||||||
|
</span>
|
||||||
|
<span className="absolute inset-0 bg-black mix-blend-multiply shadow-[0_0_0_100vmax_#000]">
|
||||||
|
{digits}
|
||||||
|
</span>
|
||||||
|
{/* light on the edges: only the shadows show, the black digits drop out */}
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
"absolute inset-0 text-black mix-blend-screen [text-shadow:0_-1px_0.5px_#aaa,0_1px_0.5px_#444]",
|
||||||
|
fade
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{digits}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</time>
|
</time>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+166
-14
@@ -1,9 +1,16 @@
|
|||||||
import { useState } from "react"
|
import { useEffect, useRef, useState } from "react"
|
||||||
import { useRouter } from "@tanstack/react-router"
|
import { useRouter } from "@tanstack/react-router"
|
||||||
import { Trash2 } from "lucide-react"
|
import { Trash2, Upload, X } from "lucide-react"
|
||||||
import { GlassDialogContent } from "@/components/glass"
|
import { GlassDialogContent } from "@/components/glass"
|
||||||
import type { HomeLink } from "@/components/link-tile"
|
import type { HomeLink } from "@/components/link-tile"
|
||||||
import { deleteLink, saveLink } from "@/lib/dashboard.functions"
|
import { deleteLink, getIcons, saveLink } from "@/lib/dashboard.functions"
|
||||||
|
import {
|
||||||
|
LIBRARY_INDEX,
|
||||||
|
UPLOADED_ICON,
|
||||||
|
isImageAddress,
|
||||||
|
libraryIcon,
|
||||||
|
searchIcons,
|
||||||
|
} from "@/lib/icons"
|
||||||
import { Button } from "@/vendor/collabry/components/Button/Button"
|
import { Button } from "@/vendor/collabry/components/Button/Button"
|
||||||
import {
|
import {
|
||||||
Field,
|
Field,
|
||||||
@@ -24,6 +31,51 @@ import {
|
|||||||
DialogTitle,
|
DialogTitle,
|
||||||
} from "@/vendor/collabry/components/ui/dialog"
|
} from "@/vendor/collabry/components/ui/dialog"
|
||||||
|
|
||||||
|
/** A grid of icons to click. Two and a half rows, so it shows that there is more to scroll to. */
|
||||||
|
function IconChoices({
|
||||||
|
label,
|
||||||
|
icons,
|
||||||
|
chosen,
|
||||||
|
named,
|
||||||
|
onChoose,
|
||||||
|
}: {
|
||||||
|
label: string
|
||||||
|
icons: string[]
|
||||||
|
chosen: string
|
||||||
|
/** names in the icon library. Without it: image addresses. */
|
||||||
|
named?: boolean
|
||||||
|
onChoose: (icon: string) => void
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
role="group"
|
||||||
|
aria-label={label}
|
||||||
|
className="grid max-h-29 grid-cols-7 gap-1 overflow-y-auto rounded-xl bg-white/5 p-1"
|
||||||
|
>
|
||||||
|
{icons.map((icon, i) => (
|
||||||
|
<button
|
||||||
|
key={icon}
|
||||||
|
type="button"
|
||||||
|
title={named ? icon : undefined}
|
||||||
|
// an upload has no name: "Your images 2"
|
||||||
|
aria-label={named ? icon : `${label} ${i + 1}`}
|
||||||
|
aria-pressed={icon === chosen}
|
||||||
|
onClick={() => onChoose(icon)}
|
||||||
|
className="grid h-11 place-items-center rounded-lg outline-none hover:bg-white/10 focus-visible:ring-2 focus-visible:ring-white/60 aria-pressed:bg-white/15"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={named ? libraryIcon(icon) : icon}
|
||||||
|
alt=""
|
||||||
|
loading="lazy"
|
||||||
|
referrerPolicy="no-referrer"
|
||||||
|
className="size-8 object-contain"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/** A link to edit, or only the card that a new link starts in. */
|
/** A link to edit, or only the card that a new link starts in. */
|
||||||
export type LinkTarget = HomeLink | { cardId: string }
|
export type LinkTarget = HomeLink | { cardId: string }
|
||||||
|
|
||||||
@@ -38,7 +90,8 @@ export function LinkDialog({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Dialog open={!!target} onOpenChange={(open) => !open && onClose()}>
|
<Dialog open={!!target} onOpenChange={(open) => !open && onClose()}>
|
||||||
<GlassDialogContent>
|
{/* taller than a small screen since it shows icons: scroll inside */}
|
||||||
|
<GlassDialogContent className="max-h-[86vh] overflow-y-auto">
|
||||||
{target && <LinkForm target={target} cards={cards} onClose={onClose} />}
|
{target && <LinkForm target={target} cards={cards} onClose={onClose} />}
|
||||||
</GlassDialogContent>
|
</GlassDialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@@ -58,6 +111,49 @@ function LinkForm({
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [busy, setBusy] = useState(false)
|
const [busy, setBusy] = useState(false)
|
||||||
const [error, setError] = useState("")
|
const [error, setError] = useState("")
|
||||||
|
const [name, setName] = useState(link?.name ?? "")
|
||||||
|
const [icon, setIcon] = useState(link?.icon ?? "")
|
||||||
|
const [library, setLibrary] = useState<string[]>([])
|
||||||
|
// the images that this user uploaded before, to use one again
|
||||||
|
const [uploads, setUploads] = useState<string[]>([])
|
||||||
|
const file = useRef<HTMLInputElement>(null)
|
||||||
|
|
||||||
|
// Without the library's index the field still takes a name or an address.
|
||||||
|
useEffect(() => {
|
||||||
|
fetch(LIBRARY_INDEX)
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((index: { png: string[] }) =>
|
||||||
|
setLibrary(index.png.map((f) => f.replace(/\.png$/, "")))
|
||||||
|
)
|
||||||
|
.catch(() => {})
|
||||||
|
getIcons()
|
||||||
|
.then(setUploads)
|
||||||
|
.catch(() => {})
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const uploaded = icon.startsWith(UPLOADED_ICON)
|
||||||
|
// what the field holds, or what an empty field would look up
|
||||||
|
const matches = isImageAddress(icon) ? [] : searchIcons(library, icon || name)
|
||||||
|
|
||||||
|
const upload = async (image: File) => {
|
||||||
|
setBusy(true)
|
||||||
|
setError("")
|
||||||
|
try {
|
||||||
|
const res = await fetch("/api/icon", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": image.type },
|
||||||
|
body: image,
|
||||||
|
})
|
||||||
|
if (res.ok) {
|
||||||
|
const added: string = (await res.json()).icon
|
||||||
|
setIcon(added)
|
||||||
|
setUploads((before) => [added, ...before])
|
||||||
|
} else setError(await res.text())
|
||||||
|
} catch {
|
||||||
|
setError("Could not upload. Try again.")
|
||||||
|
}
|
||||||
|
setBusy(false)
|
||||||
|
}
|
||||||
|
|
||||||
const submit = async (action: () => Promise<void>) => {
|
const submit = async (action: () => Promise<void>) => {
|
||||||
setBusy(true)
|
setBusy(true)
|
||||||
@@ -82,9 +178,9 @@ function LinkForm({
|
|||||||
data: {
|
data: {
|
||||||
id: link?.id,
|
id: link?.id,
|
||||||
cardId: String(form.get("cardId")),
|
cardId: String(form.get("cardId")),
|
||||||
name: String(form.get("name")),
|
name,
|
||||||
url: String(form.get("url")),
|
url: String(form.get("url")),
|
||||||
icon: String(form.get("icon")).trim() || null,
|
icon: icon.trim() || null,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@@ -100,8 +196,8 @@ function LinkForm({
|
|||||||
<Field>
|
<Field>
|
||||||
<FieldLabel>Name</FieldLabel>
|
<FieldLabel>Name</FieldLabel>
|
||||||
<Input
|
<Input
|
||||||
name="name"
|
value={name}
|
||||||
defaultValue={link?.name}
|
onChange={(e) => setName(e.target.value)}
|
||||||
placeholder="Plex"
|
placeholder="Plex"
|
||||||
maxLength={60}
|
maxLength={60}
|
||||||
required
|
required
|
||||||
@@ -123,13 +219,69 @@ function LinkForm({
|
|||||||
<FieldLabel>
|
<FieldLabel>
|
||||||
Icon <FieldNote>(optional)</FieldNote>
|
Icon <FieldNote>(optional)</FieldNote>
|
||||||
</FieldLabel>
|
</FieldLabel>
|
||||||
<Input
|
<div className="flex items-center gap-2">
|
||||||
name="icon"
|
{uploaded && (
|
||||||
defaultValue={link?.icon ?? ""}
|
<img
|
||||||
placeholder="Image URL or icon name, e.g. plex"
|
src={icon}
|
||||||
/>
|
alt=""
|
||||||
|
className="size-9 flex-none rounded-lg object-contain"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<Input
|
||||||
|
className="min-w-0 flex-1"
|
||||||
|
value={uploaded ? "" : icon}
|
||||||
|
onChange={(e) => setIcon(e.target.value)}
|
||||||
|
placeholder={
|
||||||
|
uploaded ? "Your image" : "Search icons or paste a URL"
|
||||||
|
}
|
||||||
|
autoComplete="off"
|
||||||
|
/>
|
||||||
|
{uploaded && (
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
iconOnly
|
||||||
|
aria-label="Remove your image"
|
||||||
|
onClick={() => setIcon("")}
|
||||||
|
>
|
||||||
|
<X size={15} />
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
<input
|
||||||
|
ref={file}
|
||||||
|
type="file"
|
||||||
|
accept="image/png,image/jpeg,image/webp,image/avif,image/svg+xml"
|
||||||
|
className="hidden"
|
||||||
|
onChange={(e) => {
|
||||||
|
const image = e.target.files?.[0]
|
||||||
|
if (image) void upload(image)
|
||||||
|
e.target.value = ""
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Button disabled={busy} onClick={() => file.current?.click()}>
|
||||||
|
<Upload size={15} /> Upload
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{matches.length > 0 && (
|
||||||
|
<IconChoices
|
||||||
|
label="Icons from the library"
|
||||||
|
icons={matches}
|
||||||
|
chosen={icon}
|
||||||
|
named
|
||||||
|
onChoose={setIcon}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{uploads.length > 0 && (
|
||||||
|
<IconChoices
|
||||||
|
label="Your images"
|
||||||
|
icons={uploads}
|
||||||
|
chosen={icon}
|
||||||
|
onChoose={setIcon}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<FieldDescription>
|
<FieldDescription>
|
||||||
Empty: found from the name, then from the site's favicon.
|
Empty: found from the name (the light version, when the library has
|
||||||
|
one), then from the site's favicon. Upload a PNG, JPEG, WebP, AVIF
|
||||||
|
or SVG, up to 1 MB.
|
||||||
</FieldDescription>
|
</FieldDescription>
|
||||||
</Field>
|
</Field>
|
||||||
<Field>
|
<Field>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { useEffect, useRef, useState } from "react"
|
import { createContext, useContext, useEffect, useRef, useState } from "react"
|
||||||
|
import { useDndContext } from "@dnd-kit/core"
|
||||||
import { useSortable } from "@dnd-kit/sortable"
|
import { useSortable } from "@dnd-kit/sortable"
|
||||||
import { CSS } from "@dnd-kit/utilities"
|
import { CSS } from "@dnd-kit/utilities"
|
||||||
import { Pencil } from "lucide-react"
|
import { Pencil } from "lucide-react"
|
||||||
|
import { iconSources } from "@/lib/icons"
|
||||||
import { cn } from "@/vendor/collabry/lib/cn"
|
import { cn } from "@/vendor/collabry/lib/cn"
|
||||||
|
|
||||||
export type HomeLink = {
|
export type HomeLink = {
|
||||||
@@ -10,29 +12,19 @@ export type HomeLink = {
|
|||||||
name: string
|
name: string
|
||||||
url: string
|
url: string
|
||||||
icon: string | null
|
icon: string | null
|
||||||
|
/** the library's light version of the icon, when the link has no icon of its own */
|
||||||
|
lightIcon: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
const dashboardIcon = (name: string) =>
|
/** Per link id: does its address answer? No entry: not checked (yet). */
|
||||||
`https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/${name
|
export const StatusContext = createContext<Partial<Record<string, boolean>>>({})
|
||||||
.trim()
|
|
||||||
.toLowerCase()
|
|
||||||
.replace(/[^a-z0-9]+/g, "-")
|
|
||||||
.replace(/^-|-$/g, "")}.png`
|
|
||||||
|
|
||||||
/** Icon sources to try in order; the letter tile is the last resort. */
|
|
||||||
function iconSources({ name, url, icon }: HomeLink) {
|
|
||||||
return [
|
|
||||||
icon && /^https?:\/\//.test(icon) ? icon : dashboardIcon(icon || name),
|
|
||||||
`${new URL(url).origin}/favicon.ico`,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
type IconProps = { link: HomeLink; className?: string }
|
type IconProps = { link: HomeLink; className?: string }
|
||||||
|
|
||||||
/** Starts the fallback chain again when the link changes. */
|
/** Starts the fallback chain again when the link changes. */
|
||||||
export function LinkIcon(props: IconProps) {
|
export function LinkIcon(props: IconProps) {
|
||||||
const { id, name, url, icon } = props.link
|
const { id, name, url, icon, lightIcon } = props.link
|
||||||
return <Icon key={[id, name, url, icon].join("|")} {...props} />
|
return <Icon key={[id, name, url, icon, lightIcon].join("|")} {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
function Icon({ link, className }: IconProps) {
|
function Icon({ link, className }: IconProps) {
|
||||||
@@ -99,6 +91,8 @@ export function LinkTile({
|
|||||||
link: HomeLink
|
link: HomeLink
|
||||||
onEdit: () => void
|
onEdit: () => void
|
||||||
}) {
|
}) {
|
||||||
|
// while a card is dragged, the arrow keys go from card to card, not through the links
|
||||||
|
const cardDragged = !!useDndContext().active?.data.current?.card
|
||||||
const {
|
const {
|
||||||
attributes,
|
attributes,
|
||||||
listeners,
|
listeners,
|
||||||
@@ -106,7 +100,8 @@ export function LinkTile({
|
|||||||
transform,
|
transform,
|
||||||
transition,
|
transition,
|
||||||
isDragging,
|
isDragging,
|
||||||
} = useSortable({ id: link.id })
|
} = useSortable({ id: link.id, disabled: { droppable: cardDragged } })
|
||||||
|
const up = useContext(StatusContext)[link.id]
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
@@ -124,6 +119,19 @@ export function LinkTile({
|
|||||||
className="block touch-manipulation rounded-2xl transition-colors outline-none select-none [-webkit-touch-callout:none] hover:bg-white/10 focus-visible:bg-white/10 focus-visible:ring-2 focus-visible:ring-white/60"
|
className="block touch-manipulation rounded-2xl transition-colors outline-none select-none [-webkit-touch-callout:none] hover:bg-white/10 focus-visible:bg-white/10 focus-visible:ring-2 focus-visible:ring-white/60"
|
||||||
>
|
>
|
||||||
<TileFace link={link} />
|
<TileFace link={link} />
|
||||||
|
{up !== undefined && (
|
||||||
|
// at the lower right corner of the icon. Filled green or a red ring:
|
||||||
|
// the shape differs too, not only the color.
|
||||||
|
<span
|
||||||
|
title={up ? "Reachable" : "Not reachable"}
|
||||||
|
className={cn(
|
||||||
|
"absolute top-[58px] right-[18px] size-3 rounded-full border-2",
|
||||||
|
up ? "border-black/70 bg-success" : "border-danger bg-black/80"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{!up && <span className="sr-only">, not reachable</span>}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</a>
|
</a>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -7,7 +7,12 @@ import { cn } from "@/vendor/collabry/lib/cn"
|
|||||||
import { LinkIcon } from "@/components/link-tile"
|
import { LinkIcon } from "@/components/link-tile"
|
||||||
import type { HomeLink } from "@/components/link-tile"
|
import type { HomeLink } from "@/components/link-tile"
|
||||||
import { suggest } from "@/lib/dashboard.functions"
|
import { suggest } from "@/lib/dashboard.functions"
|
||||||
import { ENGINE_NAMES, effectiveEngine, searchUrl } from "@/lib/search"
|
import {
|
||||||
|
ENGINE_NAMES,
|
||||||
|
effectiveEngine,
|
||||||
|
matchLinks,
|
||||||
|
searchUrl,
|
||||||
|
} from "@/lib/search"
|
||||||
import type { Engine } from "@/lib/search"
|
import type { Engine } from "@/lib/search"
|
||||||
|
|
||||||
export type Command = { label: string; icon: ReactNode; run: () => void }
|
export type Command = { label: string; icon: ReactNode; run: () => void }
|
||||||
@@ -25,7 +30,8 @@ export function SearchBar({
|
|||||||
}) {
|
}) {
|
||||||
const [value, setValue] = useState("")
|
const [value, setValue] = useState("")
|
||||||
const [fetched, setFetched] = useState<string[]>([])
|
const [fetched, setFetched] = useState<string[]>([])
|
||||||
const [active, setActive] = useState(-1)
|
// the row that the arrow keys or the mouse chose, null until then
|
||||||
|
const [moved, setMoved] = useState<number | null>(null)
|
||||||
const [focused, setFocused] = useState(false)
|
const [focused, setFocused] = useState(false)
|
||||||
const input = useRef<HTMLInputElement>(null)
|
const input = useRef<HTMLInputElement>(null)
|
||||||
|
|
||||||
@@ -57,7 +63,7 @@ export function SearchBar({
|
|||||||
}).catch(() => [])
|
}).catch(() => [])
|
||||||
if (stale) return
|
if (stale) return
|
||||||
setFetched(result)
|
setFetched(result)
|
||||||
setActive(-1) // the highlighted row now holds another suggestion
|
setMoved(null) // the highlighted row now holds another suggestion
|
||||||
}, 150)
|
}, 150)
|
||||||
return () => {
|
return () => {
|
||||||
stale = true
|
stale = true
|
||||||
@@ -66,23 +72,34 @@ export function SearchBar({
|
|||||||
}, [query, commandMode, used])
|
}, [query, commandMode, used])
|
||||||
|
|
||||||
const needle = value.slice(1).trim().toLowerCase()
|
const needle = value.slice(1).trim().toLowerCase()
|
||||||
|
const matched = matchLinks(links, commandMode ? needle : query)
|
||||||
|
const linkItem = (link: HomeLink): Command => ({
|
||||||
|
label: link.name,
|
||||||
|
icon: <LinkIcon link={link} className="size-5 rounded-md" />,
|
||||||
|
run: () => window.location.assign(link.url),
|
||||||
|
})
|
||||||
const items: Command[] = commandMode
|
const items: Command[] = commandMode
|
||||||
? [
|
? [
|
||||||
...links.map((link) => ({
|
...matched.links.map(linkItem),
|
||||||
label: link.name,
|
...commands.filter((c) => c.label.toLowerCase().includes(needle)),
|
||||||
icon: <LinkIcon link={link} className="size-5 rounded-md" />,
|
]
|
||||||
run: () => window.location.assign(link.url),
|
|
||||||
})),
|
|
||||||
...commands,
|
|
||||||
].filter((item) => item.label.toLowerCase().includes(needle))
|
|
||||||
: query
|
: query
|
||||||
? fetched.map((s) => ({
|
? [
|
||||||
label: s,
|
// a few, so the suggestions stay in view
|
||||||
icon: <Search className="size-4 opacity-60" />,
|
...matched.links.slice(0, 4).map(linkItem),
|
||||||
run: () => search(s),
|
...fetched.map((s) => ({
|
||||||
}))
|
label: s,
|
||||||
|
icon: <Search className="size-4 opacity-60" />,
|
||||||
|
run: () => search(s),
|
||||||
|
})),
|
||||||
|
]
|
||||||
: []
|
: []
|
||||||
const open = focused && items.length > 0
|
const open = focused && items.length > 0
|
||||||
|
// Enter takes the highlighted row. Until the user moves, that is the best match:
|
||||||
|
// with / the first row, else a link whose name starts with what was typed.
|
||||||
|
// Without one, Enter searches the web.
|
||||||
|
const best = commandMode ? items.length > 0 : matched.starts > 0
|
||||||
|
const active = moved ?? (best ? 0 : -1)
|
||||||
|
|
||||||
const run = (item: Command) => {
|
const run = (item: Command) => {
|
||||||
setValue("")
|
setValue("")
|
||||||
@@ -96,9 +113,7 @@ export function SearchBar({
|
|||||||
className="relative w-full max-w-[680px]"
|
className="relative w-full max-w-[680px]"
|
||||||
onSubmit={(e) => {
|
onSubmit={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
// in command mode Enter takes the best match
|
const item = active >= 0 ? items[active] : undefined
|
||||||
const item =
|
|
||||||
active >= 0 ? items[active] : commandMode ? items[0] : undefined
|
|
||||||
if (item) run(item)
|
if (item) run(item)
|
||||||
else if (query && !commandMode) search(query)
|
else if (query && !commandMode) search(query)
|
||||||
}}
|
}}
|
||||||
@@ -115,7 +130,7 @@ export function SearchBar({
|
|||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setValue(e.target.value)
|
setValue(e.target.value)
|
||||||
setActive(-1)
|
setMoved(null)
|
||||||
}}
|
}}
|
||||||
onFocus={() => setFocused(true)}
|
onFocus={() => setFocused(true)}
|
||||||
onBlur={() => setFocused(false)}
|
onBlur={() => setFocused(false)}
|
||||||
@@ -124,7 +139,10 @@ export function SearchBar({
|
|||||||
if (!open || (e.key !== "ArrowDown" && e.key !== "ArrowUp")) return
|
if (!open || (e.key !== "ArrowDown" && e.key !== "ArrowUp")) return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const step = e.key === "ArrowDown" ? 1 : -1
|
const step = e.key === "ArrowDown" ? 1 : -1
|
||||||
setActive((active + step + items.length) % items.length)
|
// the rows and, between the last and the first, no row: Enter then
|
||||||
|
// searches what was typed, also when a link matches it
|
||||||
|
const stops = items.length + 1
|
||||||
|
setMoved(((active + 1 + step + stops) % stops) - 1)
|
||||||
}}
|
}}
|
||||||
placeholder={`Search ${ENGINE_NAMES[used]}, or type / for commands`}
|
placeholder={`Search ${ENGINE_NAMES[used]}, or type / for commands`}
|
||||||
aria-label="Search"
|
aria-label="Search"
|
||||||
@@ -159,7 +177,7 @@ export function SearchBar({
|
|||||||
role="option"
|
role="option"
|
||||||
aria-selected={i === active}
|
aria-selected={i === active}
|
||||||
onClick={() => run(item)}
|
onClick={() => run(item)}
|
||||||
onMouseMove={() => setActive(i)}
|
onMouseMove={() => setMoved(i)}
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex cursor-pointer items-center gap-3 rounded-xl px-3.5 py-2.5",
|
"flex cursor-pointer items-center gap-3 rounded-xl px-3.5 py-2.5",
|
||||||
i === active && "bg-white/10"
|
i === active && "bg-white/10"
|
||||||
|
|||||||
@@ -1,23 +1,50 @@
|
|||||||
|
import { cn } from "@/vendor/collabry/lib/cn"
|
||||||
|
|
||||||
export const DEFAULT_WALLPAPER = "/wallpaper.jpg"
|
export const DEFAULT_WALLPAPER = "/wallpaper.jpg"
|
||||||
|
/** How dark the wallpaper is made until the user moves the slider, in percent. */
|
||||||
|
export const DEFAULT_WALLPAPER_DIM = 40
|
||||||
|
|
||||||
function showDefault(img: HTMLImageElement) {
|
function showDefault(img: HTMLImageElement) {
|
||||||
if (!img.src.endsWith(DEFAULT_WALLPAPER)) img.src = DEFAULT_WALLPAPER
|
if (!img.src.endsWith(DEFAULT_WALLPAPER)) img.src = DEFAULT_WALLPAPER
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Wallpaper({ src }: { src?: string | null }) {
|
/** The wallpaper over the whole window. Falls back to the default photo. */
|
||||||
|
export function WallpaperImage({
|
||||||
|
src,
|
||||||
|
className,
|
||||||
|
}: {
|
||||||
|
src?: string | null
|
||||||
|
className?: string
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<img
|
||||||
|
src={src ?? DEFAULT_WALLPAPER}
|
||||||
|
alt=""
|
||||||
|
className={cn("fixed inset-0 size-full object-cover", className)}
|
||||||
|
// an image that failed before hydration never fires onError
|
||||||
|
ref={(img) => {
|
||||||
|
if (img?.complete && img.naturalWidth === 0) showDefault(img)
|
||||||
|
}}
|
||||||
|
onError={(e) => showDefault(e.currentTarget)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Wallpaper({
|
||||||
|
src,
|
||||||
|
dim = DEFAULT_WALLPAPER_DIM,
|
||||||
|
}: {
|
||||||
|
src?: string | null
|
||||||
|
/** 0 shows the picture as it is, 100 is black */
|
||||||
|
dim?: number
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="fixed inset-0 -z-10 bg-black" aria-hidden>
|
<div className="fixed inset-0 -z-10 bg-black" aria-hidden>
|
||||||
<img
|
<WallpaperImage src={src} />
|
||||||
src={src ?? DEFAULT_WALLPAPER}
|
<div
|
||||||
alt=""
|
className="absolute inset-0 bg-black"
|
||||||
className="size-full object-cover"
|
style={{ opacity: dim / 100 }}
|
||||||
// an image that failed before hydration never fires onError
|
|
||||||
ref={(img) => {
|
|
||||||
if (img?.complete && img.naturalWidth === 0) showDefault(img)
|
|
||||||
}}
|
|
||||||
onError={(e) => showDefault(e.currentTarget)}
|
|
||||||
/>
|
/>
|
||||||
<div className="absolute inset-0 wallpaper-dither" />
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+66
-6
@@ -77,7 +77,27 @@ export const verification = pgTable(
|
|||||||
|
|
||||||
const bytea = customType<{ data: Uint8Array }>({ dataType: () => "bytea" })
|
const bytea = customType<{ data: Uint8Array }>({ dataType: () => "bytea" })
|
||||||
|
|
||||||
/** A named group of links on the dashboard. */
|
/** A set of cards, for example Home and Work. */
|
||||||
|
export const dashboard = pgTable(
|
||||||
|
"dashboard",
|
||||||
|
{
|
||||||
|
id: uuid("id").primaryKey().defaultRandom(),
|
||||||
|
userId: text("user_id")
|
||||||
|
.notNull()
|
||||||
|
.references(() => user.id, { onDelete: "cascade" }),
|
||||||
|
name: text("name").notNull(),
|
||||||
|
// order in the switcher and in the settings
|
||||||
|
position: integer("position").notNull().default(0),
|
||||||
|
// null = bundled default wallpaper
|
||||||
|
wallpaperUrl: text("wallpaper_url"),
|
||||||
|
// percent of black over the wallpaper, see DEFAULT_WALLPAPER_DIM
|
||||||
|
wallpaperDim: integer("wallpaper_dim").notNull().default(40),
|
||||||
|
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||||
|
},
|
||||||
|
(t) => [index("dashboard_user_id_idx").on(t.userId)]
|
||||||
|
)
|
||||||
|
|
||||||
|
/** A named group of links on a dashboard. */
|
||||||
export const card = pgTable(
|
export const card = pgTable(
|
||||||
"card",
|
"card",
|
||||||
{
|
{
|
||||||
@@ -85,10 +105,18 @@ export const card = pgTable(
|
|||||||
userId: text("user_id")
|
userId: text("user_id")
|
||||||
.notNull()
|
.notNull()
|
||||||
.references(() => user.id, { onDelete: "cascade" }),
|
.references(() => user.id, { onDelete: "cascade" }),
|
||||||
|
dashboardId: uuid("dashboard_id")
|
||||||
|
.notNull()
|
||||||
|
.references(() => dashboard.id, { onDelete: "cascade" }),
|
||||||
|
// order on the dashboard
|
||||||
|
position: integer("position").notNull().default(0),
|
||||||
name: text("name").notNull(),
|
name: text("name").notNull(),
|
||||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||||
},
|
},
|
||||||
(t) => [index("card_user_id_idx").on(t.userId)]
|
(t) => [
|
||||||
|
index("card_user_id_idx").on(t.userId),
|
||||||
|
index("card_dashboard_id_idx").on(t.dashboardId),
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
export const link = pgTable(
|
export const link = pgTable(
|
||||||
@@ -105,7 +133,8 @@ export const link = pgTable(
|
|||||||
position: integer("position").notNull().default(0),
|
position: integer("position").notNull().default(0),
|
||||||
name: text("name").notNull(),
|
name: text("name").notNull(),
|
||||||
url: text("url").notNull(),
|
url: text("url").notNull(),
|
||||||
// image URL or a dashboard-icons name ("plex"); null = guess from name
|
// image URL, an upload ("/api/icon?id=…") or a dashboard-icons name ("plex");
|
||||||
|
// null = guess from name
|
||||||
icon: text("icon"),
|
icon: text("icon"),
|
||||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||||
},
|
},
|
||||||
@@ -120,18 +149,49 @@ export const settings = pgTable("settings", {
|
|||||||
.primaryKey()
|
.primaryKey()
|
||||||
.references(() => user.id, { onDelete: "cascade" }),
|
.references(() => user.id, { onDelete: "cascade" }),
|
||||||
title: text("title").notNull().default("Dahoam"),
|
title: text("title").notNull().default("Dahoam"),
|
||||||
|
// the dashboard that opens after sign-in; null = the first one
|
||||||
|
defaultDashboardId: uuid("default_dashboard_id").references(
|
||||||
|
() => dashboard.id,
|
||||||
|
{ onDelete: "set null" }
|
||||||
|
),
|
||||||
searchEngine: text("search_engine", {
|
searchEngine: text("search_engine", {
|
||||||
enum: ["duckduckgo", "searxng", "google"],
|
enum: ["duckduckgo", "searxng", "google"],
|
||||||
})
|
})
|
||||||
.notNull()
|
.notNull()
|
||||||
.default("duckduckgo"),
|
.default("duckduckgo"),
|
||||||
// null = bundled default wallpaper
|
// the big clock, see src/lib/clock.ts
|
||||||
wallpaperUrl: text("wallpaper_url"),
|
clockFont: text("clock_font", {
|
||||||
|
enum: ["serif", "sans", "light", "rounded", "slab"],
|
||||||
|
})
|
||||||
|
.notNull()
|
||||||
|
.default("serif"),
|
||||||
|
clockStyle: text("clock_style", { enum: ["solid", "glass", "tinted"] })
|
||||||
|
.notNull()
|
||||||
|
.default("solid"),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** A link icon that the user uploaded, served from /api/icon. */
|
||||||
|
export const icon = pgTable(
|
||||||
|
"icon",
|
||||||
|
{
|
||||||
|
id: uuid("id").primaryKey().defaultRandom(),
|
||||||
|
userId: text("user_id")
|
||||||
|
.notNull()
|
||||||
|
.references(() => user.id, { onDelete: "cascade" }),
|
||||||
|
mime: text("mime").notNull(),
|
||||||
|
data: bytea("data").notNull(),
|
||||||
|
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||||
|
},
|
||||||
|
(t) => [index("icon_user_id_idx").on(t.userId)]
|
||||||
|
)
|
||||||
|
|
||||||
|
/** The wallpaper that was uploaded for a dashboard, served from /api/wallpaper. */
|
||||||
export const wallpaper = pgTable("wallpaper", {
|
export const wallpaper = pgTable("wallpaper", {
|
||||||
userId: text("user_id")
|
dashboardId: uuid("dashboard_id")
|
||||||
.primaryKey()
|
.primaryKey()
|
||||||
|
.references(() => dashboard.id, { onDelete: "cascade" }),
|
||||||
|
userId: text("user_id")
|
||||||
|
.notNull()
|
||||||
.references(() => user.id, { onDelete: "cascade" }),
|
.references(() => user.id, { onDelete: "cascade" }),
|
||||||
mime: text("mime").notNull(),
|
mime: text("mime").notNull(),
|
||||||
data: bytea("data").notNull(),
|
data: bytea("data").notNull(),
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// How the big clock on the dashboard looks. The choices are stored per user.
|
||||||
|
|
||||||
|
export const CLOCK_FONTS = [
|
||||||
|
"serif",
|
||||||
|
"sans",
|
||||||
|
"light",
|
||||||
|
"rounded",
|
||||||
|
"slab",
|
||||||
|
] as const
|
||||||
|
export type ClockFont = (typeof CLOCK_FONTS)[number]
|
||||||
|
|
||||||
|
export const CLOCK_FONT_NAMES: Record<ClockFont, string> = {
|
||||||
|
serif: "Serif",
|
||||||
|
sans: "Sans",
|
||||||
|
light: "Light",
|
||||||
|
rounded: "Rounded",
|
||||||
|
slab: "Slab",
|
||||||
|
}
|
||||||
|
|
||||||
|
export const CLOCK_STYLES = ["solid", "glass", "tinted"] as const
|
||||||
|
export type ClockStyle = (typeof CLOCK_STYLES)[number]
|
||||||
|
|
||||||
|
export const CLOCK_STYLE_NAMES: Record<ClockStyle, string> = {
|
||||||
|
solid: "Solid",
|
||||||
|
glass: "Glass",
|
||||||
|
tinted: "Tinted",
|
||||||
|
}
|
||||||
+327
-34
@@ -1,11 +1,25 @@
|
|||||||
import { createServerFn } from "@tanstack/react-start"
|
import { createServerFn } from "@tanstack/react-start"
|
||||||
import { getRequestHeaders } from "@tanstack/react-start/server"
|
import { getRequestHeaders } from "@tanstack/react-start/server"
|
||||||
import { and, asc, eq, inArray, sql } from "drizzle-orm"
|
import { and, asc, desc, eq, inArray, sql } from "drizzle-orm"
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
import { db } from "@/db"
|
import { db } from "@/db"
|
||||||
import { card, link, settings, wallpaper } from "@/db/schema"
|
import {
|
||||||
|
account,
|
||||||
|
card,
|
||||||
|
dashboard,
|
||||||
|
icon,
|
||||||
|
link,
|
||||||
|
settings,
|
||||||
|
wallpaper,
|
||||||
|
} from "@/db/schema"
|
||||||
import { auth, requireUser, signUpEnabled, ssoName } from "@/lib/auth"
|
import { auth, requireUser, signUpEnabled, ssoName } from "@/lib/auth"
|
||||||
|
import { CLOCK_FONTS, CLOCK_STYLES } from "@/lib/clock"
|
||||||
|
import { libraryNames } from "@/lib/icon-library"
|
||||||
|
import { UPLOADED_ICON, lightVariant } from "@/lib/icons"
|
||||||
import { ENGINES, parseSuggestions } from "@/lib/search"
|
import { ENGINES, parseSuggestions } from "@/lib/search"
|
||||||
|
import { isReachable, statusChecks } from "@/lib/status"
|
||||||
|
import { backupSchema, portable } from "@/lib/transfer"
|
||||||
|
import type { Backup } from "@/lib/transfer"
|
||||||
|
|
||||||
const httpUrl = z.url({ protocol: /^https?$/ }).max(2000)
|
const httpUrl = z.url({ protocol: /^https?$/ }).max(2000)
|
||||||
|
|
||||||
@@ -17,10 +31,29 @@ async function requireCard(userId: string, cardId: string) {
|
|||||||
if (!found.length) throw new Error("Unknown card")
|
if (!found.length) throw new Error("Unknown card")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function requireDashboard(userId: string, dashboardId: string) {
|
||||||
|
const found = await db
|
||||||
|
.select({ id: dashboard.id })
|
||||||
|
.from(dashboard)
|
||||||
|
.where(and(eq(dashboard.id, dashboardId), eq(dashboard.userId, userId)))
|
||||||
|
if (!found.length) throw new Error("Unknown dashboard")
|
||||||
|
}
|
||||||
|
|
||||||
/** The position after the last link of a card. */
|
/** The position after the last link of a card. */
|
||||||
const endOf = (cardId: string) =>
|
const endOf = (cardId: string) =>
|
||||||
sql<number>`(select coalesce(max(${link.position}) + 1, 0) from ${link} where ${link.cardId} = ${cardId})`
|
sql<number>`(select coalesce(max(${link.position}) + 1, 0) from ${link} where ${link.cardId} = ${cardId})`
|
||||||
|
|
||||||
|
/** The position after the last card of a dashboard. */
|
||||||
|
const endOfDashboard = (dashboardId: string) =>
|
||||||
|
sql<number>`(select coalesce(max(${card.position}) + 1, 0) from ${card} where ${card.dashboardId} = ${dashboardId})`
|
||||||
|
|
||||||
|
/** The position after the last dashboard of a user. */
|
||||||
|
const lastDashboard = (userId: string) =>
|
||||||
|
sql<number>`(select coalesce(max(${dashboard.position}) + 1, 0) from ${dashboard} where ${dashboard.userId} = ${userId})`
|
||||||
|
|
||||||
|
// dashboards that were never moved all have position 0: oldest first
|
||||||
|
const dashboardOrder = [asc(dashboard.position), asc(dashboard.createdAt)]
|
||||||
|
|
||||||
export const getAuthInfo = createServerFn({ method: "GET" }).handler(
|
export const getAuthInfo = createServerFn({ method: "GET" }).handler(
|
||||||
async () => ({
|
async () => ({
|
||||||
signedIn: !!(await auth.api.getSession({ headers: getRequestHeaders() })),
|
signedIn: !!(await auth.api.getSession({ headers: getRequestHeaders() })),
|
||||||
@@ -29,18 +62,61 @@ export const getAuthInfo = createServerFn({ method: "GET" }).handler(
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
/** Everything the dashboard renders, or null when signed out. */
|
/** What the pages need of a dashboard. */
|
||||||
export const getDashboard = createServerFn({ method: "GET" }).handler(
|
const shown = {
|
||||||
async () => {
|
id: dashboard.id,
|
||||||
|
name: dashboard.name,
|
||||||
|
wallpaperUrl: dashboard.wallpaperUrl,
|
||||||
|
wallpaperDim: dashboard.wallpaperDim,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Everything the dashboard renders, or null when signed out. Without a
|
||||||
|
* `dashboardId`, or with one that does not exist, it is the default dashboard.
|
||||||
|
*/
|
||||||
|
export const getDashboard = createServerFn({ method: "GET" })
|
||||||
|
// any string: the id comes from the address bar, a wrong one is not an error
|
||||||
|
.validator(z.object({ dashboardId: z.string().optional() }).optional())
|
||||||
|
.handler(async ({ data }) => {
|
||||||
const session = await auth.api.getSession({ headers: getRequestHeaders() })
|
const session = await auth.api.getSession({ headers: getRequestHeaders() })
|
||||||
if (!session) return null
|
if (!session) return null
|
||||||
const userId = session.user.id
|
const userId = session.user.id
|
||||||
const [cards, links, rows] = await Promise.all([
|
const [dashboards, rows, passwords] = await Promise.all([
|
||||||
|
db
|
||||||
|
.select(shown)
|
||||||
|
.from(dashboard)
|
||||||
|
.where(eq(dashboard.userId, userId))
|
||||||
|
.orderBy(...dashboardOrder),
|
||||||
|
db.select().from(settings).where(eq(settings.userId, userId)),
|
||||||
|
// someone who only ever signed in with SSO has no password to change
|
||||||
|
db.$count(
|
||||||
|
account,
|
||||||
|
and(eq(account.userId, userId), eq(account.providerId, "credential"))
|
||||||
|
),
|
||||||
|
])
|
||||||
|
// Cards need a dashboard and links need a card, so nobody is left without one.
|
||||||
|
// shortcut: two first loads at the same moment make two of each, add a unique
|
||||||
|
// constraint if that ever shows up
|
||||||
|
if (!dashboards.length)
|
||||||
|
dashboards.push(
|
||||||
|
...(await db
|
||||||
|
.insert(dashboard)
|
||||||
|
.values({ userId, name: "Home" })
|
||||||
|
.returning(shown))
|
||||||
|
)
|
||||||
|
const s = rows.at(0) // no row until the first save
|
||||||
|
const find = (id?: string | null) => dashboards.find((d) => d.id === id)
|
||||||
|
const byDefault = find(s?.defaultDashboardId) ?? dashboards[0]
|
||||||
|
const current = find(data?.dashboardId) ?? byDefault
|
||||||
|
const dashboardId = current.id
|
||||||
|
const [library, cards, links] = await Promise.all([
|
||||||
|
libraryNames(),
|
||||||
db
|
db
|
||||||
.select({ id: card.id, name: card.name })
|
.select({ id: card.id, name: card.name })
|
||||||
.from(card)
|
.from(card)
|
||||||
.where(eq(card.userId, userId))
|
.where(and(eq(card.userId, userId), eq(card.dashboardId, dashboardId)))
|
||||||
.orderBy(asc(card.createdAt)),
|
// cards that were never moved all have position 0: oldest first
|
||||||
|
.orderBy(asc(card.position), asc(card.createdAt)),
|
||||||
db
|
db
|
||||||
.select({
|
.select({
|
||||||
id: link.id,
|
id: link.id,
|
||||||
@@ -50,34 +126,66 @@ export const getDashboard = createServerFn({ method: "GET" }).handler(
|
|||||||
icon: link.icon,
|
icon: link.icon,
|
||||||
})
|
})
|
||||||
.from(link)
|
.from(link)
|
||||||
.where(eq(link.userId, userId))
|
.innerJoin(card, eq(card.id, link.cardId))
|
||||||
|
.where(and(eq(link.userId, userId), eq(card.dashboardId, dashboardId)))
|
||||||
.orderBy(asc(link.position), asc(link.createdAt)),
|
.orderBy(asc(link.position), asc(link.createdAt)),
|
||||||
db.select().from(settings).where(eq(settings.userId, userId)),
|
|
||||||
])
|
])
|
||||||
// Links need a card to live in, so nobody is left without one.
|
|
||||||
// shortcut: two first loads at the same moment make two cards, add a unique
|
|
||||||
// constraint if that ever shows up
|
|
||||||
if (!cards.length)
|
if (!cards.length)
|
||||||
cards.push(
|
cards.push(
|
||||||
...(await db
|
...(await db
|
||||||
.insert(card)
|
.insert(card)
|
||||||
.values({ userId, name: "Apps" })
|
.values({ userId, dashboardId, name: "Apps" })
|
||||||
.returning({ id: card.id, name: card.name }))
|
.returning({ id: card.id, name: card.name }))
|
||||||
)
|
)
|
||||||
const s = rows.at(0) // no row until the first save
|
|
||||||
return {
|
return {
|
||||||
user: { name: session.user.name, email: session.user.email },
|
user: {
|
||||||
|
name: session.user.name,
|
||||||
|
email: session.user.email,
|
||||||
|
hasPassword: passwords > 0,
|
||||||
|
},
|
||||||
|
dashboards,
|
||||||
|
dashboardId,
|
||||||
|
defaultDashboardId: byDefault.id,
|
||||||
cards: cards.map((c) => ({
|
cards: cards.map((c) => ({
|
||||||
...c,
|
...c,
|
||||||
links: links.filter((l) => l.cardId === c.id),
|
links: links
|
||||||
|
.filter((l) => l.cardId === c.id)
|
||||||
|
.map((l) => ({
|
||||||
|
...l,
|
||||||
|
// an icon that the user chose stays as it is
|
||||||
|
lightIcon: l.icon ? null : lightVariant(library, l.name),
|
||||||
|
})),
|
||||||
})),
|
})),
|
||||||
title: s?.title ?? "Dahoam",
|
title: s?.title ?? "Dahoam",
|
||||||
searchEngine: s?.searchEngine ?? "duckduckgo",
|
searchEngine: s?.searchEngine ?? "duckduckgo",
|
||||||
wallpaperUrl: s?.wallpaperUrl ?? null,
|
wallpaperUrl: current.wallpaperUrl,
|
||||||
|
wallpaperDim: current.wallpaperDim,
|
||||||
|
clockFont: s?.clockFont ?? "serif",
|
||||||
|
clockStyle: s?.clockStyle ?? "solid",
|
||||||
searxngUrl: process.env.SEARXNG_URL || null,
|
searxngUrl: process.env.SEARXNG_URL || null,
|
||||||
|
statusChecks,
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
/** For every link of a dashboard: does its address answer? Empty when the checks are off. */
|
||||||
|
export const getStatuses = createServerFn({ method: "GET" })
|
||||||
|
.validator(z.object({ dashboardId: z.uuid() }))
|
||||||
|
.handler(async ({ data }): Promise<Record<string, boolean>> => {
|
||||||
|
const user = await requireUser()
|
||||||
|
if (!statusChecks) return {}
|
||||||
|
// only addresses that this user saved as links, never one from the request
|
||||||
|
const links = await db
|
||||||
|
.select({ id: link.id, url: link.url })
|
||||||
|
.from(link)
|
||||||
|
.innerJoin(card, eq(card.id, link.cardId))
|
||||||
|
.where(
|
||||||
|
and(eq(link.userId, user.id), eq(card.dashboardId, data.dashboardId))
|
||||||
|
)
|
||||||
|
// one request must not make the server call thousands of addresses
|
||||||
|
.limit(200)
|
||||||
|
const up = await Promise.all(links.map((l) => isReachable(l.url)))
|
||||||
|
return Object.fromEntries(links.map((l, i) => [l.id, up[i]]))
|
||||||
|
})
|
||||||
|
|
||||||
export const saveLink = createServerFn({ method: "POST" })
|
export const saveLink = createServerFn({ method: "POST" })
|
||||||
.validator(
|
.validator(
|
||||||
@@ -110,6 +218,36 @@ export const saveLink = createServerFn({ method: "POST" })
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const saveCard = createServerFn({ method: "POST" })
|
export const saveCard = createServerFn({ method: "POST" })
|
||||||
|
.validator(
|
||||||
|
z.object({
|
||||||
|
id: z.uuid().optional(),
|
||||||
|
name: z.string().trim().min(1).max(40),
|
||||||
|
// the dashboard of the card. Another one than before moves the card there.
|
||||||
|
dashboardId: z.uuid(),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.handler(async ({ data: { id, name, dashboardId } }) => {
|
||||||
|
const user = await requireUser()
|
||||||
|
await requireDashboard(user.id, dashboardId)
|
||||||
|
const end = endOfDashboard(dashboardId)
|
||||||
|
if (id) {
|
||||||
|
await db
|
||||||
|
.update(card)
|
||||||
|
.set({
|
||||||
|
name,
|
||||||
|
dashboardId,
|
||||||
|
// a card that changes dashboards goes after the last card there
|
||||||
|
position: sql`case when ${card.dashboardId} = ${dashboardId} then ${card.position} else ${end} end`,
|
||||||
|
})
|
||||||
|
.where(and(eq(card.id, id), eq(card.userId, user.id)))
|
||||||
|
} else {
|
||||||
|
await db
|
||||||
|
.insert(card)
|
||||||
|
.values({ name, dashboardId, userId: user.id, position: end })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export const saveDashboard = createServerFn({ method: "POST" })
|
||||||
.validator(
|
.validator(
|
||||||
z.object({
|
z.object({
|
||||||
id: z.uuid().optional(),
|
id: z.uuid().optional(),
|
||||||
@@ -120,14 +258,53 @@ export const saveCard = createServerFn({ method: "POST" })
|
|||||||
const user = await requireUser()
|
const user = await requireUser()
|
||||||
if (id) {
|
if (id) {
|
||||||
await db
|
await db
|
||||||
.update(card)
|
.update(dashboard)
|
||||||
.set({ name })
|
.set({ name })
|
||||||
.where(and(eq(card.id, id), eq(card.userId, user.id)))
|
.where(and(eq(dashboard.id, id), eq(dashboard.userId, user.id)))
|
||||||
} else {
|
} else {
|
||||||
await db.insert(card).values({ name, userId: user.id })
|
await db
|
||||||
|
.insert(dashboard)
|
||||||
|
.values({ name, userId: user.id, position: lastDashboard(user.id) })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** Stores the order of the dashboards: all of the user's, as they should appear. */
|
||||||
|
export const orderDashboards = createServerFn({ method: "POST" })
|
||||||
|
.validator(z.object({ ids: z.array(z.uuid()).max(500) }))
|
||||||
|
.handler(async ({ data }) => {
|
||||||
|
const user = await requireUser()
|
||||||
|
await db.transaction(async (tx) => {
|
||||||
|
for (const [position, id] of data.ids.entries())
|
||||||
|
await tx
|
||||||
|
.update(dashboard)
|
||||||
|
.set({ position })
|
||||||
|
.where(and(eq(dashboard.id, id), eq(dashboard.userId, user.id)))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
/** The images that the user uploaded as icons, the newest first, as link icons. */
|
||||||
|
export const getIcons = createServerFn({ method: "GET" }).handler(async () => {
|
||||||
|
const user = await requireUser()
|
||||||
|
const icons = await db
|
||||||
|
.select({ id: icon.id })
|
||||||
|
.from(icon)
|
||||||
|
.where(eq(icon.userId, user.id))
|
||||||
|
.orderBy(desc(icon.createdAt))
|
||||||
|
.limit(60)
|
||||||
|
return icons.map((i) => UPLOADED_ICON + i.id)
|
||||||
|
})
|
||||||
|
|
||||||
|
/** Deletes the dashboard and, through the foreign keys, its cards and their links. */
|
||||||
|
export const deleteDashboard = createServerFn({ method: "POST" })
|
||||||
|
.validator(z.object({ id: z.uuid() }))
|
||||||
|
.handler(async ({ data }) => {
|
||||||
|
const user = await requireUser()
|
||||||
|
const mine = eq(dashboard.userId, user.id)
|
||||||
|
if ((await db.$count(dashboard, mine)) < 2)
|
||||||
|
throw new Error("The last dashboard stays")
|
||||||
|
await db.delete(dashboard).where(and(eq(dashboard.id, data.id), mine))
|
||||||
|
})
|
||||||
|
|
||||||
/** Deletes the card and, through the foreign key, its links. */
|
/** Deletes the card and, through the foreign key, its links. */
|
||||||
export const deleteCard = createServerFn({ method: "POST" })
|
export const deleteCard = createServerFn({ method: "POST" })
|
||||||
.validator(z.object({ id: z.uuid() }))
|
.validator(z.object({ id: z.uuid() }))
|
||||||
@@ -138,8 +315,8 @@ export const deleteCard = createServerFn({ method: "POST" })
|
|||||||
.where(and(eq(card.id, data.id), eq(card.userId, user.id)))
|
.where(and(eq(card.id, data.id), eq(card.userId, user.id)))
|
||||||
})
|
})
|
||||||
|
|
||||||
/** Stores the result of a drag: for each card, its links in order. */
|
/** Stores the result of a drag: the cards in order and, for each card, its links in order. */
|
||||||
export const moveLinks = createServerFn({ method: "POST" })
|
export const saveLayout = createServerFn({ method: "POST" })
|
||||||
.validator(
|
.validator(
|
||||||
z.object({
|
z.object({
|
||||||
cards: z
|
cards: z
|
||||||
@@ -155,15 +332,20 @@ export const moveLinks = createServerFn({ method: "POST" })
|
|||||||
.from(card)
|
.from(card)
|
||||||
.where(and(eq(card.userId, user.id), inArray(card.id, cardIds)))
|
.where(and(eq(card.userId, user.id), inArray(card.id, cardIds)))
|
||||||
if (owned.length !== cardIds.length) throw new Error("Unknown card")
|
if (owned.length !== cardIds.length) throw new Error("Unknown card")
|
||||||
// shortcut: one UPDATE per link, fine for a few hundred links; switch to a
|
// shortcut: one UPDATE per card and link, fine for a few hundred links; switch
|
||||||
// single UPDATE ... FROM (VALUES ...) if a save gets slow
|
// to a single UPDATE ... FROM (VALUES ...) if a save gets slow
|
||||||
await db.transaction(async (tx) => {
|
await db.transaction(async (tx) => {
|
||||||
for (const c of data.cards)
|
for (const [at, c] of data.cards.entries()) {
|
||||||
|
await tx
|
||||||
|
.update(card)
|
||||||
|
.set({ position: at })
|
||||||
|
.where(and(eq(card.id, c.id), eq(card.userId, user.id)))
|
||||||
for (const [position, id] of c.linkIds.entries())
|
for (const [position, id] of c.linkIds.entries())
|
||||||
await tx
|
await tx
|
||||||
.update(link)
|
.update(link)
|
||||||
.set({ cardId: c.id, position })
|
.set({ cardId: c.id, position })
|
||||||
.where(and(eq(link.id, id), eq(link.userId, user.id)))
|
.where(and(eq(link.id, id), eq(link.userId, user.id)))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -182,24 +364,135 @@ export const saveSettings = createServerFn({ method: "POST" })
|
|||||||
z
|
z
|
||||||
.object({
|
.object({
|
||||||
title: z.string().trim().min(1).max(40),
|
title: z.string().trim().min(1).max(40),
|
||||||
|
defaultDashboardId: z.uuid(),
|
||||||
searchEngine: z.enum(ENGINES),
|
searchEngine: z.enum(ENGINES),
|
||||||
// external image, the user's own upload, or null for the default
|
clockFont: z.enum(CLOCK_FONTS),
|
||||||
wallpaperUrl: z
|
clockStyle: z.enum(CLOCK_STYLES),
|
||||||
.union([httpUrl, z.string().regex(/^\/api\/wallpaper\?v=\d+$/)])
|
|
||||||
.nullable(),
|
|
||||||
})
|
})
|
||||||
.partial()
|
.partial()
|
||||||
.refine((patch) => Object.keys(patch).length > 0)
|
.refine((patch) => Object.keys(patch).length > 0)
|
||||||
)
|
)
|
||||||
.handler(async ({ data }) => {
|
.handler(async ({ data }) => {
|
||||||
const user = await requireUser()
|
const user = await requireUser()
|
||||||
|
if (data.defaultDashboardId)
|
||||||
|
await requireDashboard(user.id, data.defaultDashboardId)
|
||||||
await db
|
await db
|
||||||
.insert(settings)
|
.insert(settings)
|
||||||
.values({ ...data, userId: user.id })
|
.values({ ...data, userId: user.id })
|
||||||
.onConflictDoUpdate({ target: settings.userId, set: data })
|
.onConflictDoUpdate({ target: settings.userId, set: data })
|
||||||
|
})
|
||||||
|
|
||||||
|
/** The wallpaper of one dashboard. An upload goes to /api/wallpaper instead. */
|
||||||
|
export const saveWallpaper = createServerFn({ method: "POST" })
|
||||||
|
.validator(
|
||||||
|
z
|
||||||
|
.object({
|
||||||
|
dashboardId: z.uuid(),
|
||||||
|
// an image on the web, or null for the default photo
|
||||||
|
wallpaperUrl: httpUrl.nullable().optional(),
|
||||||
|
wallpaperDim: z.int().min(0).max(100).optional(),
|
||||||
|
})
|
||||||
|
.refine((patch) => Object.keys(patch).length > 1)
|
||||||
|
)
|
||||||
|
.handler(async ({ data: { dashboardId, ...patch } }) => {
|
||||||
|
const user = await requireUser()
|
||||||
|
const saved = await db
|
||||||
|
.update(dashboard)
|
||||||
|
.set(patch)
|
||||||
|
.where(and(eq(dashboard.id, dashboardId), eq(dashboard.userId, user.id)))
|
||||||
|
.returning({ id: dashboard.id })
|
||||||
|
if (!saved.length) throw new Error("Unknown dashboard")
|
||||||
// the stored upload is no longer shown
|
// the stored upload is no longer shown
|
||||||
if (data.wallpaperUrl !== undefined && !data.wallpaperUrl?.startsWith("/"))
|
if (patch.wallpaperUrl !== undefined)
|
||||||
await db.delete(wallpaper).where(eq(wallpaper.userId, user.id))
|
await db.delete(wallpaper).where(eq(wallpaper.dashboardId, dashboardId))
|
||||||
|
})
|
||||||
|
|
||||||
|
/** Every dashboard of the user with its cards and links, see backupSchema. */
|
||||||
|
export const exportData = createServerFn({ method: "GET" }).handler(
|
||||||
|
async (): Promise<Backup> => {
|
||||||
|
const user = await requireUser()
|
||||||
|
const [dashboards, cards, links] = await Promise.all([
|
||||||
|
db
|
||||||
|
.select()
|
||||||
|
.from(dashboard)
|
||||||
|
.where(eq(dashboard.userId, user.id))
|
||||||
|
.orderBy(...dashboardOrder),
|
||||||
|
db
|
||||||
|
.select()
|
||||||
|
.from(card)
|
||||||
|
.where(eq(card.userId, user.id))
|
||||||
|
.orderBy(asc(card.position), asc(card.createdAt)),
|
||||||
|
db
|
||||||
|
.select()
|
||||||
|
.from(link)
|
||||||
|
.where(eq(link.userId, user.id))
|
||||||
|
.orderBy(asc(link.position), asc(link.createdAt)),
|
||||||
|
])
|
||||||
|
return {
|
||||||
|
dashboards: dashboards.map((d) => ({
|
||||||
|
name: d.name,
|
||||||
|
wallpaperUrl: portable(d.wallpaperUrl),
|
||||||
|
wallpaperDim: d.wallpaperDim,
|
||||||
|
cards: cards
|
||||||
|
.filter((c) => c.dashboardId === d.id)
|
||||||
|
.map((c) => ({
|
||||||
|
name: c.name,
|
||||||
|
links: links
|
||||||
|
.filter((l) => l.cardId === c.id)
|
||||||
|
.map((l) => ({
|
||||||
|
name: l.name,
|
||||||
|
url: l.url,
|
||||||
|
icon: portable(l.icon),
|
||||||
|
})),
|
||||||
|
})),
|
||||||
|
})),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
/** Adds the dashboards of an export or of a bookmarks file. Nothing is replaced. */
|
||||||
|
export const importData = createServerFn({ method: "POST" })
|
||||||
|
.validator(backupSchema)
|
||||||
|
.handler(async ({ data }) => {
|
||||||
|
const user = await requireUser()
|
||||||
|
const userId = user.id
|
||||||
|
const added = { dashboards: data.dashboards.length, cards: 0, links: 0 }
|
||||||
|
// all of the file or nothing of it
|
||||||
|
await db.transaction(async (tx) => {
|
||||||
|
for (const d of data.dashboards) {
|
||||||
|
const [{ id: dashboardId }] = await tx
|
||||||
|
.insert(dashboard)
|
||||||
|
.values({
|
||||||
|
userId,
|
||||||
|
name: d.name,
|
||||||
|
position: lastDashboard(userId),
|
||||||
|
wallpaperUrl: d.wallpaperUrl,
|
||||||
|
wallpaperDim: d.wallpaperDim,
|
||||||
|
})
|
||||||
|
.returning({ id: dashboard.id })
|
||||||
|
for (const [position, c] of d.cards.entries()) {
|
||||||
|
const [{ id: cardId }] = await tx
|
||||||
|
.insert(card)
|
||||||
|
.values({ userId, dashboardId, position, name: c.name })
|
||||||
|
.returning({ id: card.id })
|
||||||
|
added.cards++
|
||||||
|
added.links += c.links.length
|
||||||
|
if (c.links.length)
|
||||||
|
await tx.insert(link).values(
|
||||||
|
c.links.map((l, at) => ({
|
||||||
|
userId,
|
||||||
|
cardId,
|
||||||
|
position: at,
|
||||||
|
name: l.name,
|
||||||
|
url: l.url,
|
||||||
|
// an upload of another account would not load here
|
||||||
|
icon: portable(l.icon),
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return added
|
||||||
})
|
})
|
||||||
|
|
||||||
export const suggest = createServerFn({ method: "GET" })
|
export const suggest = createServerFn({ method: "GET" })
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
// Server side: what the icon library has. The link dialog loads the same index in the browser.
|
||||||
|
import { LIBRARY_INDEX } from "@/lib/icons"
|
||||||
|
|
||||||
|
const DAY = 24 * 60 * 60 * 1000
|
||||||
|
let known: { names: Set<string>; at: number } | undefined
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The names of the library's icons, kept in memory for a day. Empty when the
|
||||||
|
* library cannot be reached: the dashboard then shows the plain icons.
|
||||||
|
*/
|
||||||
|
export async function libraryNames() {
|
||||||
|
if (known && Date.now() - known.at < DAY) return known.names
|
||||||
|
try {
|
||||||
|
const res = await fetch(LIBRARY_INDEX, {
|
||||||
|
// the page waits for this once a day at most, so not for long
|
||||||
|
signal: AbortSignal.timeout(2000),
|
||||||
|
})
|
||||||
|
const index = (await res.json()) as { png: string[] }
|
||||||
|
known = {
|
||||||
|
names: new Set(index.png.map((file) => file.replace(/\.png$/, ""))),
|
||||||
|
at: Date.now(),
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// what was known before, and the next try in five minutes
|
||||||
|
known = {
|
||||||
|
names: known?.names ?? new Set(),
|
||||||
|
at: Date.now() - DAY + 5 * 60 * 1000,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return known.names
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import assert from "node:assert/strict"
|
||||||
|
import { test } from "node:test"
|
||||||
|
import {
|
||||||
|
UPLOADED_ICON,
|
||||||
|
iconSources,
|
||||||
|
lightVariant,
|
||||||
|
searchIcons,
|
||||||
|
} from "./icons.ts"
|
||||||
|
|
||||||
|
const link = { name: "Home Assistant", url: "https://ha.example.com/lovelace" }
|
||||||
|
const first = (icon: string | null) => iconSources({ ...link, icon })[0]
|
||||||
|
|
||||||
|
test("no icon: looked up by name, then the site's favicon", () => {
|
||||||
|
assert.deepEqual(iconSources({ ...link, icon: null }), [
|
||||||
|
"https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/home-assistant.png",
|
||||||
|
"https://ha.example.com/favicon.ico",
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
test("the light version is used for a link without an icon of its own", () => {
|
||||||
|
const library = new Set(["github", "github-light", "plex"])
|
||||||
|
assert.equal(lightVariant(library, " GitHub "), "github-light")
|
||||||
|
assert.equal(lightVariant(library, "Plex"), null)
|
||||||
|
const github = { name: "GitHub", url: "https://github.com" }
|
||||||
|
const lightIcon = "github-light"
|
||||||
|
assert.match(
|
||||||
|
iconSources({ ...github, icon: null, lightIcon })[0],
|
||||||
|
/\/png\/github-light\.png$/
|
||||||
|
)
|
||||||
|
// the user chose the dark one
|
||||||
|
assert.match(
|
||||||
|
iconSources({ ...github, icon: "github", lightIcon })[0],
|
||||||
|
/\/png\/github\.png$/
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
test("an icon name is looked up in the library", () => {
|
||||||
|
assert.match(first(" Plex "), /\/png\/plex\.png$/)
|
||||||
|
})
|
||||||
|
|
||||||
|
test("an image address and an upload are used as they are", () => {
|
||||||
|
assert.equal(first("https://example.com/a.png"), "https://example.com/a.png")
|
||||||
|
assert.equal(first(`${UPLOADED_ICON}abc`), "/api/icon?id=abc")
|
||||||
|
})
|
||||||
|
|
||||||
|
test("searchIcons: names that start with the query first, the shortest first", () => {
|
||||||
|
// the order of the library's index: "plex-alt" is before "plex" there
|
||||||
|
const names = ["a-plex", "jellyfin", "plex-alt", "plex", "plexamp"]
|
||||||
|
assert.deepEqual(searchIcons(names, "Plex"), [
|
||||||
|
"plex",
|
||||||
|
"plexamp",
|
||||||
|
"plex-alt",
|
||||||
|
"a-plex",
|
||||||
|
])
|
||||||
|
assert.deepEqual(searchIcons(names, "plex", 2), ["plex", "plexamp"])
|
||||||
|
assert.deepEqual(searchIcons(names, "nothing"), [])
|
||||||
|
})
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
// Where a link's icon comes from. Pure, so it can be tested without a browser.
|
||||||
|
|
||||||
|
const LIBRARY = "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons"
|
||||||
|
|
||||||
|
/** JSON with the file names of every icon in the library: `{ png: ["plex.png", …] }`. */
|
||||||
|
export const LIBRARY_INDEX = `${LIBRARY}/tree.json`
|
||||||
|
|
||||||
|
/** How a link stores an icon that the user uploaded: this plus the icon's id. */
|
||||||
|
export const UPLOADED_ICON = "/api/icon?id="
|
||||||
|
|
||||||
|
const slug = (name: string) =>
|
||||||
|
name
|
||||||
|
.trim()
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/[^a-z0-9]+/g, "-")
|
||||||
|
.replace(/^-|-$/g, "")
|
||||||
|
|
||||||
|
export const libraryIcon = (name: string) => `${LIBRARY}/png/${slug(name)}.png`
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The library has a light version of some icons (`github-light`), made for dark
|
||||||
|
* backgrounds like the cards. Its name for a link that is called `name`, or null.
|
||||||
|
*/
|
||||||
|
export function lightVariant(libraryNames: Set<string>, name: string) {
|
||||||
|
const light = `${slug(name)}-light`
|
||||||
|
return libraryNames.has(light) ? light : null
|
||||||
|
}
|
||||||
|
|
||||||
|
/** An image address or an upload, not a name in the library. */
|
||||||
|
export const isImageAddress = (icon: string) =>
|
||||||
|
/^https?:\/\//.test(icon) || icon.startsWith(UPLOADED_ICON)
|
||||||
|
|
||||||
|
/** Icon sources to try in order; the letter tile is the last resort. */
|
||||||
|
export function iconSources({
|
||||||
|
name,
|
||||||
|
url,
|
||||||
|
icon,
|
||||||
|
lightIcon,
|
||||||
|
}: {
|
||||||
|
name: string
|
||||||
|
url: string
|
||||||
|
icon: string | null
|
||||||
|
/** see lightVariant; only used when the link has no icon of its own */
|
||||||
|
lightIcon?: string | null
|
||||||
|
}) {
|
||||||
|
return [
|
||||||
|
icon && isImageAddress(icon)
|
||||||
|
? icon
|
||||||
|
: libraryIcon(icon || lightIcon || name),
|
||||||
|
`${new URL(url).origin}/favicon.ico`,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Library icons for what the user typed: names that start with it, then names that
|
||||||
|
* contain it. In both groups the shortest first, so "plex" is before "plex-alt".
|
||||||
|
*/
|
||||||
|
export function searchIcons(names: string[], query: string, limit = 42) {
|
||||||
|
const q = slug(query)
|
||||||
|
const rank = (n: string) => (n.startsWith(q) ? 0 : 1000) + n.length
|
||||||
|
return names
|
||||||
|
.filter((n) => n.includes(q))
|
||||||
|
.sort((a, b) => rank(a) - rank(b))
|
||||||
|
.slice(0, limit)
|
||||||
|
}
|
||||||
+13
-1
@@ -1,6 +1,6 @@
|
|||||||
import assert from "node:assert/strict"
|
import assert from "node:assert/strict"
|
||||||
import { test } from "node:test"
|
import { test } from "node:test"
|
||||||
import { drop, moveOver, order } from "./layout.ts"
|
import { drop, moveCard, moveOver, order } from "./layout.ts"
|
||||||
|
|
||||||
const cards = () => [
|
const cards = () => [
|
||||||
{ id: "apps", links: [{ id: "a" }, { id: "b" }, { id: "c" }] },
|
{ id: "apps", links: [{ id: "a" }, { id: "b" }, { id: "c" }] },
|
||||||
@@ -31,6 +31,18 @@ test("a link dropped on a card goes to its end", () => {
|
|||||||
assert.deepEqual(ids(drop(cards(), "a", "empty")), ["bc", "x", "a"])
|
assert.deepEqual(ids(drop(cards(), "a", "empty")), ["bc", "x", "a"])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("a card takes the place of the card it is over, with its links", () => {
|
||||||
|
assert.deepEqual(ids(moveCard(cards(), "apps", "empty")), ["x", "", "abc"])
|
||||||
|
assert.deepEqual(ids(moveCard(cards(), "empty", "apps")), ["", "abc", "x"])
|
||||||
|
})
|
||||||
|
|
||||||
|
test("a card over itself, or a link over a card, moves no card", () => {
|
||||||
|
const before = cards()
|
||||||
|
assert.equal(moveCard(before, "apps", "apps"), before)
|
||||||
|
assert.equal(moveCard(before, "a", "web"), before)
|
||||||
|
assert.equal(drop(before, "apps", "web"), before)
|
||||||
|
})
|
||||||
|
|
||||||
test("unknown ids change nothing", () => {
|
test("unknown ids change nothing", () => {
|
||||||
const before = cards()
|
const before = cards()
|
||||||
assert.equal(drop(before, "nope", "x"), before)
|
assert.equal(drop(before, "nope", "x"), before)
|
||||||
|
|||||||
+16
-2
@@ -1,4 +1,4 @@
|
|||||||
// Where links sit in their cards. Pure, so drag and drop can be tested without a browser.
|
// Where the cards sit, and the links in them. Pure, so drag and drop can be tested without a browser.
|
||||||
|
|
||||||
type Card = { id: string; links: { id: string }[] }
|
type Card = { id: string; links: { id: string }[] }
|
||||||
|
|
||||||
@@ -28,6 +28,20 @@ export function moveOver<TCard extends Card>(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** While dragging a card: it takes the place of the card it hovers over. */
|
||||||
|
export function moveCard<TCard extends Card>(
|
||||||
|
cards: TCard[],
|
||||||
|
cardId: string,
|
||||||
|
overId: string
|
||||||
|
): TCard[] {
|
||||||
|
const from = cards.findIndex((c) => c.id === cardId)
|
||||||
|
const to = cards.findIndex((c) => c.id === overId)
|
||||||
|
if (from < 0 || to < 0 || from === to) return cards
|
||||||
|
const next = [...cards]
|
||||||
|
next.splice(to, 0, ...next.splice(from, 1))
|
||||||
|
return next
|
||||||
|
}
|
||||||
|
|
||||||
/** On drop: the link takes the place of the link it was dropped on. */
|
/** On drop: the link takes the place of the link it was dropped on. */
|
||||||
export function drop<TCard extends Card>(
|
export function drop<TCard extends Card>(
|
||||||
cards: TCard[],
|
cards: TCard[],
|
||||||
@@ -45,6 +59,6 @@ export function drop<TCard extends Card>(
|
|||||||
return cards.map((c) => (c === card ? { ...c, links } : c))
|
return cards.map((c) => (c === card ? { ...c, links } : c))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** What the server stores: per card, its link ids in order. */
|
/** What the server stores: the cards in order and, per card, its link ids in order. */
|
||||||
export const order = (cards: Card[]) =>
|
export const order = (cards: Card[]) =>
|
||||||
cards.map((c) => ({ id: c.id, linkIds: c.links.map((l) => l.id) }))
|
cards.map((c) => ({ id: c.id, linkIds: c.links.map((l) => l.id) }))
|
||||||
|
|||||||
+22
-1
@@ -1,6 +1,27 @@
|
|||||||
import assert from "node:assert/strict"
|
import assert from "node:assert/strict"
|
||||||
import { test } from "node:test"
|
import { test } from "node:test"
|
||||||
import { parseSuggestions, searchUrl } from "./search.ts"
|
import { matchLinks, parseSuggestions, searchUrl } from "./search.ts"
|
||||||
|
|
||||||
|
test("matchLinks", () => {
|
||||||
|
const links = ["Grafana", "Home Assistant", "IT-Tools", "Sonarr"].map(
|
||||||
|
(name) => ({ name })
|
||||||
|
)
|
||||||
|
const names = (typed: string) => {
|
||||||
|
const { links: found, starts } = matchLinks(links, typed)
|
||||||
|
return [found.map((l) => l.name).join(","), starts]
|
||||||
|
}
|
||||||
|
// the start of the name or of a word in it comes first and counts as a start
|
||||||
|
assert.deepEqual(names("so"), ["Sonarr", 1])
|
||||||
|
assert.deepEqual(names(" ASSIST "), ["Home Assistant", 1])
|
||||||
|
assert.deepEqual(names("tools"), ["IT-Tools", 1])
|
||||||
|
// only inside a word: listed, but Enter does not open it
|
||||||
|
assert.deepEqual(names("ana"), ["Grafana", 0])
|
||||||
|
assert.deepEqual(names("a"), ["Home Assistant,Grafana,Sonarr", 1])
|
||||||
|
assert.deepEqual(names("plex"), ["", 0])
|
||||||
|
// a query with a space is one phrase
|
||||||
|
assert.deepEqual(names("home a"), ["Home Assistant", 1])
|
||||||
|
assert.deepEqual(names("grafana docs"), ["", 0])
|
||||||
|
})
|
||||||
|
|
||||||
test("searchUrl", () => {
|
test("searchUrl", () => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
|||||||
@@ -29,6 +29,26 @@ export function searchUrl(
|
|||||||
return `https://duckduckgo.com/?q=${q}`
|
return `https://duckduckgo.com/?q=${q}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The links for what was typed. First the ones where the name or a word of it starts
|
||||||
|
* with it (`starts` of them: Enter opens the first), then the ones that contain it.
|
||||||
|
*/
|
||||||
|
export function matchLinks<TLink extends { name: string }>(
|
||||||
|
links: TLink[],
|
||||||
|
typed: string
|
||||||
|
) {
|
||||||
|
const q = typed.trim().toLowerCase()
|
||||||
|
const starts: TLink[] = []
|
||||||
|
const contains: TLink[] = []
|
||||||
|
for (const link of links) {
|
||||||
|
const name = link.name.toLowerCase()
|
||||||
|
const words = [name, ...name.split(/[^\p{L}\p{N}]+/u)]
|
||||||
|
if (words.some((word) => word.startsWith(q))) starts.push(link)
|
||||||
|
else if (name.includes(q)) contains.push(link)
|
||||||
|
}
|
||||||
|
return { links: [...starts, ...contains], starts: starts.length }
|
||||||
|
}
|
||||||
|
|
||||||
/** Both DuckDuckGo and SearXNG answer in OpenSearch form: [query, [suggestions]] */
|
/** Both DuckDuckGo and SearXNG answer in OpenSearch form: [query, [suggestions]] */
|
||||||
export function parseSuggestions(body: unknown): string[] {
|
export function parseSuggestions(body: unknown): string[] {
|
||||||
const list = Array.isArray(body) && Array.isArray(body[1]) ? body[1] : body
|
const list = Array.isArray(body) && Array.isArray(body[1]) ? body[1] : body
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import assert from "node:assert/strict"
|
||||||
|
import { createServer } from "node:http"
|
||||||
|
import { test } from "node:test"
|
||||||
|
import { isReachable, isUp } from "./status.ts"
|
||||||
|
|
||||||
|
test("isUp: any answer below 500", () => {
|
||||||
|
assert.equal(isUp({ status: 200 }), true)
|
||||||
|
assert.equal(isUp({ status: 302 }), true)
|
||||||
|
assert.equal(isUp({ status: 401 }), true) // a login page is an app that runs
|
||||||
|
assert.equal(isUp({ status: 404 }), true)
|
||||||
|
assert.equal(isUp({ status: 500 }), false)
|
||||||
|
assert.equal(isUp({ status: 502 }), false)
|
||||||
|
})
|
||||||
|
|
||||||
|
test("isUp: a certificate that this server does not trust is still an answer", () => {
|
||||||
|
const failed = (code: string) =>
|
||||||
|
Object.assign(new TypeError("fetch failed"), { cause: { code } })
|
||||||
|
assert.equal(isUp({ error: failed("DEPTH_ZERO_SELF_SIGNED_CERT") }), true)
|
||||||
|
assert.equal(isUp({ error: failed("UNABLE_TO_VERIFY_LEAF_SIGNATURE") }), true)
|
||||||
|
assert.equal(isUp({ error: failed("ERR_TLS_CERT_ALTNAME_INVALID") }), true)
|
||||||
|
assert.equal(isUp({ error: failed("ECONNREFUSED") }), false)
|
||||||
|
assert.equal(isUp({ error: failed("ENOTFOUND") }), false)
|
||||||
|
assert.equal(
|
||||||
|
isUp({ error: new DOMException("timeout", "TimeoutError") }),
|
||||||
|
false
|
||||||
|
)
|
||||||
|
assert.equal(isUp({ error: null }), false)
|
||||||
|
})
|
||||||
|
|
||||||
|
test("isReachable: asks the address, once per minute", async () => {
|
||||||
|
let requests = 0
|
||||||
|
const server = createServer((req, res) => {
|
||||||
|
requests++
|
||||||
|
res.writeHead(req.url === "/broken" ? 503 : 302, {
|
||||||
|
Location: "http://127.0.0.1:1/",
|
||||||
|
})
|
||||||
|
res.end()
|
||||||
|
})
|
||||||
|
await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve))
|
||||||
|
const { port } = server.address() as { port: number }
|
||||||
|
const base = `http://127.0.0.1:${port}`
|
||||||
|
try {
|
||||||
|
// the redirect is not followed: its target does not answer
|
||||||
|
assert.equal(await isReachable(`${base}/`), true)
|
||||||
|
assert.equal(await isReachable(`${base}/`), true)
|
||||||
|
assert.equal(requests, 1)
|
||||||
|
assert.equal(await isReachable(`${base}/broken`), false)
|
||||||
|
} finally {
|
||||||
|
server.close()
|
||||||
|
}
|
||||||
|
assert.equal(await isReachable("http://127.0.0.1:1/"), false) // nothing listens
|
||||||
|
})
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
// Is the address of a link reachable? Server side: the server asks, not the browser,
|
||||||
|
// so it also works for apps that do not allow requests from other pages.
|
||||||
|
|
||||||
|
/** Off unless the operator turns it on: users make the server call addresses they typed. */
|
||||||
|
export const statusChecks = process.env.STATUS_CHECKS === "true"
|
||||||
|
|
||||||
|
const TTL = 60_000
|
||||||
|
const TIMEOUT = 4000
|
||||||
|
/** Per address the last check, also while it runs, so one address is asked once a minute. */
|
||||||
|
const checks = new Map<string, { at: number; up: Promise<boolean> }>()
|
||||||
|
|
||||||
|
// A server answered, only this server does not trust its certificate (self-signed,
|
||||||
|
// private CA). The browser of the user may well trust it.
|
||||||
|
const CERTIFICATE = /CERT|SELF_SIGNED|UNABLE_TO_VERIFY|ALTNAME/
|
||||||
|
|
||||||
|
/** Up: any answer below 500. An app behind a proxy that is down answers 502 to 504. */
|
||||||
|
export function isUp(result: { status: number } | { error: unknown }) {
|
||||||
|
if ("status" in result) return result.status < 500
|
||||||
|
const cause = (result.error as { cause?: { code?: unknown } } | null)?.cause
|
||||||
|
return typeof cause?.code === "string" && CERTIFICATE.test(cause.code)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function check(url: string) {
|
||||||
|
try {
|
||||||
|
const res = await fetch(url, {
|
||||||
|
// a redirect is an answer: do not follow it to another host
|
||||||
|
redirect: "manual",
|
||||||
|
signal: AbortSignal.timeout(TIMEOUT),
|
||||||
|
})
|
||||||
|
void res.body?.cancel() // the page itself is of no interest
|
||||||
|
return isUp(res)
|
||||||
|
} catch (error) {
|
||||||
|
return isUp({ error })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isReachable(url: string) {
|
||||||
|
const now = Date.now()
|
||||||
|
if (checks.size > 1000)
|
||||||
|
for (const [key, { at }] of checks) if (now - at > TTL) checks.delete(key)
|
||||||
|
let last = checks.get(url)
|
||||||
|
if (!last || now - last.at > TTL)
|
||||||
|
checks.set(url, (last = { at: now, up: check(url) }))
|
||||||
|
return last.up
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
import assert from "node:assert/strict"
|
||||||
|
import { test } from "node:test"
|
||||||
|
import { backupSchema, parseBookmarks, portable } from "./transfer.ts"
|
||||||
|
|
||||||
|
// what Firefox and Chrome write, shortened
|
||||||
|
const BOOKMARKS = `<!DOCTYPE NETSCAPE-Bookmark-file-1>
|
||||||
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
|
||||||
|
<TITLE>Bookmarks</TITLE>
|
||||||
|
<H1>Bookmarks</H1>
|
||||||
|
<DL><p>
|
||||||
|
<DT><A HREF="https://example.com/top" ADD_DATE="1">Top level</A>
|
||||||
|
<DT><H3 ADD_DATE="1" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3>
|
||||||
|
<DL><p>
|
||||||
|
<DT><A HREF="https://git.example.com/?a=1&b=2" ICON="data:image/png;base64,AAAA">Git & "CI" ü</A>
|
||||||
|
<DT><H3>Media</H3>
|
||||||
|
<DL><p>
|
||||||
|
<DT><A HREF="http://plex.lan:32400/web">Plex</A>
|
||||||
|
<DT><A HREF="javascript:alert(1)">A bookmarklet</A>
|
||||||
|
<DT><A HREF="https://nameless.example.com/x"></A>
|
||||||
|
</DL><p>
|
||||||
|
<DT><A HREF="place:sort=8">Most visited</A>
|
||||||
|
</DL><p>
|
||||||
|
<DT><H3>Empty folder</H3>
|
||||||
|
<DL><p>
|
||||||
|
</DL><p>
|
||||||
|
</DL><p>`
|
||||||
|
|
||||||
|
test("parseBookmarks: a card per folder that has bookmarks", () => {
|
||||||
|
const found = parseBookmarks(BOOKMARKS)
|
||||||
|
assert.ok(found)
|
||||||
|
assert.equal(found.skipped, 2) // the bookmarklet and place:
|
||||||
|
assert.deepEqual(found.backup, {
|
||||||
|
dashboards: [
|
||||||
|
{
|
||||||
|
name: "Bookmarks",
|
||||||
|
cards: [
|
||||||
|
{
|
||||||
|
name: "Bookmarks",
|
||||||
|
links: [{ name: "Top level", url: "https://example.com/top" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Bookmarks bar",
|
||||||
|
links: [
|
||||||
|
{ name: 'Git & "CI" ü', url: "https://git.example.com/?a=1&b=2" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Media",
|
||||||
|
links: [
|
||||||
|
{ name: "Plex", url: "http://plex.lan:32400/web" },
|
||||||
|
{
|
||||||
|
name: "nameless.example.com",
|
||||||
|
url: "https://nameless.example.com/x",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
// what it makes is what an import takes
|
||||||
|
assert.ok(backupSchema.safeParse(found.backup).success)
|
||||||
|
})
|
||||||
|
|
||||||
|
test("parseBookmarks: limits, long names, files without bookmarks", () => {
|
||||||
|
assert.equal(parseBookmarks("<html><body>Hello</body></html>"), null)
|
||||||
|
assert.equal(parseBookmarks('{"dashboards": []}'), null)
|
||||||
|
const many = Array.from(
|
||||||
|
{ length: 502 },
|
||||||
|
(_, i) => `<DT><A HREF="https://example.com/${i}">${"n".repeat(70)}</A>`
|
||||||
|
).join("")
|
||||||
|
const found = parseBookmarks(`<DL>${many}</DL>`)
|
||||||
|
assert.ok(found)
|
||||||
|
assert.equal(found.backup.dashboards[0].cards[0].links.length, 500)
|
||||||
|
assert.equal(found.backup.dashboards[0].cards[0].links[0].name.length, 60)
|
||||||
|
assert.equal(found.skipped, 2)
|
||||||
|
assert.ok(backupSchema.safeParse(found.backup).success)
|
||||||
|
})
|
||||||
|
|
||||||
|
test("backupSchema refuses what is not a web address", () => {
|
||||||
|
const withUrl = (url: string) => ({
|
||||||
|
dashboards: [
|
||||||
|
{ name: "D", cards: [{ name: "C", links: [{ name: "L", url }] }] },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
assert.ok(backupSchema.safeParse(withUrl("https://example.com")).success)
|
||||||
|
assert.ok(!backupSchema.safeParse(withUrl("javascript:alert(1)")).success)
|
||||||
|
assert.ok(!backupSchema.safeParse({ dashboards: [] }).success)
|
||||||
|
// 11 cards with 500 links each are more than one file may hold
|
||||||
|
const links = Array.from({ length: 500 }, () => ({
|
||||||
|
name: "L",
|
||||||
|
url: "https://example.com",
|
||||||
|
}))
|
||||||
|
const cards = (n: number) =>
|
||||||
|
Array.from({ length: n }, () => ({ name: "C", links }))
|
||||||
|
const file = (n: number) => ({ dashboards: [{ name: "D", cards: cards(n) }] })
|
||||||
|
assert.ok(backupSchema.safeParse(file(10)).success)
|
||||||
|
assert.ok(!backupSchema.safeParse(file(11)).success)
|
||||||
|
})
|
||||||
|
|
||||||
|
test("portable: uploads stay with their account", () => {
|
||||||
|
assert.equal(portable("/api/icon?id=1"), null)
|
||||||
|
assert.equal(portable("plex"), "plex")
|
||||||
|
assert.equal(
|
||||||
|
portable("https://example.com/a.png"),
|
||||||
|
"https://example.com/a.png"
|
||||||
|
)
|
||||||
|
assert.equal(portable(null), null)
|
||||||
|
})
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
// Export and import: the shape of the file, and how a browser's bookmarks become one.
|
||||||
|
import { z } from "zod"
|
||||||
|
|
||||||
|
const httpUrl = z.url({ protocol: /^https?$/ }).max(2000)
|
||||||
|
const MAX_CARDS = 100
|
||||||
|
const MAX_LINKS = 500 // per card
|
||||||
|
const MAX_TOTAL = 5000 // links in one file
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What an export holds and an import takes: dashboards with their cards and links.
|
||||||
|
* Uploaded wallpapers and icons are not in it, they belong to one account.
|
||||||
|
*/
|
||||||
|
export const backupSchema = z.object({
|
||||||
|
dashboards: z
|
||||||
|
.array(
|
||||||
|
z.object({
|
||||||
|
name: z.string().trim().min(1).max(40),
|
||||||
|
// an image on the web; null or missing: the default photo
|
||||||
|
wallpaperUrl: httpUrl.nullish(),
|
||||||
|
wallpaperDim: z.int().min(0).max(100).optional(),
|
||||||
|
cards: z
|
||||||
|
.array(
|
||||||
|
z.object({
|
||||||
|
name: z.string().trim().min(1).max(40),
|
||||||
|
links: z
|
||||||
|
.array(
|
||||||
|
z.object({
|
||||||
|
name: z.string().trim().min(1).max(60),
|
||||||
|
url: httpUrl,
|
||||||
|
// an image on the web or a name in the icon library
|
||||||
|
icon: z.string().trim().max(2000).nullish(),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.max(MAX_LINKS),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.max(MAX_CARDS),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.min(1)
|
||||||
|
.max(20)
|
||||||
|
// one import is one transaction: keep it small enough for that
|
||||||
|
.refine(
|
||||||
|
(dashboards) =>
|
||||||
|
dashboards.flatMap((d) => d.cards.flatMap((c) => c.links)).length <=
|
||||||
|
MAX_TOTAL
|
||||||
|
),
|
||||||
|
})
|
||||||
|
export type Backup = z.infer<typeof backupSchema>
|
||||||
|
|
||||||
|
/** An upload ("/api/icon?id=…") only works for the account that made it. */
|
||||||
|
export const portable = (address?: string | null) =>
|
||||||
|
!address || address.startsWith("/") ? null : address
|
||||||
|
|
||||||
|
const ENTITIES: Record<string, string> = {
|
||||||
|
amp: "&",
|
||||||
|
lt: "<",
|
||||||
|
gt: ">",
|
||||||
|
quot: '"',
|
||||||
|
apos: "'",
|
||||||
|
}
|
||||||
|
const text = (html: string) =>
|
||||||
|
html
|
||||||
|
.replace(/<[^>]*>/g, "")
|
||||||
|
.replace(/&(#x?[0-9a-f]+|[a-z]+);/gi, (entity, code: string) => {
|
||||||
|
if (code[0] !== "#") return ENTITIES[code.toLowerCase()] ?? entity
|
||||||
|
const point =
|
||||||
|
code[1].toLowerCase() === "x"
|
||||||
|
? parseInt(code.slice(2), 16)
|
||||||
|
: parseInt(code.slice(1), 10)
|
||||||
|
return point <= 0x10ffff ? String.fromCodePoint(point) : entity
|
||||||
|
})
|
||||||
|
.trim()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bookmarks file that every browser exports (HTML) as one dashboard: a card per
|
||||||
|
* folder that has bookmarks, named like the folder. `skipped` counts what was left out:
|
||||||
|
* addresses that are not http(s), and what is over the limits of an import.
|
||||||
|
* Null when the file has no bookmark in it.
|
||||||
|
*/
|
||||||
|
export function parseBookmarks(html: string) {
|
||||||
|
const cards = new Map<string, Backup["dashboards"][0]["cards"][0]>()
|
||||||
|
const folders: string[] = [] // the path to where we are
|
||||||
|
let heading: string | null = null // a folder name that waits for its <DL>
|
||||||
|
let skipped = 0
|
||||||
|
let total = 0
|
||||||
|
const tags =
|
||||||
|
/<DL\b|<\/DL>|<H3\b[^>]*>([\s\S]*?)<\/H3>|<A\b([^>]*)>([\s\S]*?)<\/A>/gi
|
||||||
|
for (const [tag, folder, attributes, title] of html.matchAll(tags)) {
|
||||||
|
if (/^<DL/i.test(tag)) {
|
||||||
|
folders.push(heading ?? "")
|
||||||
|
heading = null
|
||||||
|
} else if (/^<\/DL/i.test(tag)) folders.pop()
|
||||||
|
else if (/^<H3/i.test(tag)) heading = text(folder)
|
||||||
|
else {
|
||||||
|
const href = /\bHREF\s*=\s*"([^"]*)"/i.exec(attributes)
|
||||||
|
const url = httpUrl.safeParse(text(href?.[1] ?? ""))
|
||||||
|
// two folders with the same name stay two cards
|
||||||
|
const path = folders.join("\n")
|
||||||
|
const card = cards.get(path) ?? {
|
||||||
|
name: (folders.filter(Boolean).at(-1) ?? "Bookmarks").slice(0, 40),
|
||||||
|
links: [],
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!url.success ||
|
||||||
|
total >= MAX_TOTAL ||
|
||||||
|
card.links.length >= MAX_LINKS ||
|
||||||
|
(!cards.has(path) && cards.size >= MAX_CARDS)
|
||||||
|
) {
|
||||||
|
skipped++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
cards.set(path, card)
|
||||||
|
total++
|
||||||
|
card.links.push({
|
||||||
|
name: (text(title) || new URL(url.data).hostname).slice(0, 60),
|
||||||
|
url: url.data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!cards.size) return null
|
||||||
|
const backup: Backup = {
|
||||||
|
dashboards: [{ name: "Bookmarks", cards: [...cards.values()] }],
|
||||||
|
}
|
||||||
|
return { backup, skipped }
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
// Shared by the routes that store images in the database (wallpaper, link icons).
|
||||||
|
import { auth } from "@/lib/auth"
|
||||||
|
|
||||||
|
export async function userId(request: Request) {
|
||||||
|
const session = await auth.api.getSession({ headers: request.headers })
|
||||||
|
return session?.user.id
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The image in the body of an upload, or the response that says why it was refused. */
|
||||||
|
export async function readImage(
|
||||||
|
request: Request,
|
||||||
|
limits: { types: string[]; formats: string; maxMb: number }
|
||||||
|
) {
|
||||||
|
const id = await userId(request)
|
||||||
|
if (!id) return new Response("Unauthorized", { status: 401 })
|
||||||
|
const mime = request.headers.get("content-type") ?? ""
|
||||||
|
if (!limits.types.includes(mime))
|
||||||
|
return new Response(`Use a ${limits.formats} image`, { status: 415 })
|
||||||
|
const maxBytes = limits.maxMb * 1024 * 1024
|
||||||
|
const tooLarge = () =>
|
||||||
|
new Response(`Image is empty or larger than ${limits.maxMb} MB`, {
|
||||||
|
status: 413,
|
||||||
|
})
|
||||||
|
// a chunked body has no declared size and could fill the memory
|
||||||
|
const declared = Number(request.headers.get("content-length"))
|
||||||
|
if (
|
||||||
|
!(declared > 0 && declared <= maxBytes) ||
|
||||||
|
request.headers.has("transfer-encoding")
|
||||||
|
)
|
||||||
|
return tooLarge()
|
||||||
|
const data = new Uint8Array(await request.arrayBuffer())
|
||||||
|
if (!data.length || data.length > maxBytes) return tooLarge()
|
||||||
|
return { userId: id, mime, data }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Answers with a stored image. Its URL has to change when the image does. */
|
||||||
|
export const serveImage = (row?: { mime: string; data: Uint8Array }) =>
|
||||||
|
row
|
||||||
|
? new Response(new Uint8Array(row.data), {
|
||||||
|
headers: {
|
||||||
|
"Content-Type": row.mime,
|
||||||
|
"X-Content-Type-Options": "nosniff",
|
||||||
|
// an SVG that is opened in its own tab must not run scripts on this origin
|
||||||
|
"Content-Security-Policy":
|
||||||
|
"default-src 'none'; style-src 'unsafe-inline'; sandbox",
|
||||||
|
"Cache-Control": "private, max-age=31536000, immutable",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
: new Response("Not found", { status: 404 })
|
||||||
+39
-3
@@ -12,6 +12,7 @@ import { Route as rootRouteImport } from './routes/__root'
|
|||||||
import { Route as IndexRouteImport } from './routes/index'
|
import { Route as IndexRouteImport } from './routes/index'
|
||||||
import { Route as LoginRouteImport } from './routes/login'
|
import { Route as LoginRouteImport } from './routes/login'
|
||||||
import { Route as SettingsRouteImport } from './routes/settings'
|
import { Route as SettingsRouteImport } from './routes/settings'
|
||||||
|
import { Route as ApiIconRouteImport } from './routes/api/icon'
|
||||||
import { Route as ApiWallpaperRouteImport } from './routes/api/wallpaper'
|
import { Route as ApiWallpaperRouteImport } from './routes/api/wallpaper'
|
||||||
import { Route as ApiAuthSplatRouteImport } from './routes/api/auth/$'
|
import { Route as ApiAuthSplatRouteImport } from './routes/api/auth/$'
|
||||||
|
|
||||||
@@ -30,6 +31,11 @@ const SettingsRoute = SettingsRouteImport.update({
|
|||||||
path: '/settings',
|
path: '/settings',
|
||||||
getParentRoute: () => rootRouteImport,
|
getParentRoute: () => rootRouteImport,
|
||||||
} as any)
|
} as any)
|
||||||
|
const ApiIconRoute = ApiIconRouteImport.update({
|
||||||
|
id: '/api/icon',
|
||||||
|
path: '/api/icon',
|
||||||
|
getParentRoute: () => rootRouteImport,
|
||||||
|
} as any)
|
||||||
const ApiWallpaperRoute = ApiWallpaperRouteImport.update({
|
const ApiWallpaperRoute = ApiWallpaperRouteImport.update({
|
||||||
id: '/api/wallpaper',
|
id: '/api/wallpaper',
|
||||||
path: '/api/wallpaper',
|
path: '/api/wallpaper',
|
||||||
@@ -45,6 +51,7 @@ export interface FileRoutesByFullPath {
|
|||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/login': typeof LoginRoute
|
'/login': typeof LoginRoute
|
||||||
'/settings': typeof SettingsRoute
|
'/settings': typeof SettingsRoute
|
||||||
|
'/api/icon': typeof ApiIconRoute
|
||||||
'/api/wallpaper': typeof ApiWallpaperRoute
|
'/api/wallpaper': typeof ApiWallpaperRoute
|
||||||
'/api/auth/$': typeof ApiAuthSplatRoute
|
'/api/auth/$': typeof ApiAuthSplatRoute
|
||||||
}
|
}
|
||||||
@@ -52,6 +59,7 @@ export interface FileRoutesByTo {
|
|||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/login': typeof LoginRoute
|
'/login': typeof LoginRoute
|
||||||
'/settings': typeof SettingsRoute
|
'/settings': typeof SettingsRoute
|
||||||
|
'/api/icon': typeof ApiIconRoute
|
||||||
'/api/wallpaper': typeof ApiWallpaperRoute
|
'/api/wallpaper': typeof ApiWallpaperRoute
|
||||||
'/api/auth/$': typeof ApiAuthSplatRoute
|
'/api/auth/$': typeof ApiAuthSplatRoute
|
||||||
}
|
}
|
||||||
@@ -60,22 +68,42 @@ export interface FileRoutesById {
|
|||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/login': typeof LoginRoute
|
'/login': typeof LoginRoute
|
||||||
'/settings': typeof SettingsRoute
|
'/settings': typeof SettingsRoute
|
||||||
|
'/api/icon': typeof ApiIconRoute
|
||||||
'/api/wallpaper': typeof ApiWallpaperRoute
|
'/api/wallpaper': typeof ApiWallpaperRoute
|
||||||
'/api/auth/$': typeof ApiAuthSplatRoute
|
'/api/auth/$': typeof ApiAuthSplatRoute
|
||||||
}
|
}
|
||||||
export interface FileRouteTypes {
|
export interface FileRouteTypes {
|
||||||
fileRoutesByFullPath: FileRoutesByFullPath
|
fileRoutesByFullPath: FileRoutesByFullPath
|
||||||
fullPaths: '/' | '/login' | '/settings' | '/api/wallpaper' | '/api/auth/$'
|
fullPaths:
|
||||||
|
| '/'
|
||||||
|
| '/login'
|
||||||
|
| '/settings'
|
||||||
|
| '/api/icon'
|
||||||
|
| '/api/wallpaper'
|
||||||
|
| '/api/auth/$'
|
||||||
fileRoutesByTo: FileRoutesByTo
|
fileRoutesByTo: FileRoutesByTo
|
||||||
to: '/' | '/login' | '/settings' | '/api/wallpaper' | '/api/auth/$'
|
to:
|
||||||
|
| '/'
|
||||||
|
| '/login'
|
||||||
|
| '/settings'
|
||||||
|
| '/api/icon'
|
||||||
|
| '/api/wallpaper'
|
||||||
|
| '/api/auth/$'
|
||||||
id:
|
id:
|
||||||
'__root__' | '/' | '/login' | '/settings' | '/api/wallpaper' | '/api/auth/$'
|
| '__root__'
|
||||||
|
| '/'
|
||||||
|
| '/login'
|
||||||
|
| '/settings'
|
||||||
|
| '/api/icon'
|
||||||
|
| '/api/wallpaper'
|
||||||
|
| '/api/auth/$'
|
||||||
fileRoutesById: FileRoutesById
|
fileRoutesById: FileRoutesById
|
||||||
}
|
}
|
||||||
export interface RootRouteChildren {
|
export interface RootRouteChildren {
|
||||||
IndexRoute: typeof IndexRoute
|
IndexRoute: typeof IndexRoute
|
||||||
LoginRoute: typeof LoginRoute
|
LoginRoute: typeof LoginRoute
|
||||||
SettingsRoute: typeof SettingsRoute
|
SettingsRoute: typeof SettingsRoute
|
||||||
|
ApiIconRoute: typeof ApiIconRoute
|
||||||
ApiWallpaperRoute: typeof ApiWallpaperRoute
|
ApiWallpaperRoute: typeof ApiWallpaperRoute
|
||||||
ApiAuthSplatRoute: typeof ApiAuthSplatRoute
|
ApiAuthSplatRoute: typeof ApiAuthSplatRoute
|
||||||
}
|
}
|
||||||
@@ -103,6 +131,13 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof SettingsRouteImport
|
preLoaderRoute: typeof SettingsRouteImport
|
||||||
parentRoute: typeof rootRouteImport
|
parentRoute: typeof rootRouteImport
|
||||||
}
|
}
|
||||||
|
'/api/icon': {
|
||||||
|
id: '/api/icon'
|
||||||
|
path: '/api/icon'
|
||||||
|
fullPath: '/api/icon'
|
||||||
|
preLoaderRoute: typeof ApiIconRouteImport
|
||||||
|
parentRoute: typeof rootRouteImport
|
||||||
|
}
|
||||||
'/api/wallpaper': {
|
'/api/wallpaper': {
|
||||||
id: '/api/wallpaper'
|
id: '/api/wallpaper'
|
||||||
path: '/api/wallpaper'
|
path: '/api/wallpaper'
|
||||||
@@ -124,6 +159,7 @@ const rootRouteChildren: RootRouteChildren = {
|
|||||||
IndexRoute: IndexRoute,
|
IndexRoute: IndexRoute,
|
||||||
LoginRoute: LoginRoute,
|
LoginRoute: LoginRoute,
|
||||||
SettingsRoute: SettingsRoute,
|
SettingsRoute: SettingsRoute,
|
||||||
|
ApiIconRoute: ApiIconRoute,
|
||||||
ApiWallpaperRoute: ApiWallpaperRoute,
|
ApiWallpaperRoute: ApiWallpaperRoute,
|
||||||
ApiAuthSplatRoute: ApiAuthSplatRoute,
|
ApiAuthSplatRoute: ApiAuthSplatRoute,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import { createFileRoute } from "@tanstack/react-router"
|
||||||
|
import { and, eq, sql } from "drizzle-orm"
|
||||||
|
import { z } from "zod"
|
||||||
|
import { db } from "@/db"
|
||||||
|
import { icon, link } from "@/db/schema"
|
||||||
|
import { UPLOADED_ICON } from "@/lib/icons"
|
||||||
|
import { readImage, serveImage, userId } from "@/lib/upload"
|
||||||
|
|
||||||
|
const LIMITS = {
|
||||||
|
// SVG is safe here: serveImage sandboxes it
|
||||||
|
types: [
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/webp",
|
||||||
|
"image/avif",
|
||||||
|
"image/svg+xml",
|
||||||
|
],
|
||||||
|
formats: "PNG, JPEG, WebP, AVIF or SVG",
|
||||||
|
maxMb: 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Route = createFileRoute("/api/icon")({
|
||||||
|
server: {
|
||||||
|
handlers: {
|
||||||
|
GET: async ({ request }) => {
|
||||||
|
const user = await userId(request)
|
||||||
|
if (!user) return new Response("Unauthorized", { status: 401 })
|
||||||
|
const id = z
|
||||||
|
.uuid()
|
||||||
|
.safeParse(new URL(request.url).searchParams.get("id"))
|
||||||
|
if (!id.success) return new Response("Not found", { status: 404 })
|
||||||
|
return serveImage(
|
||||||
|
(
|
||||||
|
await db
|
||||||
|
.select()
|
||||||
|
.from(icon)
|
||||||
|
.where(and(eq(icon.id, id.data), eq(icon.userId, user)))
|
||||||
|
).at(0)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
POST: async ({ request }) => {
|
||||||
|
const image = await readImage(request, LIMITS)
|
||||||
|
if (image instanceof Response) return image
|
||||||
|
// Icons that no link uses any more go away with the next upload. An hour of
|
||||||
|
// grace, because a new icon has no link until its dialog is saved.
|
||||||
|
// shortcut: no limit on uploads per user, add one if strangers can sign up
|
||||||
|
await db.execute(sql`
|
||||||
|
delete from ${icon}
|
||||||
|
where ${icon.userId} = ${image.userId}
|
||||||
|
and ${icon.createdAt} < now() - interval '1 hour'
|
||||||
|
and not exists (
|
||||||
|
select 1 from ${link}
|
||||||
|
where ${link.icon} = ${UPLOADED_ICON} || ${icon.id}::text
|
||||||
|
)`)
|
||||||
|
const [row] = await db
|
||||||
|
.insert(icon)
|
||||||
|
.values(image)
|
||||||
|
.returning({ id: icon.id })
|
||||||
|
return Response.json({ icon: UPLOADED_ICON + row.id })
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
+43
-55
@@ -1,76 +1,64 @@
|
|||||||
import { createFileRoute } from "@tanstack/react-router"
|
import { createFileRoute } from "@tanstack/react-router"
|
||||||
import { eq } from "drizzle-orm"
|
import { and, eq } from "drizzle-orm"
|
||||||
|
import { z } from "zod"
|
||||||
import { db } from "@/db"
|
import { db } from "@/db"
|
||||||
import { settings, wallpaper } from "@/db/schema"
|
import { dashboard, wallpaper } from "@/db/schema"
|
||||||
import { auth } from "@/lib/auth"
|
import { readImage, serveImage, userId } from "@/lib/upload"
|
||||||
|
|
||||||
const MAX_BYTES = 10 * 1024 * 1024
|
const LIMITS = {
|
||||||
// no SVG: it can carry scripts
|
// no SVG: a wallpaper is a photo
|
||||||
const TYPES = ["image/jpeg", "image/png", "image/webp", "image/avif"]
|
types: ["image/jpeg", "image/png", "image/webp", "image/avif"],
|
||||||
|
formats: "JPEG, PNG, WebP or AVIF",
|
||||||
async function userId(request: Request) {
|
maxMb: 10,
|
||||||
const session = await auth.api.getSession({ headers: request.headers })
|
|
||||||
return session?.user.id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ?d=<dashboard id>: every dashboard has its own wallpaper. */
|
||||||
|
const dashboardOf = (request: Request) =>
|
||||||
|
z.uuid().safeParse(new URL(request.url).searchParams.get("d")).data
|
||||||
|
|
||||||
export const Route = createFileRoute("/api/wallpaper")({
|
export const Route = createFileRoute("/api/wallpaper")({
|
||||||
server: {
|
server: {
|
||||||
handlers: {
|
handlers: {
|
||||||
|
// the URL carries ?v=<upload time>, so it never changes
|
||||||
GET: async ({ request }) => {
|
GET: async ({ request }) => {
|
||||||
const id = await userId(request)
|
const id = await userId(request)
|
||||||
if (!id) return new Response("Unauthorized", { status: 401 })
|
if (!id) return new Response("Unauthorized", { status: 401 })
|
||||||
const row = (
|
const d = dashboardOf(request)
|
||||||
await db.select().from(wallpaper).where(eq(wallpaper.userId, id))
|
if (!d) return new Response("Not found", { status: 404 })
|
||||||
).at(0)
|
return serveImage(
|
||||||
if (!row) return new Response("Not found", { status: 404 })
|
(
|
||||||
return new Response(new Uint8Array(row.data), {
|
await db
|
||||||
headers: {
|
.select()
|
||||||
"Content-Type": row.mime,
|
.from(wallpaper)
|
||||||
"X-Content-Type-Options": "nosniff",
|
.where(
|
||||||
// the URL carries ?v=<upload time>, so it never changes
|
and(eq(wallpaper.dashboardId, d), eq(wallpaper.userId, id))
|
||||||
"Cache-Control": "private, max-age=31536000, immutable",
|
)
|
||||||
},
|
).at(0)
|
||||||
})
|
)
|
||||||
},
|
},
|
||||||
POST: async ({ request }) => {
|
POST: async ({ request }) => {
|
||||||
const id = await userId(request)
|
const image = await readImage(request, LIMITS)
|
||||||
if (!id) return new Response("Unauthorized", { status: 401 })
|
if (image instanceof Response) return image
|
||||||
const mime = request.headers.get("content-type") ?? ""
|
const d = dashboardOf(request)
|
||||||
if (!TYPES.includes(mime))
|
if (!d) return new Response("Not found", { status: 404 })
|
||||||
return new Response("Use a JPEG, PNG, WebP or AVIF image", {
|
const wallpaperUrl = `/api/wallpaper?d=${d}&v=${Date.now()}`
|
||||||
status: 415,
|
const saved = await db.transaction(async (tx) => {
|
||||||
})
|
const mine = await tx
|
||||||
// a chunked body has no declared size and could fill the memory
|
.update(dashboard)
|
||||||
const declared = Number(request.headers.get("content-length"))
|
.set({ wallpaperUrl })
|
||||||
if (
|
.where(and(eq(dashboard.id, d), eq(dashboard.userId, image.userId)))
|
||||||
!(declared > 0 && declared <= MAX_BYTES) ||
|
.returning({ id: dashboard.id })
|
||||||
request.headers.has("transfer-encoding")
|
if (!mine.length) return false
|
||||||
)
|
|
||||||
return new Response("Image is empty or larger than 10 MB", {
|
|
||||||
status: 413,
|
|
||||||
})
|
|
||||||
const data = new Uint8Array(await request.arrayBuffer())
|
|
||||||
if (!data.length || data.length > MAX_BYTES)
|
|
||||||
return new Response("Image is empty or larger than 10 MB", {
|
|
||||||
status: 413,
|
|
||||||
})
|
|
||||||
const wallpaperUrl = `/api/wallpaper?v=${Date.now()}`
|
|
||||||
await db.transaction(async (tx) => {
|
|
||||||
await tx
|
await tx
|
||||||
.insert(wallpaper)
|
.insert(wallpaper)
|
||||||
.values({ userId: id, mime, data })
|
.values({ ...image, dashboardId: d })
|
||||||
.onConflictDoUpdate({
|
.onConflictDoUpdate({
|
||||||
target: wallpaper.userId,
|
target: wallpaper.dashboardId,
|
||||||
set: { mime, data },
|
set: { mime: image.mime, data: image.data },
|
||||||
})
|
|
||||||
await tx
|
|
||||||
.insert(settings)
|
|
||||||
.values({ userId: id, wallpaperUrl })
|
|
||||||
.onConflictDoUpdate({
|
|
||||||
target: settings.userId,
|
|
||||||
set: { wallpaperUrl },
|
|
||||||
})
|
})
|
||||||
|
return true
|
||||||
})
|
})
|
||||||
|
if (!saved) return new Response("Not found", { status: 404 })
|
||||||
return Response.json({ wallpaperUrl })
|
return Response.json({ wallpaperUrl })
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
+126
-26
@@ -1,28 +1,40 @@
|
|||||||
import { useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import {
|
import {
|
||||||
Link,
|
Link,
|
||||||
createFileRoute,
|
createFileRoute,
|
||||||
redirect,
|
redirect,
|
||||||
useRouter,
|
useRouter,
|
||||||
} from "@tanstack/react-router"
|
} from "@tanstack/react-router"
|
||||||
import { LayoutGrid, LogOut, Pencil, Plus, Settings2 } from "lucide-react"
|
import {
|
||||||
|
LayoutDashboard,
|
||||||
|
LayoutGrid,
|
||||||
|
LogOut,
|
||||||
|
Pencil,
|
||||||
|
Plus,
|
||||||
|
Settings2,
|
||||||
|
} from "lucide-react"
|
||||||
import { CardDialog } from "@/components/card-dialog"
|
import { CardDialog } from "@/components/card-dialog"
|
||||||
import type { CardTarget } from "@/components/card-dialog"
|
import type { CardTarget } from "@/components/card-dialog"
|
||||||
import { CardGrid } from "@/components/card-grid"
|
import { CardGrid } from "@/components/card-grid"
|
||||||
import { Clock } from "@/components/clock"
|
import { Clock } from "@/components/clock"
|
||||||
import { LinkDialog } from "@/components/link-dialog"
|
import { LinkDialog } from "@/components/link-dialog"
|
||||||
import type { LinkTarget } from "@/components/link-dialog"
|
import type { LinkTarget } from "@/components/link-dialog"
|
||||||
|
import { StatusContext } from "@/components/link-tile"
|
||||||
import { Logo } from "@/components/logo"
|
import { Logo } from "@/components/logo"
|
||||||
import { SearchBar } from "@/components/search-bar"
|
import { SearchBar } from "@/components/search-bar"
|
||||||
import { Wallpaper } from "@/components/wallpaper"
|
import { Wallpaper } from "@/components/wallpaper"
|
||||||
import { authClient } from "@/lib/auth-client"
|
import { authClient } from "@/lib/auth-client"
|
||||||
import { getDashboard } from "@/lib/dashboard.functions"
|
import { getDashboard, getStatuses } from "@/lib/dashboard.functions"
|
||||||
import { Button } from "@/vendor/collabry/components/Button/Button"
|
import { Button } from "@/vendor/collabry/components/Button/Button"
|
||||||
import { cn } from "@/vendor/collabry/lib/cn"
|
import { cn } from "@/vendor/collabry/lib/cn"
|
||||||
|
|
||||||
export const Route = createFileRoute("/")({
|
export const Route = createFileRoute("/")({
|
||||||
loader: async () => {
|
// ?d=<dashboard id>. Without it the default dashboard opens.
|
||||||
const data = await getDashboard()
|
validateSearch: (search): { d?: string } =>
|
||||||
|
typeof search.d === "string" ? { d: search.d } : {},
|
||||||
|
loaderDeps: ({ search }) => search,
|
||||||
|
loader: async ({ deps }) => {
|
||||||
|
const data = await getDashboard({ data: { dashboardId: deps.d } })
|
||||||
if (!data) throw redirect({ to: "/login" })
|
if (!data) throw redirect({ to: "/login" })
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
@@ -33,47 +45,105 @@ export const Route = createFileRoute("/")({
|
|||||||
const onWallpaper =
|
const onWallpaper =
|
||||||
"rounded-full text-white/80 hover:bg-white/10 hover:text-white"
|
"rounded-full text-white/80 hover:bg-white/10 hover:text-white"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Which links answer, asked again every minute and when the tab is opened again.
|
||||||
|
* `links` is their ids: a new link is checked at once.
|
||||||
|
*/
|
||||||
|
function useStatuses(on: boolean, dashboardId: string, links: string) {
|
||||||
|
const [statuses, setStatuses] = useState<Record<string, boolean>>({})
|
||||||
|
useEffect(() => {
|
||||||
|
if (!on) return
|
||||||
|
let stale = false
|
||||||
|
const load = () => {
|
||||||
|
if (document.hidden) return
|
||||||
|
getStatuses({ data: { dashboardId } })
|
||||||
|
.then((found) => !stale && setStatuses(found))
|
||||||
|
.catch(() => {}) // the dots stay as they were
|
||||||
|
}
|
||||||
|
load()
|
||||||
|
const timer = setInterval(load, 60_000)
|
||||||
|
document.addEventListener("visibilitychange", load)
|
||||||
|
return () => {
|
||||||
|
stale = true
|
||||||
|
clearInterval(timer)
|
||||||
|
document.removeEventListener("visibilitychange", load)
|
||||||
|
}
|
||||||
|
}, [on, dashboardId, links])
|
||||||
|
return statuses
|
||||||
|
}
|
||||||
|
|
||||||
function Dashboard() {
|
function Dashboard() {
|
||||||
const data = Route.useLoaderData()
|
const data = Route.useLoaderData()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const statuses = useStatuses(
|
||||||
|
data.statusChecks,
|
||||||
|
data.dashboardId,
|
||||||
|
data.cards.flatMap((c) => c.links.map((l) => l.id)).join()
|
||||||
|
)
|
||||||
const [link, setLink] = useState<LinkTarget | null>(null)
|
const [link, setLink] = useState<LinkTarget | null>(null)
|
||||||
const [card, setCard] = useState<CardTarget | null>(null)
|
const [card, setCard] = useState<CardTarget | null>(null)
|
||||||
|
|
||||||
|
// settings open for this dashboard: its wallpaper, and back to it
|
||||||
|
const here = { d: data.dashboardId }
|
||||||
// the server makes sure there is always a card
|
// the server makes sure there is always a card
|
||||||
const addLink = () => setLink({ cardId: data.cards[0].id })
|
const addLink = () => setLink({ cardId: data.cards[0].id })
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative isolate text-white">
|
<div className="relative isolate text-white">
|
||||||
<Wallpaper src={data.wallpaperUrl} />
|
<Wallpaper src={data.wallpaperUrl} dim={data.wallpaperDim} />
|
||||||
|
|
||||||
<main className="flex min-h-svh flex-col items-center px-4">
|
<main className="flex min-h-svh flex-col items-center px-4">
|
||||||
<header className="flex h-28 w-full max-w-[1200px] items-center gap-4 px-2 sm:px-8">
|
<header className="flex h-20 w-full max-w-[1200px] items-center gap-4 px-2 sm:px-8">
|
||||||
<Logo className="size-6" />
|
<Logo className="size-6" />
|
||||||
<h1 className="m-0 text-md font-semibold">{data.title}</h1>
|
<h1 className="m-0 text-md font-semibold">{data.title}</h1>
|
||||||
<span className="hidden font-mono text-sm text-white/50 sm:inline">
|
{data.dashboards.length > 1 && (
|
||||||
|
<nav
|
||||||
|
aria-label="Dashboards"
|
||||||
|
className="flex min-w-0 gap-1 overflow-x-auto p-1"
|
||||||
|
>
|
||||||
|
{data.dashboards.map((d) => (
|
||||||
|
<Link
|
||||||
|
key={d.id}
|
||||||
|
to="/"
|
||||||
|
search={{ d: d.id }}
|
||||||
|
aria-current={d.id === data.dashboardId ? "page" : undefined}
|
||||||
|
className="rounded-full px-3 py-1 text-sm whitespace-nowrap text-white/60 outline-none hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-white/60 aria-[current=page]:bg-white/15 aria-[current=page]:text-white"
|
||||||
|
>
|
||||||
|
{d.name}
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</nav>
|
||||||
|
)}
|
||||||
|
{/* at the right, so it does not read as one more dashboard */}
|
||||||
|
<span className="ml-auto hidden font-mono text-sm text-white/50 sm:inline">
|
||||||
{data.user.name}
|
{data.user.name}
|
||||||
</span>
|
</span>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
iconOnly
|
iconOnly
|
||||||
aria-label="Add link"
|
aria-label="Add link"
|
||||||
className={cn(onWallpaper, "ml-auto")}
|
className={cn(onWallpaper, "ml-auto sm:ml-0")}
|
||||||
onClick={addLink}
|
onClick={addLink}
|
||||||
>
|
>
|
||||||
<Plus className="size-5" />
|
<Plus className="size-5" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button asChild variant="ghost" iconOnly className={onWallpaper}>
|
<Button asChild variant="ghost" iconOnly className={onWallpaper}>
|
||||||
<Link to="/settings" aria-label="Settings">
|
<Link to="/settings" search={here} aria-label="Settings">
|
||||||
<Settings2 className="size-5" />
|
<Settings2 className="size-5" />
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div className="mt-[11vh]">
|
{/* Spare height: one part above the clock, three parts below the cards.
|
||||||
<Clock />
|
A short window keeps only the minimum here, a tall one stays balanced. */}
|
||||||
</div>
|
<div className="min-h-8 flex-1" />
|
||||||
|
<Clock
|
||||||
|
font={data.clockFont}
|
||||||
|
look={data.clockStyle}
|
||||||
|
wallpaper={data.wallpaperUrl}
|
||||||
|
/>
|
||||||
|
|
||||||
<div className="mt-10 flex w-full justify-center sm:mt-14">
|
<div className="mt-8 flex w-full justify-center sm:mt-10">
|
||||||
<SearchBar
|
<SearchBar
|
||||||
links={data.cards.flatMap((c) => c.links)}
|
links={data.cards.flatMap((c) => c.links)}
|
||||||
engine={data.searchEngine}
|
engine={data.searchEngine}
|
||||||
@@ -89,10 +159,27 @@ function Dashboard() {
|
|||||||
icon: <LayoutGrid className="size-4" />,
|
icon: <LayoutGrid className="size-4" />,
|
||||||
run: () => setCard("new"),
|
run: () => setCard("new"),
|
||||||
},
|
},
|
||||||
|
...data.dashboards
|
||||||
|
.filter((d) => d.id !== data.dashboardId)
|
||||||
|
.map((d) => ({
|
||||||
|
label: `Switch to ${d.name}`,
|
||||||
|
icon: <LayoutDashboard className="size-4" />,
|
||||||
|
run: () => router.navigate({ to: "/", search: { d: d.id } }),
|
||||||
|
})),
|
||||||
|
{
|
||||||
|
label: "Add dashboard",
|
||||||
|
icon: <LayoutDashboard className="size-4" />,
|
||||||
|
run: () =>
|
||||||
|
router.navigate({
|
||||||
|
to: "/settings",
|
||||||
|
search: here,
|
||||||
|
hash: "dashboards",
|
||||||
|
}),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Settings",
|
label: "Settings",
|
||||||
icon: <Settings2 className="size-4" />,
|
icon: <Settings2 className="size-4" />,
|
||||||
run: () => router.navigate({ to: "/settings" }),
|
run: () => router.navigate({ to: "/settings", search: here }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Sign out",
|
label: "Sign out",
|
||||||
@@ -106,17 +193,20 @@ function Dashboard() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mt-[9vh] flex w-full flex-col items-center">
|
<div className="mt-[7vh] flex w-full flex-col items-center">
|
||||||
<CardGrid
|
<StatusContext value={statuses}>
|
||||||
cards={data.cards}
|
<CardGrid
|
||||||
onAddCard={() => setCard("new")}
|
cards={data.cards}
|
||||||
onAddLink={(c) => setLink({ cardId: c.id })}
|
onAddCard={() => setCard("new")}
|
||||||
onEditLink={setLink}
|
onAddLink={(c) => setLink({ cardId: c.id })}
|
||||||
onEditCard={setCard}
|
onEditLink={setLink}
|
||||||
/>
|
onEditCard={setCard}
|
||||||
|
/>
|
||||||
|
</StatusContext>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer className="mt-auto flex w-full items-center justify-end gap-3 pt-10 pb-5 text-sm text-white/60 sm:px-2">
|
<div className="flex-[3]" />
|
||||||
|
<footer className="flex w-full items-center justify-end gap-3 pt-10 pb-5 text-sm text-white/60 sm:px-2">
|
||||||
{!data.wallpaperUrl && (
|
{!data.wallpaperUrl && (
|
||||||
<span>
|
<span>
|
||||||
Photo by{" "}
|
Photo by{" "}
|
||||||
@@ -131,7 +221,12 @@ function Dashboard() {
|
|||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<Button asChild variant="ghost" iconOnly className={onWallpaper}>
|
<Button asChild variant="ghost" iconOnly className={onWallpaper}>
|
||||||
<Link to="/settings" hash="wallpaper" aria-label="Change wallpaper">
|
<Link
|
||||||
|
to="/settings"
|
||||||
|
search={here}
|
||||||
|
hash="wallpaper"
|
||||||
|
aria-label="Change wallpaper"
|
||||||
|
>
|
||||||
<Pencil className="size-4" />
|
<Pencil className="size-4" />
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
@@ -143,7 +238,12 @@ function Dashboard() {
|
|||||||
cards={data.cards}
|
cards={data.cards}
|
||||||
onClose={() => setLink(null)}
|
onClose={() => setLink(null)}
|
||||||
/>
|
/>
|
||||||
<CardDialog card={card} onClose={() => setCard(null)} />
|
<CardDialog
|
||||||
|
card={card}
|
||||||
|
dashboardId={data.dashboardId}
|
||||||
|
dashboards={data.dashboards}
|
||||||
|
onClose={() => setCard(null)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+520
-31
@@ -1,4 +1,5 @@
|
|||||||
import { useRef, useState } from "react"
|
import { useRef, useState } from "react"
|
||||||
|
import type { ComponentProps } from "react"
|
||||||
import {
|
import {
|
||||||
Link,
|
Link,
|
||||||
createFileRoute,
|
createFileRoute,
|
||||||
@@ -7,21 +8,47 @@ import {
|
|||||||
useRouter,
|
useRouter,
|
||||||
} from "@tanstack/react-router"
|
} from "@tanstack/react-router"
|
||||||
import {
|
import {
|
||||||
|
ArrowDown,
|
||||||
|
ArrowDownUp,
|
||||||
ArrowLeft,
|
ArrowLeft,
|
||||||
|
ArrowUp,
|
||||||
Check,
|
Check,
|
||||||
CircleUser,
|
CircleUser,
|
||||||
|
Clock,
|
||||||
|
Download,
|
||||||
Image,
|
Image,
|
||||||
|
LayoutDashboard,
|
||||||
LogOut,
|
LogOut,
|
||||||
|
Plus,
|
||||||
Search,
|
Search,
|
||||||
SlidersHorizontal,
|
SlidersHorizontal,
|
||||||
|
Trash2,
|
||||||
Upload,
|
Upload,
|
||||||
} from "lucide-react"
|
} from "lucide-react"
|
||||||
import { Logo } from "@/components/logo"
|
import { Logo } from "@/components/logo"
|
||||||
import { DEFAULT_WALLPAPER } from "@/components/wallpaper"
|
import { DEFAULT_WALLPAPER } from "@/components/wallpaper"
|
||||||
import { authClient } from "@/lib/auth-client"
|
import { authClient } from "@/lib/auth-client"
|
||||||
import { getDashboard, saveSettings } from "@/lib/dashboard.functions"
|
import {
|
||||||
|
CLOCK_FONTS,
|
||||||
|
CLOCK_FONT_NAMES,
|
||||||
|
CLOCK_STYLES,
|
||||||
|
CLOCK_STYLE_NAMES,
|
||||||
|
} from "@/lib/clock"
|
||||||
|
import type { ClockFont, ClockStyle } from "@/lib/clock"
|
||||||
|
import {
|
||||||
|
deleteDashboard,
|
||||||
|
exportData,
|
||||||
|
getDashboard,
|
||||||
|
importData,
|
||||||
|
orderDashboards,
|
||||||
|
saveDashboard,
|
||||||
|
saveSettings,
|
||||||
|
saveWallpaper,
|
||||||
|
} from "@/lib/dashboard.functions"
|
||||||
import { ENGINES, ENGINE_NAMES } from "@/lib/search"
|
import { ENGINES, ENGINE_NAMES } from "@/lib/search"
|
||||||
import type { Engine } from "@/lib/search"
|
import type { Engine } from "@/lib/search"
|
||||||
|
import { parseBookmarks } from "@/lib/transfer"
|
||||||
|
import type { Backup } from "@/lib/transfer"
|
||||||
import { Button } from "@/vendor/collabry/components/Button/Button"
|
import { Button } from "@/vendor/collabry/components/Button/Button"
|
||||||
import {
|
import {
|
||||||
Field,
|
Field,
|
||||||
@@ -57,32 +84,72 @@ import { Spinner } from "@/vendor/collabry/components/Spinner/Spinner"
|
|||||||
import { cn } from "@/vendor/collabry/lib/cn"
|
import { cn } from "@/vendor/collabry/lib/cn"
|
||||||
|
|
||||||
export const Route = createFileRoute("/settings")({
|
export const Route = createFileRoute("/settings")({
|
||||||
loader: async () => {
|
// ?d=<dashboard id>: the dashboard you came from, and whose wallpaper is shown
|
||||||
const data = await getDashboard()
|
validateSearch: (search): { d?: string } =>
|
||||||
|
typeof search.d === "string" ? { d: search.d } : {},
|
||||||
|
loaderDeps: ({ search }) => search,
|
||||||
|
loader: async ({ deps }) => {
|
||||||
|
const data = await getDashboard({ data: { dashboardId: deps.d } })
|
||||||
if (!data) throw redirect({ to: "/login" })
|
if (!data) throw redirect({ to: "/login" })
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
head: () => ({ meta: [{ title: "Settings" }] }),
|
head: () => ({ meta: [{ title: "Settings" }] }),
|
||||||
component: Settings,
|
// a new key per dashboard: the page starts again with that dashboard's wallpaper
|
||||||
|
component: () => <Settings key={Route.useLoaderData().dashboardId} />,
|
||||||
})
|
})
|
||||||
|
|
||||||
const SECTIONS = [
|
const SECTIONS = [
|
||||||
{ id: "general", label: "General", icon: SlidersHorizontal },
|
{ id: "general", label: "General", icon: SlidersHorizontal },
|
||||||
|
{ id: "dashboards", label: "Dashboards", icon: LayoutDashboard },
|
||||||
|
{ id: "clock", label: "Clock", icon: Clock },
|
||||||
{ id: "search", label: "Search", icon: Search },
|
{ id: "search", label: "Search", icon: Search },
|
||||||
{ id: "wallpaper", label: "Wallpaper", icon: Image },
|
{ id: "wallpaper", label: "Wallpaper", icon: Image },
|
||||||
|
{ id: "transfer", label: "Export and import", icon: ArrowDownUp },
|
||||||
{ id: "account", label: "Account", icon: CircleUser },
|
{ id: "account", label: "Account", icon: CircleUser },
|
||||||
]
|
]
|
||||||
|
|
||||||
// the nav links jump to a section; keep its title clear of the window edge
|
// the nav links jump to a section; keep its title clear of the window edge
|
||||||
const section = "[&>section]:scroll-mt-24"
|
const section = "[&>section]:scroll-mt-24"
|
||||||
|
|
||||||
|
/** A name that is saved when the field is left. An empty one goes back to what it was. */
|
||||||
|
function NameInput({
|
||||||
|
value,
|
||||||
|
onSave,
|
||||||
|
...props
|
||||||
|
}: { value: string; onSave: (name: string) => void } & ComponentProps<
|
||||||
|
typeof Input
|
||||||
|
>) {
|
||||||
|
return (
|
||||||
|
<Input
|
||||||
|
className="w-64"
|
||||||
|
defaultValue={value}
|
||||||
|
maxLength={40}
|
||||||
|
onKeyDown={(e) => e.key === "Enter" && e.currentTarget.blur()}
|
||||||
|
onBlur={(e) => {
|
||||||
|
const name = e.target.value.trim()
|
||||||
|
if (name && name !== value) onSave(name)
|
||||||
|
else e.target.value = value
|
||||||
|
}}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function Settings() {
|
function Settings() {
|
||||||
const data = Route.useLoaderData()
|
const data = Route.useLoaderData()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const hash = useLocation({ select: (l) => l.hash }) || SECTIONS[0].id
|
const hash = useLocation({ select: (l) => l.hash }) || SECTIONS[0].id
|
||||||
const file = useRef<HTMLInputElement>(null)
|
const file = useRef<HTMLInputElement>(null)
|
||||||
|
const importFile = useRef<HTMLInputElement>(null)
|
||||||
|
// what the last import added
|
||||||
|
const [imported, setImported] = useState("")
|
||||||
const [status, setStatus] = useState<"idle" | "saving" | "saved">("idle")
|
const [status, setStatus] = useState<"idle" | "saving" | "saved">("idle")
|
||||||
const [error, setError] = useState("")
|
const [error, setError] = useState("")
|
||||||
|
// follows the slider at once, the save comes a moment later
|
||||||
|
const [dim, setDim] = useState(data.wallpaperDim)
|
||||||
|
const dimSave = useRef<ReturnType<typeof setTimeout>>(undefined)
|
||||||
|
// deleting a dashboard deletes its cards and links, so it takes a second click
|
||||||
|
const [confirming, setConfirming] = useState<string | null>(null)
|
||||||
|
|
||||||
// Every control saves on its own. `action` returns a message when it failed.
|
// Every control saves on its own. `action` returns a message when it failed.
|
||||||
const run = async (action: () => Promise<string | void>) => {
|
const run = async (action: () => Promise<string | void>) => {
|
||||||
@@ -95,12 +162,22 @@ function Settings() {
|
|||||||
}
|
}
|
||||||
const save = (patch: {
|
const save = (patch: {
|
||||||
title?: string
|
title?: string
|
||||||
|
defaultDashboardId?: string
|
||||||
searchEngine?: Engine
|
searchEngine?: Engine
|
||||||
wallpaperUrl?: string | null
|
clockFont?: ClockFont
|
||||||
|
clockStyle?: ClockStyle
|
||||||
}) => run(() => saveSettings({ data: patch }))
|
}) => run(() => saveSettings({ data: patch }))
|
||||||
|
// the wallpaper belongs to the dashboard that is chosen in its section
|
||||||
|
const saveWall = (patch: {
|
||||||
|
wallpaperUrl?: string | null
|
||||||
|
wallpaperDim?: number
|
||||||
|
}) =>
|
||||||
|
run(() =>
|
||||||
|
saveWallpaper({ data: { dashboardId: data.dashboardId, ...patch } })
|
||||||
|
)
|
||||||
const upload = (image: File) =>
|
const upload = (image: File) =>
|
||||||
run(async () => {
|
run(async () => {
|
||||||
const res = await fetch("/api/wallpaper", {
|
const res = await fetch(`/api/wallpaper?d=${data.dashboardId}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": image.type },
|
headers: { "Content-Type": image.type },
|
||||||
body: image,
|
body: image,
|
||||||
@@ -110,6 +187,54 @@ function Settings() {
|
|||||||
|
|
||||||
const uploaded = !!data.wallpaperUrl?.startsWith("/")
|
const uploaded = !!data.wallpaperUrl?.startsWith("/")
|
||||||
|
|
||||||
|
/** Swaps a dashboard with the one before (-1) or after it (1). */
|
||||||
|
const moveDashboard = (index: number, by: -1 | 1) => {
|
||||||
|
const ids = data.dashboards.map((d) => d.id)
|
||||||
|
;[ids[index], ids[index + by]] = [ids[index + by], ids[index]]
|
||||||
|
return run(() => orderDashboards({ data: { ids } }))
|
||||||
|
}
|
||||||
|
|
||||||
|
const download = async () => {
|
||||||
|
const backup = await exportData()
|
||||||
|
const url = URL.createObjectURL(
|
||||||
|
new Blob([JSON.stringify(backup, null, 2)], { type: "application/json" })
|
||||||
|
)
|
||||||
|
const a = document.createElement("a")
|
||||||
|
a.href = url
|
||||||
|
a.download = `dahoam-${new Date().toISOString().slice(0, 10)}.json`
|
||||||
|
a.click()
|
||||||
|
URL.revokeObjectURL(url)
|
||||||
|
}
|
||||||
|
// an export of this app (JSON) or the bookmarks file of a browser (HTML)
|
||||||
|
const importFrom = (chosen: File) =>
|
||||||
|
run(async () => {
|
||||||
|
setImported("")
|
||||||
|
if (chosen.size > 5 * 1024 * 1024) return "The file is larger than 5 MB."
|
||||||
|
const content = await chosen.text()
|
||||||
|
let backup: unknown
|
||||||
|
let skipped = 0
|
||||||
|
try {
|
||||||
|
backup = JSON.parse(content)
|
||||||
|
} catch {
|
||||||
|
const bookmarks = parseBookmarks(content)
|
||||||
|
if (!bookmarks) return "This file has no dashboards or bookmarks in it."
|
||||||
|
;({ backup, skipped } = bookmarks)
|
||||||
|
}
|
||||||
|
// whether it really is one, the server checks
|
||||||
|
const added = await importData({ data: backup as Backup }).catch(
|
||||||
|
() => null
|
||||||
|
)
|
||||||
|
if (!added) return "This file is not an export of Dahoam."
|
||||||
|
const count = (n: number, thing: string) =>
|
||||||
|
`${n} ${thing}${n === 1 ? "" : "s"}`
|
||||||
|
setImported(
|
||||||
|
`Added ${count(added.dashboards, "dashboard")} with ${count(added.cards, "card")} and ${count(added.links, "link")}.` +
|
||||||
|
(skipped
|
||||||
|
? ` ${count(skipped, "bookmark")} left out: not a web address, or more than a card holds.`
|
||||||
|
: "")
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// A page of its own: solid Collabry surfaces, no wallpaper behind it
|
// A page of its own: solid Collabry surfaces, no wallpaper behind it
|
||||||
<div className="min-h-svh bg-app">
|
<div className="min-h-svh bg-app">
|
||||||
@@ -118,7 +243,7 @@ function Settings() {
|
|||||||
<Logo className="size-5 text-fg" />
|
<Logo className="size-5 text-fg" />
|
||||||
<span className="min-w-0 truncate font-bold">{data.title}</span>
|
<span className="min-w-0 truncate font-bold">{data.title}</span>
|
||||||
<Button asChild size="sm" className="ml-auto">
|
<Button asChild size="sm" className="ml-auto">
|
||||||
<Link to="/">
|
<Link to="/" search={{ d: data.dashboardId }}>
|
||||||
<ArrowLeft size={14} aria-hidden /> Back to dashboard
|
<ArrowLeft size={14} aria-hidden /> Back to dashboard
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
@@ -169,6 +294,7 @@ function Settings() {
|
|||||||
<Link
|
<Link
|
||||||
to="/settings"
|
to="/settings"
|
||||||
hash={id}
|
hash={id}
|
||||||
|
search
|
||||||
// without this every link counts as the current page
|
// without this every link counts as the current page
|
||||||
activeOptions={{ includeHash: true }}
|
activeOptions={{ includeHash: true }}
|
||||||
>
|
>
|
||||||
@@ -184,37 +310,192 @@ function Settings() {
|
|||||||
<SettingsSectionHeader>
|
<SettingsSectionHeader>
|
||||||
<SettingsSectionTitle>General</SettingsSectionTitle>
|
<SettingsSectionTitle>General</SettingsSectionTitle>
|
||||||
<SettingsSectionDescription>
|
<SettingsSectionDescription>
|
||||||
How this dashboard is called.
|
How this start page is called.
|
||||||
</SettingsSectionDescription>
|
</SettingsSectionDescription>
|
||||||
</SettingsSectionHeader>
|
</SettingsSectionHeader>
|
||||||
<SettingsRow>
|
<SettingsRow>
|
||||||
<SettingsRowText>
|
<SettingsRowText>
|
||||||
<SettingsRowLabel htmlFor="settings-title">
|
<SettingsRowLabel htmlFor="settings-title">
|
||||||
Dashboard name
|
Title
|
||||||
</SettingsRowLabel>
|
</SettingsRowLabel>
|
||||||
<SettingsRowDescription>
|
<SettingsRowDescription>
|
||||||
Shown at the top left of the dashboard.
|
Shown at the top left of every dashboard.
|
||||||
</SettingsRowDescription>
|
</SettingsRowDescription>
|
||||||
</SettingsRowText>
|
</SettingsRowText>
|
||||||
<SettingsRowControl>
|
<SettingsRowControl>
|
||||||
<Input
|
<NameInput
|
||||||
id="settings-title"
|
id="settings-title"
|
||||||
className="w-64"
|
value={data.title}
|
||||||
defaultValue={data.title}
|
onSave={(title) => save({ title })}
|
||||||
maxLength={40}
|
|
||||||
onKeyDown={(e) =>
|
|
||||||
e.key === "Enter" && e.currentTarget.blur()
|
|
||||||
}
|
|
||||||
onBlur={(e) => {
|
|
||||||
const title = e.target.value.trim()
|
|
||||||
if (title && title !== data.title) void save({ title })
|
|
||||||
else e.target.value = data.title
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</SettingsRowControl>
|
</SettingsRowControl>
|
||||||
</SettingsRow>
|
</SettingsRow>
|
||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
|
|
||||||
|
<SettingsSection id="dashboards" className={section}>
|
||||||
|
<SettingsSectionHeader>
|
||||||
|
<SettingsSectionTitle>Dashboards</SettingsSectionTitle>
|
||||||
|
<SettingsSectionDescription>
|
||||||
|
Each dashboard has its own cards, for example Home and Work.
|
||||||
|
With more than one, you switch between them at the top of
|
||||||
|
the dashboard, in the order that the arrows here set. The
|
||||||
|
default one opens when you sign in.
|
||||||
|
</SettingsSectionDescription>
|
||||||
|
</SettingsSectionHeader>
|
||||||
|
{data.dashboards.map((d, i) => {
|
||||||
|
const isDefault = d.id === data.defaultDashboardId
|
||||||
|
return (
|
||||||
|
<SettingsRow key={d.id}>
|
||||||
|
<SettingsRowText>
|
||||||
|
<NameInput
|
||||||
|
aria-label="Dashboard name"
|
||||||
|
value={d.name}
|
||||||
|
onSave={(name) =>
|
||||||
|
run(() =>
|
||||||
|
saveDashboard({ data: { id: d.id, name } })
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</SettingsRowText>
|
||||||
|
<SettingsRowControl className="flex flex-wrap gap-2">
|
||||||
|
{data.dashboards.length > 1 && (
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
iconOnly
|
||||||
|
aria-label={`Move ${d.name} up`}
|
||||||
|
disabled={i === 0}
|
||||||
|
onClick={() => moveDashboard(i, -1)}
|
||||||
|
>
|
||||||
|
<ArrowUp size={15} />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
iconOnly
|
||||||
|
aria-label={`Move ${d.name} down`}
|
||||||
|
disabled={i === data.dashboards.length - 1}
|
||||||
|
onClick={() => moveDashboard(i, 1)}
|
||||||
|
>
|
||||||
|
<ArrowDown size={15} />
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
<Button
|
||||||
|
disabled={isDefault}
|
||||||
|
onClick={() => save({ defaultDashboardId: d.id })}
|
||||||
|
>
|
||||||
|
{isDefault && <Check size={15} />}
|
||||||
|
{isDefault ? "Default" : "Make default"}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant={
|
||||||
|
confirming === d.id ? "danger" : "danger-outline"
|
||||||
|
}
|
||||||
|
disabled={data.dashboards.length < 2}
|
||||||
|
onClick={() =>
|
||||||
|
confirming === d.id
|
||||||
|
? run(() =>
|
||||||
|
deleteDashboard({ data: { id: d.id } })
|
||||||
|
)
|
||||||
|
: setConfirming(d.id)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Trash2 size={15} />
|
||||||
|
{confirming === d.id
|
||||||
|
? "Yes, delete it with its cards and links"
|
||||||
|
: "Delete"}
|
||||||
|
</Button>
|
||||||
|
</SettingsRowControl>
|
||||||
|
</SettingsRow>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
<SettingsRow>
|
||||||
|
<form
|
||||||
|
className="flex flex-wrap gap-2"
|
||||||
|
onSubmit={(e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
const form = e.currentTarget
|
||||||
|
const name = String(new FormData(form).get("name"))
|
||||||
|
void run(() => saveDashboard({ data: { name } })).then(
|
||||||
|
() => form.reset()
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
name="name"
|
||||||
|
aria-label="Name of the new dashboard"
|
||||||
|
className="w-64"
|
||||||
|
placeholder="New dashboard"
|
||||||
|
maxLength={40}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<Button type="submit">
|
||||||
|
<Plus size={15} /> Add dashboard
|
||||||
|
</Button>
|
||||||
|
</form>
|
||||||
|
</SettingsRow>
|
||||||
|
</SettingsSection>
|
||||||
|
|
||||||
|
<SettingsSection id="clock" className={section}>
|
||||||
|
<SettingsSectionHeader>
|
||||||
|
<SettingsSectionTitle>Clock</SettingsSectionTitle>
|
||||||
|
<SettingsSectionDescription>
|
||||||
|
How the time on the dashboard looks.
|
||||||
|
</SettingsSectionDescription>
|
||||||
|
</SettingsSectionHeader>
|
||||||
|
<SettingsRow>
|
||||||
|
<SettingsRowText>
|
||||||
|
<div id="settings-font" className="leading-tight font-bold">
|
||||||
|
Font
|
||||||
|
</div>
|
||||||
|
</SettingsRowText>
|
||||||
|
<SettingsRowControl>
|
||||||
|
<SegmentedControl
|
||||||
|
aria-labelledby="settings-font"
|
||||||
|
size="md"
|
||||||
|
value={data.clockFont}
|
||||||
|
onValueChange={(v) => save({ clockFont: v as ClockFont })}
|
||||||
|
>
|
||||||
|
{CLOCK_FONTS.map((f) => (
|
||||||
|
<SegmentedControlItem key={f} value={f}>
|
||||||
|
{CLOCK_FONT_NAMES[f]}
|
||||||
|
</SegmentedControlItem>
|
||||||
|
))}
|
||||||
|
</SegmentedControl>
|
||||||
|
</SettingsRowControl>
|
||||||
|
</SettingsRow>
|
||||||
|
<SettingsRow>
|
||||||
|
<SettingsRowText>
|
||||||
|
<div
|
||||||
|
id="settings-style"
|
||||||
|
className="leading-tight font-bold"
|
||||||
|
>
|
||||||
|
Style
|
||||||
|
</div>
|
||||||
|
<SettingsRowDescription>
|
||||||
|
Glass shows the wallpaper blurred through the digits.
|
||||||
|
Tinted takes its color from the wallpaper.
|
||||||
|
</SettingsRowDescription>
|
||||||
|
</SettingsRowText>
|
||||||
|
<SettingsRowControl>
|
||||||
|
<SegmentedControl
|
||||||
|
aria-labelledby="settings-style"
|
||||||
|
size="md"
|
||||||
|
value={data.clockStyle}
|
||||||
|
onValueChange={(v) =>
|
||||||
|
save({ clockStyle: v as ClockStyle })
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{CLOCK_STYLES.map((s) => (
|
||||||
|
<SegmentedControlItem key={s} value={s}>
|
||||||
|
{CLOCK_STYLE_NAMES[s]}
|
||||||
|
</SegmentedControlItem>
|
||||||
|
))}
|
||||||
|
</SegmentedControl>
|
||||||
|
</SettingsRowControl>
|
||||||
|
</SettingsRow>
|
||||||
|
</SettingsSection>
|
||||||
|
|
||||||
<SettingsSection id="search" className={section}>
|
<SettingsSection id="search" className={section}>
|
||||||
<SettingsSectionHeader>
|
<SettingsSectionHeader>
|
||||||
<SettingsSectionTitle>Search</SettingsSectionTitle>
|
<SettingsSectionTitle>Search</SettingsSectionTitle>
|
||||||
@@ -262,17 +543,62 @@ function Settings() {
|
|||||||
<SettingsSectionHeader>
|
<SettingsSectionHeader>
|
||||||
<SettingsSectionTitle>Wallpaper</SettingsSectionTitle>
|
<SettingsSectionTitle>Wallpaper</SettingsSectionTitle>
|
||||||
<SettingsSectionDescription>
|
<SettingsSectionDescription>
|
||||||
The picture behind your dashboard. Upload one (JPEG, PNG,
|
The picture behind a dashboard, every dashboard has its own.
|
||||||
WebP or AVIF, up to 10 MB) or use any image on the web.
|
Upload one (JPEG, PNG, WebP or AVIF, up to 10 MB) or use any
|
||||||
|
image on the web.
|
||||||
</SettingsSectionDescription>
|
</SettingsSectionDescription>
|
||||||
</SettingsSectionHeader>
|
</SettingsSectionHeader>
|
||||||
|
{data.dashboards.length > 1 && (
|
||||||
|
<SettingsRow>
|
||||||
|
<SettingsRowText>
|
||||||
|
<div
|
||||||
|
id="settings-wallpaper-of"
|
||||||
|
className="leading-tight font-bold"
|
||||||
|
>
|
||||||
|
Dashboard
|
||||||
|
</div>
|
||||||
|
<SettingsRowDescription>
|
||||||
|
Whose wallpaper you change here.
|
||||||
|
</SettingsRowDescription>
|
||||||
|
</SettingsRowText>
|
||||||
|
<SettingsRowControl>
|
||||||
|
<SegmentedControl
|
||||||
|
aria-labelledby="settings-wallpaper-of"
|
||||||
|
size="md"
|
||||||
|
// many dashboards on a narrow screen: scroll, not overflow
|
||||||
|
className="max-w-full overflow-x-auto"
|
||||||
|
value={data.dashboardId}
|
||||||
|
onValueChange={(d) =>
|
||||||
|
router.navigate({
|
||||||
|
to: "/settings",
|
||||||
|
search: { d },
|
||||||
|
hash: "wallpaper",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{data.dashboards.map((d) => (
|
||||||
|
<SegmentedControlItem key={d.id} value={d.id}>
|
||||||
|
{d.name}
|
||||||
|
</SegmentedControlItem>
|
||||||
|
))}
|
||||||
|
</SegmentedControl>
|
||||||
|
</SettingsRowControl>
|
||||||
|
</SettingsRow>
|
||||||
|
)}
|
||||||
<SettingsRow stacked>
|
<SettingsRow stacked>
|
||||||
<div className="flex flex-wrap items-start gap-x-6 gap-y-4">
|
<div className="flex flex-wrap items-start gap-x-6 gap-y-4">
|
||||||
<img
|
<div className="relative w-60 flex-none overflow-hidden rounded-xl border border-line">
|
||||||
src={data.wallpaperUrl ?? DEFAULT_WALLPAPER}
|
<img
|
||||||
alt="Current wallpaper"
|
src={data.wallpaperUrl ?? DEFAULT_WALLPAPER}
|
||||||
className="aspect-video w-60 flex-none rounded-xl border border-line object-cover"
|
alt="Current wallpaper"
|
||||||
/>
|
className="aspect-video w-full object-cover"
|
||||||
|
/>
|
||||||
|
{/* as dark as on the dashboard */}
|
||||||
|
<div
|
||||||
|
className="absolute inset-0 bg-black"
|
||||||
|
style={{ opacity: dim / 100 }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div className="flex min-w-0 flex-[1_1_260px] flex-col gap-3.5">
|
<div className="flex min-w-0 flex-[1_1_260px] flex-col gap-3.5">
|
||||||
<Field>
|
<Field>
|
||||||
<FieldLabel>Image address</FieldLabel>
|
<FieldLabel>Image address</FieldLabel>
|
||||||
@@ -292,7 +618,7 @@ function Settings() {
|
|||||||
const url = e.target.value.trim()
|
const url = e.target.value.trim()
|
||||||
if (!url || url === data.wallpaperUrl) return
|
if (!url || url === data.wallpaperUrl) return
|
||||||
if (e.target.checkValidity())
|
if (e.target.checkValidity())
|
||||||
void save({ wallpaperUrl: url })
|
void saveWall({ wallpaperUrl: url })
|
||||||
else
|
else
|
||||||
setError(
|
setError(
|
||||||
"The image address must start with http:// or https://"
|
"The image address must start with http:// or https://"
|
||||||
@@ -328,7 +654,7 @@ function Settings() {
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
disabled={status === "saving" || !data.wallpaperUrl}
|
disabled={status === "saving" || !data.wallpaperUrl}
|
||||||
onClick={() => save({ wallpaperUrl: null })}
|
onClick={() => saveWall({ wallpaperUrl: null })}
|
||||||
>
|
>
|
||||||
Use default
|
Use default
|
||||||
</Button>
|
</Button>
|
||||||
@@ -336,6 +662,110 @@ function Settings() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</SettingsRow>
|
</SettingsRow>
|
||||||
|
<SettingsRow>
|
||||||
|
<SettingsRowText>
|
||||||
|
<SettingsRowLabel htmlFor="settings-dim">
|
||||||
|
Darken
|
||||||
|
</SettingsRowLabel>
|
||||||
|
<SettingsRowDescription>
|
||||||
|
How much the wallpaper is darkened, so that the text on it
|
||||||
|
stays readable.
|
||||||
|
</SettingsRowDescription>
|
||||||
|
</SettingsRowText>
|
||||||
|
<SettingsRowControl className="flex items-center gap-3">
|
||||||
|
<input
|
||||||
|
id="settings-dim"
|
||||||
|
type="range"
|
||||||
|
min={0}
|
||||||
|
max={100}
|
||||||
|
step={5}
|
||||||
|
value={dim}
|
||||||
|
onChange={(e) => {
|
||||||
|
const wallpaperDim = Number(e.target.value)
|
||||||
|
setDim(wallpaperDim)
|
||||||
|
// one save when the slider rests, not one per step
|
||||||
|
clearTimeout(dimSave.current)
|
||||||
|
dimSave.current = setTimeout(
|
||||||
|
() => saveWall({ wallpaperDim }),
|
||||||
|
400
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
className="w-48 accent-accent scheme-dark"
|
||||||
|
/>
|
||||||
|
<output
|
||||||
|
htmlFor="settings-dim"
|
||||||
|
className="w-10 text-right text-sm text-fg-subtle tabular-nums"
|
||||||
|
>
|
||||||
|
{dim}%
|
||||||
|
</output>
|
||||||
|
</SettingsRowControl>
|
||||||
|
</SettingsRow>
|
||||||
|
</SettingsSection>
|
||||||
|
|
||||||
|
<SettingsSection id="transfer" className={section}>
|
||||||
|
<SettingsSectionHeader>
|
||||||
|
<SettingsSectionTitle>Export and import</SettingsSectionTitle>
|
||||||
|
<SettingsSectionDescription>
|
||||||
|
Keep a copy of your dashboards, move them to another
|
||||||
|
account, or start from the bookmarks of your browser.
|
||||||
|
</SettingsSectionDescription>
|
||||||
|
</SettingsSectionHeader>
|
||||||
|
<SettingsRow>
|
||||||
|
<SettingsRowText>
|
||||||
|
<div className="leading-tight font-bold">Export</div>
|
||||||
|
<SettingsRowDescription>
|
||||||
|
One file with all dashboards, their cards and links.
|
||||||
|
Images that you uploaded are not in it.
|
||||||
|
</SettingsRowDescription>
|
||||||
|
</SettingsRowText>
|
||||||
|
<SettingsRowControl>
|
||||||
|
<Button
|
||||||
|
onClick={() =>
|
||||||
|
download().catch(() => setError("Could not export."))
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Download size={15} /> Export
|
||||||
|
</Button>
|
||||||
|
</SettingsRowControl>
|
||||||
|
</SettingsRow>
|
||||||
|
<SettingsRow>
|
||||||
|
<SettingsRowText>
|
||||||
|
<div className="leading-tight font-bold">Import</div>
|
||||||
|
<SettingsRowDescription>
|
||||||
|
An export of Dahoam, or the bookmarks file that your
|
||||||
|
browser exports (HTML): a dashboard "Bookmarks" with a
|
||||||
|
card per folder. An import adds dashboards, it replaces
|
||||||
|
nothing.
|
||||||
|
</SettingsRowDescription>
|
||||||
|
{imported && (
|
||||||
|
<SettingsRowDescription
|
||||||
|
role="status"
|
||||||
|
className="text-success-fg"
|
||||||
|
>
|
||||||
|
{imported}
|
||||||
|
</SettingsRowDescription>
|
||||||
|
)}
|
||||||
|
</SettingsRowText>
|
||||||
|
<SettingsRowControl>
|
||||||
|
<input
|
||||||
|
ref={importFile}
|
||||||
|
type="file"
|
||||||
|
accept=".json,.html,.htm,application/json,text/html"
|
||||||
|
className="hidden"
|
||||||
|
onChange={(e) => {
|
||||||
|
const chosen = e.target.files?.[0]
|
||||||
|
if (chosen) void importFrom(chosen)
|
||||||
|
e.target.value = ""
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
disabled={status === "saving"}
|
||||||
|
onClick={() => importFile.current?.click()}
|
||||||
|
>
|
||||||
|
<Upload size={15} /> Choose a file
|
||||||
|
</Button>
|
||||||
|
</SettingsRowControl>
|
||||||
|
</SettingsRow>
|
||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
|
|
||||||
<SettingsSection id="account" className={section}>
|
<SettingsSection id="account" className={section}>
|
||||||
@@ -362,6 +792,65 @@ function Settings() {
|
|||||||
</Button>
|
</Button>
|
||||||
</SettingsRowControl>
|
</SettingsRowControl>
|
||||||
</SettingsRow>
|
</SettingsRow>
|
||||||
|
{data.user.hasPassword && (
|
||||||
|
<SettingsRow stacked>
|
||||||
|
<SettingsRowText>
|
||||||
|
<div className="leading-tight font-bold">Password</div>
|
||||||
|
<SettingsRowDescription>
|
||||||
|
A new password signs you out on your other devices.
|
||||||
|
</SettingsRowDescription>
|
||||||
|
</SettingsRowText>
|
||||||
|
<SettingsRowControl>
|
||||||
|
<form
|
||||||
|
className="flex flex-wrap items-end gap-3"
|
||||||
|
onSubmit={(e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
const form = e.currentTarget
|
||||||
|
const fields = new FormData(form)
|
||||||
|
void run(async () => {
|
||||||
|
// Better Auth returns { error } instead of throwing
|
||||||
|
const { error: failure } =
|
||||||
|
await authClient.changePassword({
|
||||||
|
currentPassword: String(fields.get("current")),
|
||||||
|
newPassword: String(fields.get("new")),
|
||||||
|
revokeOtherSessions: true,
|
||||||
|
})
|
||||||
|
if (failure)
|
||||||
|
return (
|
||||||
|
failure.message ||
|
||||||
|
"Could not change the password."
|
||||||
|
)
|
||||||
|
form.reset()
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Field className="w-56">
|
||||||
|
<FieldLabel>Current password</FieldLabel>
|
||||||
|
<Input
|
||||||
|
name="current"
|
||||||
|
type="password"
|
||||||
|
autoComplete="current-password"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
<Field className="w-56">
|
||||||
|
<FieldLabel>New password</FieldLabel>
|
||||||
|
<Input
|
||||||
|
name="new"
|
||||||
|
type="password"
|
||||||
|
autoComplete="new-password"
|
||||||
|
minLength={8}
|
||||||
|
maxLength={128}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
<Button type="submit" disabled={status === "saving"}>
|
||||||
|
Change password
|
||||||
|
</Button>
|
||||||
|
</form>
|
||||||
|
</SettingsRowControl>
|
||||||
|
</SettingsRow>
|
||||||
|
)}
|
||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+5
-16
@@ -2,10 +2,15 @@
|
|||||||
@import "./vendor/collabry/styles/index.css";
|
@import "./vendor/collabry/styles/index.css";
|
||||||
@import "@fontsource-variable/inter";
|
@import "@fontsource-variable/inter";
|
||||||
@import "@fontsource/dm-serif-display";
|
@import "@fontsource/dm-serif-display";
|
||||||
|
/* only for the clock, and only downloaded when chosen in the settings */
|
||||||
|
@import "@fontsource-variable/nunito";
|
||||||
|
@import "@fontsource-variable/roboto-slab";
|
||||||
|
|
||||||
@theme inline {
|
@theme inline {
|
||||||
--font-sans: "Inter Variable", system-ui, sans-serif;
|
--font-sans: "Inter Variable", system-ui, sans-serif;
|
||||||
--font-serif: "DM Serif Display", ui-serif, Georgia, serif;
|
--font-serif: "DM Serif Display", ui-serif, Georgia, serif;
|
||||||
|
--font-rounded: "Nunito Variable", ui-rounded, system-ui, sans-serif;
|
||||||
|
--font-slab: "Roboto Slab Variable", ui-serif, Georgia, serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The accent is near white here (set on ThemeProvider), so text on it is dark */
|
/* The accent is near white here (set on ThemeProvider), so text on it is dark */
|
||||||
@@ -20,19 +25,3 @@
|
|||||||
background: black;
|
background: black;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Halftone dots plus a fade to black, as on the reference start page */
|
|
||||||
@utility wallpaper-dither {
|
|
||||||
background-image:
|
|
||||||
linear-gradient(
|
|
||||||
to bottom,
|
|
||||||
rgb(0 0 0 / 0.45),
|
|
||||||
rgb(0 0 0 / 0.25) 30%,
|
|
||||||
rgb(0 0 0 / 0.4) 65%,
|
|
||||||
rgb(0 0 0 / 0.95) 100%
|
|
||||||
),
|
|
||||||
radial-gradient(rgb(0 0 0 / 0.45) 1px, transparent 1.5px);
|
|
||||||
background-size:
|
|
||||||
auto,
|
|
||||||
4px 4px;
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user