fix: windows dev

This commit is contained in:
purp1e
2024-09-20 12:47:00 +08:00
parent b12c6279d5
commit d092be3370
8 changed files with 5558 additions and 4128 deletions

View File

@@ -1,4 +0,0 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm exec lint-staged

1
src-tauri/Cargo.lock generated
View File

@@ -86,6 +86,7 @@ dependencies = [
"tauri-plugin-process",
"tauri-plugin-shell",
"window-vibrancy",
"winreg",
]
[[package]]

View File

@@ -29,6 +29,8 @@ tauri-plugin-clipboard-manager = "2.0.0-alpha.2"
tauri-plugin-shell = "2.0.0-rc"
tauri-plugin-http = "2.0.0-rc"
tauri-plugin-notification = "2.0.0-rc"
[target.'cfg(windows)'.dependencies] # Windows Only
winreg = "0.52.0"
[features]
# by default Tauri runs in production mode

File diff suppressed because one or more lines are too long

View File

@@ -1,93 +1 @@
{
"desktop-capability": {
"identifier": "desktop-capability",
"description": "",
"local": true,
"permissions": ["global-shortcut:default"],
"platforms": ["macOS", "windows", "linux"]
},
"migrated": {
"identifier": "migrated",
"description": "permissions that were migrated from v1",
"local": true,
"windows": ["main"],
"permissions": [
"core:default",
"fs:allow-read-file",
"fs:allow-write-file",
"fs:allow-read-dir",
"fs:allow-copy-file",
"fs:allow-mkdir",
"fs:allow-remove",
"fs:allow-remove",
"fs:allow-rename",
"fs:allow-exists",
"core:window:allow-create",
"core:window:allow-center",
"core:window:allow-request-user-attention",
"core:window:allow-set-resizable",
"core:window:allow-set-maximizable",
"core:window:allow-set-minimizable",
"core:window:allow-set-closable",
"core:window:allow-set-title",
"core:window:allow-maximize",
"core:window:allow-unmaximize",
"core:window:allow-minimize",
"core:window:allow-unminimize",
"core:window:allow-show",
"core:window:allow-hide",
"core:window:allow-close",
"core:window:allow-set-decorations",
"core:window:allow-set-always-on-top",
"core:window:allow-set-content-protected",
"core:window:allow-set-size",
"core:window:allow-set-min-size",
"core:window:allow-set-max-size",
"core:window:allow-set-position",
"core:window:allow-set-fullscreen",
"core:window:allow-set-focus",
"core:window:allow-set-icon",
"core:window:allow-set-skip-taskbar",
"core:window:allow-set-cursor-grab",
"core:window:allow-set-cursor-visible",
"core:window:allow-set-cursor-icon",
"core:window:allow-set-cursor-position",
"core:window:allow-set-ignore-cursor-events",
"core:window:allow-start-dragging",
"core:webview:allow-print",
"shell:allow-execute",
"shell:allow-open",
"dialog:allow-open",
"dialog:allow-save",
"dialog:allow-message",
"dialog:allow-ask",
"dialog:allow-confirm",
"http:default",
"notification:default",
"global-shortcut:allow-is-registered",
"global-shortcut:allow-register",
"global-shortcut:allow-register-all",
"global-shortcut:allow-unregister",
"global-shortcut:allow-unregister-all",
"os:allow-platform",
"os:allow-version",
"os:allow-os-type",
"os:allow-family",
"os:allow-arch",
"os:allow-exe-extension",
"os:allow-locale",
"os:allow-hostname",
"process:allow-restart",
"process:allow-exit",
"clipboard-manager:allow-read-text",
"clipboard-manager:allow-write-text",
"core:app:allow-app-show",
"core:app:allow-app-hide",
"process:default",
"fs:default",
"dialog:default",
"os:default",
"clipboard-manager:default"
]
}
}
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"permissions":["global-shortcut:default"],"platforms":["macOS","windows","linux"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","fs:allow-read-file","fs:allow-write-file","fs:allow-read-dir","fs:allow-copy-file","fs:allow-mkdir","fs:allow-remove","fs:allow-remove","fs:allow-rename","fs:allow-exists","core:window:allow-create","core:window:allow-center","core:window:allow-request-user-attention","core:window:allow-set-resizable","core:window:allow-set-maximizable","core:window:allow-set-minimizable","core:window:allow-set-closable","core:window:allow-set-title","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-set-decorations","core:window:allow-set-always-on-top","core:window:allow-set-content-protected","core:window:allow-set-size","core:window:allow-set-min-size","core:window:allow-set-max-size","core:window:allow-set-position","core:window:allow-set-fullscreen","core:window:allow-set-focus","core:window:allow-set-icon","core:window:allow-set-skip-taskbar","core:window:allow-set-cursor-grab","core:window:allow-set-cursor-visible","core:window:allow-set-cursor-icon","core:window:allow-set-cursor-position","core:window:allow-set-ignore-cursor-events","core:window:allow-start-dragging","core:webview:allow-print","shell:allow-execute","shell:allow-open","dialog:allow-open","dialog:allow-save","dialog:allow-message","dialog:allow-ask","dialog:allow-confirm","http:default","notification:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-register-all","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","os:allow-platform","os:allow-version","os:allow-os-type","os:allow-family","os:allow-arch","os:allow-exe-extension","os:allow-locale","os:allow-hostname","process:allow-restart","process:allow-exit","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text","core:app:allow-app-show","core:app:allow-app-hide","process:default","fs:default","dialog:default","os:default","clipboard-manager:default"]}}

View File

@@ -21,7 +21,9 @@
{
"description": "A list of capabilities.",
"type": "object",
"required": ["capabilities"],
"required": [
"capabilities"
],
"properties": {
"capabilities": {
"description": "The list of capabilities.",
@@ -37,7 +39,10 @@
"Capability": {
"description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows fine grained access to the Tauri core, application, or plugin commands. If a window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, \"platforms\": [\"macOS\",\"windows\"] } ```",
"type": "object",
"required": ["identifier", "permissions"],
"required": [
"identifier",
"permissions"
],
"properties": {
"identifier": {
"description": "Identifier of the capability.\n\n## Example\n\n`main-user-files-write`",
@@ -88,7 +93,10 @@
},
"platforms": {
"description": "Limit which target platforms this capability applies to.\n\nBy default all platforms are targeted.\n\n## Example\n\n`[\"macOS\",\"windows\"]`",
"type": ["array", "null"],
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Target"
}
@@ -98,7 +106,9 @@
"CapabilityRemote": {
"description": "Configuration for remote URLs that are associated with the capability.",
"type": "object",
"required": ["urls"],
"required": [
"urls"
],
"properties": {
"urls": {
"description": "Remote domains this capability refers to using the [URLPattern standard](https://urlpattern.spec.whatwg.org/).\n\n## Examples\n\n- \"https://*.mydomain.dev\": allows subdomains of mydomain.dev - \"https://mydomain.dev/api/*\": allows any subpath of mydomain.dev/api",
@@ -1576,7 +1586,9 @@
},
{
"type": "object",
"required": ["path"],
"required": [
"path"
],
"properties": {
"path": {
"description": "FS scope path.",
@@ -1598,7 +1610,9 @@
},
{
"type": "object",
"required": ["path"],
"required": [
"path"
],
"properties": {
"path": {
"description": "FS scope path.",
@@ -1689,7 +1703,9 @@
},
{
"type": "object",
"required": ["url"],
"required": [
"url"
],
"properties": {
"url": {
"description": "A URL that can be accessed by the webview when using the HTTP APIs. Wildcards can be used following the URL pattern standard.\n\nSee [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin on port 443\n\n- \"https://*:*\" : allows all HTTPS origin on any port\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
@@ -1711,7 +1727,9 @@
},
{
"type": "object",
"required": ["url"],
"required": [
"url"
],
"properties": {
"url": {
"description": "A URL that can be accessed by the webview when using the HTTP APIs. Wildcards can be used following the URL pattern standard.\n\nSee [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin on port 443\n\n- \"https://*:*\" : allows all HTTPS origin on any port\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
@@ -1806,7 +1824,12 @@
"title": "Entry",
"description": "A command allowed to be executed by the webview API.",
"type": "object",
"required": ["args", "cmd", "name", "sidecar"],
"required": [
"args",
"cmd",
"name",
"sidecar"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
@@ -1836,7 +1859,12 @@
"title": "Entry",
"description": "A command allowed to be executed by the webview API.",
"type": "object",
"required": ["args", "cmd", "name", "sidecar"],
"required": [
"args",
"cmd",
"name",
"sidecar"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
@@ -1886,14 +1914,20 @@
},
"allow": {
"description": "Data that defines what is allowed by the scope.",
"type": ["array", "null"],
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
},
"deny": {
"description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.",
"type": ["array", "null"],
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Value"
}
@@ -1901,7 +1935,9 @@
}
}
],
"required": ["identifier"]
"required": [
"identifier"
]
}
]
},
@@ -5360,27 +5396,37 @@
{
"description": "MacOS.",
"type": "string",
"enum": ["macOS"]
"enum": [
"macOS"
]
},
{
"description": "Windows.",
"type": "string",
"enum": ["windows"]
"enum": [
"windows"
]
},
{
"description": "Linux.",
"type": "string",
"enum": ["linux"]
"enum": [
"linux"
]
},
{
"description": "Android.",
"type": "string",
"enum": ["android"]
"enum": [
"android"
]
},
{
"description": "iOS.",
"type": "string",
"enum": ["iOS"]
"enum": [
"iOS"
]
}
]
},
@@ -5394,7 +5440,9 @@
{
"description": "A variable that is set while calling the command from the webview API.",
"type": "object",
"required": ["validator"],
"required": [
"validator"
],
"properties": {
"raw": {
"description": "Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime.\n\nThis means the regex will not match on the entire string by default, which might be exploited if your regex allow unexpected input to be considered valid. When using this option, make sure your regex is correct.",
@@ -5427,4 +5475,4 @@
]
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -27,15 +27,15 @@ const Home: NextPage = () => {
useGlobalShortcut("CommandOrControl+P", shortcutHandler)
return (
<div className="flex min-h-screen flex-col bg-white">
<div className="flex flex-col ">
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>
<main className="flex flex-1 flex-col items-center justify-center py-8">
<h1 className="m-0 text-center text-6xl">
<main className="flex flex-col items-center justify-center flex-1 py-8">
<h1 className="m-0 text-6xl text-center">
Welcome to{" "}
<a
href="https://nextjs.org"
@@ -47,32 +47,14 @@ const Home: NextPage = () => {
</a>
</h1>
<p className="my-12 text-center text-2xl leading-9">
<p className="my-12 text-2xl leading-9 text-center">
Get started by editing{" "}
<code className="rounded-md bg-gray-200 p-2 font-mono text-xl">
<code className="p-2 font-mono text-xl bg-gray-200 rounded-md">
src/pages/index.tsx
</code>
</p>
<div className="flex max-w-3xl flex-wrap items-center justify-center">
<Card
url="https://nextjs.org/docs"
title="Documentation"
description="Find in-depth information about Next.js features and API."
/>
<Card
url="https://nextjs.org/learn"
title="Learn"
description="Learn about Next.js in an interactive course with quizzes!"
/>
<Card
url="https://github.com/vercel/next.js/tree/canary/examples"
title="Examples"
description="Discover and deploy boilerplate example Next.js projects."
/>
<div className="flex flex-wrap items-center justify-center max-w-3xl">
<CardButton
onClick={onButtonClick}
title="Tauri Invoke"
@@ -81,26 +63,7 @@ const Home: NextPage = () => {
</div>
</main>
<footer className="flex flex-1 flex-grow-0 items-center justify-center border-t border-gray-200 py-4">
<div>
<a
href="https://tauri.app/"
target="_blank"
rel="noopener noreferrer"
className="flex flex-grow items-center justify-center p-4"
>
Powered by{" "}
<span className="ml-2 h-6">
<Image
src="/tauri_logo_light.svg"
alt="Vercel Logo"
height={24}
width={78}
/>
</span>
</a>
</div>
</footer>
</div>
)
}