Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ tauri-plugin-deeplink2 = { path = "plugins/deeplink2" }
tauri-plugin-detect = { path = "plugins/detect" }
tauri-plugin-export = { path = "plugins/export" }
tauri-plugin-extensions = { path = "plugins/extensions" }
tauri-plugin-folder = { path = "plugins/folder" }
tauri-plugin-hooks = { path = "plugins/hooks" }
tauri-plugin-icon = { path = "plugins/icon" }
tauri-plugin-importer = { path = "plugins/importer" }
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@hypr/plugin-deeplink2": "workspace:*",
"@hypr/plugin-detect": "workspace:*",
"@hypr/plugin-export": "workspace:*",
"@hypr/plugin-folder": "workspace:*",
"@hypr/plugin-extensions": "workspace:*",
"@hypr/plugin-hooks": "workspace:*",
"@hypr/plugin-icon": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tauri-plugin-detect = { workspace = true }
tauri-plugin-dialog = { workspace = true }
tauri-plugin-export = { workspace = true }
tauri-plugin-extensions = { workspace = true }
tauri-plugin-folder = { workspace = true }
tauri-plugin-fs = { workspace = true }
tauri-plugin-hooks = { workspace = true }
tauri-plugin-http = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
"os:default",
"detect:default",
"export:default",
"folder:default",
"permissions:default",
"settings:default",
"sfx:default",
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ pub async fn main() {
.plugin(tauri_plugin_deep_link::init())
.plugin(tauri_plugin_deeplink2::init())
.plugin(tauri_plugin_export::init())
.plugin(tauri_plugin_folder::init())
.plugin(tauri_plugin_os::init())
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_path2::init())
Expand Down
17 changes: 17 additions & 0 deletions plugins/folder/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/.vs
.DS_Store
.Thumbs.db
*.sublime*
.idea/
debug.log
package-lock.json
.vscode/settings.json
yarn.lock

/.tauri
/target
Cargo.lock
node_modules/

dist-js
dist
24 changes: 24 additions & 0 deletions plugins/folder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "tauri-plugin-folder"
version = "0.1.0"
authors = ["You"]
edition = "2024"
exclude = ["/js", "/node_modules"]
links = "tauri-plugin-folder"
description = ""

[build-dependencies]
tauri-plugin = { workspace = true, features = ["build"] }

[dev-dependencies]
specta-typescript = { workspace = true }
tokio = { workspace = true, features = ["macros"] }

[dependencies]
tauri = { workspace = true, features = ["test"] }
tauri-specta = { workspace = true, features = ["derive", "typescript"] }

serde = { workspace = true }
specta = { workspace = true }

thiserror = { workspace = true }
5 changes: 5 additions & 0 deletions plugins/folder/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const COMMANDS: &[&str] = &["ping"];

fn main() {
tauri_plugin::Builder::new(COMMANDS).build();
}
89 changes: 89 additions & 0 deletions plugins/folder/js/bindings.gen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// @ts-nocheck

// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually.

/** user-defined commands **/


export const commands = {
async ping() : Promise<Result<string, string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("plugin:folder|ping") };
} catch (e) {
if(e instanceof Error) throw e;
else return { status: "error", error: e as any };
}
}
}

/** user-defined events **/



/** user-defined constants **/



/** user-defined types **/



/** tauri-specta globals **/

import {
invoke as TAURI_INVOKE,
Channel as TAURI_CHANNEL,
} from "@tauri-apps/api/core";
import * as TAURI_API_EVENT from "@tauri-apps/api/event";
import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webviewWindow";

type __EventObj__<T> = {
listen: (
cb: TAURI_API_EVENT.EventCallback<T>,
) => ReturnType<typeof TAURI_API_EVENT.listen<T>>;
once: (
cb: TAURI_API_EVENT.EventCallback<T>,
) => ReturnType<typeof TAURI_API_EVENT.once<T>>;
emit: null extends T
? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
: (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>;
};

export type Result<T, E> =
| { status: "ok"; data: T }
| { status: "error"; error: E };

function __makeEvents__<T extends Record<string, any>>(
mappings: Record<keyof T, string>,
) {
return new Proxy(
{} as unknown as {
[K in keyof T]: __EventObj__<T[K]> & {
(handle: __WebviewWindow__): __EventObj__<T[K]>;
};
},
{
get: (_, event) => {
const name = mappings[event as keyof T];

return new Proxy((() => {}) as any, {
apply: (_, __, [window]: [__WebviewWindow__]) => ({
listen: (arg: any) => window.listen(name, arg),
once: (arg: any) => window.once(name, arg),
emit: (arg: any) => window.emit(name, arg),
}),
get: (_, command: keyof __EventObj__<any>) => {
switch (command) {
case "listen":
return (arg: any) => TAURI_API_EVENT.listen(name, arg);
case "once":
return (arg: any) => TAURI_API_EVENT.once(name, arg);
case "emit":
return (arg: any) => TAURI_API_EVENT.emit(name, arg);
}
},
});
},
},
);
}
1 change: 1 addition & 0 deletions plugins/folder/js/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./bindings.gen";
11 changes: 11 additions & 0 deletions plugins/folder/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@hypr/plugin-folder",
"private": true,
"main": "./js/index.ts",
"scripts": {
"codegen": "cargo test -p tauri-plugin-folder"
},
"dependencies": {
"@tauri-apps/api": "^2.9.1"
}
}
13 changes: 13 additions & 0 deletions plugins/folder/permissions/autogenerated/commands/ping.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Automatically generated - DO NOT EDIT!

"$schema" = "../../schemas/schema.json"

[[permission]]
identifier = "allow-ping"
description = "Enables the ping command without any pre-configured scope."
commands.allow = ["ping"]

[[permission]]
identifier = "deny-ping"
description = "Denies the ping command without any pre-configured scope."
commands.deny = ["ping"]
43 changes: 43 additions & 0 deletions plugins/folder/permissions/autogenerated/reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Default Permission

Default permissions for the plugin

#### This default permission set includes the following:

- `allow-ping`

## Permission Table

<table>
<tr>
<th>Identifier</th>
<th>Description</th>
</tr>


<tr>
<td>

`folder:allow-ping`

</td>
<td>

Enables the ping command without any pre-configured scope.

</td>
</tr>

<tr>
<td>

`folder:deny-ping`

</td>
<td>

Denies the ping command without any pre-configured scope.

</td>
</tr>
</table>
3 changes: 3 additions & 0 deletions plugins/folder/permissions/default.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[default]
description = "Default permissions for the plugin"
permissions = ["allow-ping"]
Loading
Loading