Huakun Shen 99b940b03b
File Transfer (Local Network) (#34)
* feat: implement a file streamer for file share

Only server with hardcoded file path

* bump valibot version

* feat: add server-info gRPC module to serve server info

* feat: add ssl cert and public key to peers state

When peer is online, KK always have know its cert and pub key for future secure communication

* feat: add grpc ts package

* Enable "/refresh-worker-extension" rest API, grpc version isn't ready  yet

* update pnpm lock

* ci: fix CI by moving protobuf install order

* ci: fix

* upgrade api due to valibot incompatibility

* fix: use fs instead of bun shell to be compatible with windows

* skip grpc pkg build on windows

* feat: local network file transfer prototype working

* fix: grpc build.ts

* download next to 14

* ci: add ci env try to fix next

* fix: hideRefreshBtn and a few other btns' hide API in iframe ext page

* feat: disable NODE_TLS_REJECT_UNAUTHORIZED for extension HMR refresh

* fix: manifest json schema with objectWithRest to allow any other fields in package.json

* chore: update valibot and related dependencies to version 1.0.0-beta.9 in pnpm-lock.yaml

* ci: add protobuf compiler installation to manifest-schema-upload workflow

* refactor: move grpc code from jarvis to a separate grpc crate

for easier testing

* feat(file-transfer): POC multi file + directory file transfer

* feat(file-transfer): replace file transfer recursive download in ts with rust

* feat(file-transfer): implement on_progress event for file transfer

* feat(file-transfer): report progress every 1MB instead of 100 iterations

* feat(file-transfer): add progress bar

* feat(file-transfer): UI

* feat(file-transfer): add file transfer bucket info preview

Show total size and number of files

* feat(file-transfer): improve UX

Show bucket info during confirm; improve progress bar UI, prevent inconsistent width

* feat(grpc): skip build in Cloudflare Pages due to missing protoc

* refactor: with cargo fix, unused imports removed

* ci: debug cloudflare pages env var

* fix(grpc): update environment variable access for Cloudflare Pages build check

* fix(grpc): add error handling for protoc command in build script

* chore: update kkrpc version to 0.0.13, remove kkrpc submodule, and enhance grpc build script logging

- Updated kkrpc dependency version from 0.0.12 to 0.0.13 in package.json.
- Removed the kkrpc submodule from the project.
- Enhanced logging in the grpc build script to include additional Cloudflare Pages environment variables for better debugging.

* fix(api): typescript error, remove base.json from tsconfig

* chore: update pnpm lock

* fix(api): update TypeScript configuration to extend base.json and clean up unused options

* refactor(api): update TypeScript configuration to extend path-alias.json and enhance compiler options

* fix(api): restore KunkunManifestPermission in PermissionUnion and update valibot import in schema tests

* fix: missing trait error

* fix: js require replaced with import

* test: fix a unit test with a more robust method

---------

Co-authored-by: Huakun Shen <huaukun.shen@huakunshen.com>
2024-12-11 08:14:40 -05:00
..
2024-12-11 08:14:40 -05:00
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00
2024-11-15 18:28:57 -05:00

Kunkun Custom UI Extension Template (SvelteKit)

Custom UI Extension Documentation

This is a template for a custom UI extension.

This type of extension is basically a static website. You can use any frontend framework you like, this template uses SvelteKit.

It is assumed that you have some knowledge of frontend development with SvelteKit.

Development

Development is the same as developing a normal website.

pnpm install
pnpm dev
pnpm build
  • To develop and preview the extension in Kunkun, you need to run the Add Dev Extension command in Kunkun, and register this extension's path.

In package.json, "devMain" is the url for development server, and "main" is the path to static .html file for production.

To load the extension in development mode, you have to enable it with Toggle Dev Extension Live Load Mode command in Kunkun. A Live badge will be shown on the commands. This indicates that dev extensions will be loaded from devMain instead of main.

Advanced

Rendering Mode

This is a Meta-Framework template, and already configured with SSG rendering mode. Please do not enable SSR unless you know what you are doing. There will not be a JS runtime in production, and Kunkun always load the extension as static files.

The main benefit of using a meta-framework is that it comes with routing, and will output multiple .html files, which makes multi-command support much easier.

Verify Build and Publish

pnpm build # make sure the build npm script works
npx kksh@latest verify # Verify some basic settings before publishing

It is recommended to build the extension with the same environment our CI uses.

The docker image used by our CI is huakunshen/kunkun-ext-builder:latest.

You can use the following command to build the extension with the same environment our CI uses. This requires you to have docker installed, and the shell you are using has access to it via docker command.

npx kksh@latest build # Build the extension with

pnpm is used to install dependencies and build the extension.

The docker image environment also has node, pnpm, npm, bun, deno installed. If your build failed, try debug with huakunshen/kunkun-ext-builder:latest image in interative mode and bind your extension volume to /workspace.

After build successfully, you should find a tarball file ends with .tgz in the root of your extension. The tarball is packaged with npm pack command. You can uncompress it to see if it contains all the necessary files.

This tarball is the final product that will be published and installed in Kunkun. You can further verify your extension by installing this tarball directly in Kunkun.

After verifying the tarball, it's ready to be published.

Fork KunkunExtensions repo, add your extension to the extensions directory, and create a PR.

Once CI passed and PR merged, you can use your extension in Kunkun.