kunkunsh / kunkun-nuxt

An open source, cross-platform, extensible app launcher.
https://kunkun.sh
48 stars 8 forks source link

Add $EXTENSION and $EXTENSION_SUPPORT path alias for fs and shell API #11

Closed HuakunShen closed 2 months ago

HuakunShen commented 2 months ago

Allow extension to read its own script, but no write permission! Otherwise permissions in package.json could be modified.

$EXT_SUPPORT is similar to raycast environment.supportPath, it's a directory where extensions can download some helper files like an executable.

HuakunShen commented 2 months ago

Turns out it's very difficult to add this for fs API, which requires forking the entire tauri fs plugin and change its rust and typescript.

It's simple to implement this for path API.

Implemented here https://github.com/kunkunsh/kunkun/commit/2c8baac2171ec032d7ce789194214a2613d69637

HuakunShen commented 2 months ago

In PR https://github.com/kunkunsh/kunkun/pull/21 $EXTENSION alias added to path, fs, shell API. However, it doesn't support BaseDirectory enum if used with fs APIs, as that will require rewrite code in tauri-plugin-fs. I don't think it's worth it for now. Just get absolute path from path API then pass to fs API.

The $EXTENSION_SUPPORT path alias is on hold. I will implement this when I need this for a specific plugin. Probably speedtest, which requires downloading the speedtest cli.

HuakunShen commented 2 months ago

Implement $EXTENSION_SUPPORT and path.extensionSupport() in 6cc7bcc79e578e6776496fde3b0861051f790add