Skip to content

Commit 808e40c

Browse files
authored
feat!: merge pull request #6 from kaede-basement/extensions
2 parents f624d6a + c9eb8e6 commit 808e40c

File tree

247 files changed

+9745
-1180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

247 files changed

+9745
-1180
lines changed

.github/workflows/build.yml

Lines changed: 84 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ on:
1111
- beta
1212
- rc
1313
- release
14+
- extensions
1415
tags:
1516
- "*"
1617
workflow_dispatch:
1718

1819
env:
19-
# default value, will be overwritten later if tag exists
20-
APP_VERSION: "0.1.0"
20+
# A default value, will be overwritten later if tag exists
21+
APP_VERSION: "0.0.1"
2122

2223
jobs:
2324
tauri:
@@ -27,18 +28,46 @@ jobs:
2728
fail-fast: false
2829
matrix:
2930
include:
30-
- name: "macOS-ARM"
31-
platform: "macos-latest" # for Arm based macs (M1 and above).
31+
- name: "macOS ARM"
32+
identifier: "macos-arm"
33+
platform: "macos-latest" # For Arm based macs (M1 and above).
3234
args: "--target aarch64-apple-darwin"
33-
- name: "macOS-x86_64"
34-
platform: "macos-latest" # for Intel based macs.
35+
type: "non-portable"
36+
- name: "macOS x86_64"
37+
identifier: "macos-x86"
38+
platform: "macos-latest" # For Intel based macs.
3539
args: "--target x86_64-apple-darwin"
40+
type: "non-portable"
3641
- name: "Linux"
42+
identifier: "linux"
3743
platform: "ubuntu-22.04"
3844
args: ""
45+
type: "non-portable"
3946
- name: "Windows"
47+
identifier: "windows"
4048
platform: "windows-latest"
4149
args: ""
50+
type: "non-portable"
51+
- name: "macOS ARM (Portable)"
52+
identifier: "macos-arm"
53+
platform: "macos-latest" # For Arm based macs (M1 and above).
54+
args: "--target aarch64-apple-darwin"
55+
type: "portable"
56+
- name: "macOS x86_64 (Portable)"
57+
identifier: "macos-x86"
58+
platform: "macos-latest" # For Intel based macs.
59+
args: "--target x86_64-apple-darwin"
60+
type: "portable"
61+
- name: "Linux (Portable)"
62+
identifier: "linux"
63+
platform: "ubuntu-22.04"
64+
args: ""
65+
type: "portable"
66+
- name: "Windows (Portable)"
67+
identifier: "windows"
68+
platform: "windows-latest"
69+
args: ""
70+
type: "portable"
4271

4372
runs-on: ${{ matrix.platform }}
4473
steps:
@@ -67,22 +96,38 @@ jobs:
6796
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
6897
6998
- name: Use version from Github Tag (Non-Windows)
70-
if: startsWith(github.ref, 'refs/tags/') && matrix.name != 'Windows'
99+
if: startsWith(github.ref, 'refs/tags/') && matrix.identifier != 'windows'
71100
run: |
72101
TAG_NAME="${GITHUB_REF#refs/tags/}"
73102
echo "APP_VERSION=${TAG_NAME}" >> $GITHUB_ENV
74103
75104
- name: Use version from Github Tag (Windows)
76-
if: startsWith(github.ref, 'refs/tags/') && matrix.name == 'Windows'
105+
if: startsWith(github.ref, 'refs/tags/') && matrix.identifier == 'windows'
77106
run: |
78107
$TAG_NAME = $env:GITHUB_REF -replace 'refs/tags/', ''
79108
echo "APP_VERSION=$TAG_NAME" >> $env:GITHUB_ENV
80109
110+
- name: Remove File System restrictions (Portable-only)
111+
if: matrix.type == 'portable'
112+
uses: restackio/update-json-file-action@6f50afee9a03a456a30cd574123db793319f7544
113+
with:
114+
file: "./src-tauri/capabilities/plugin-fs.json"
115+
fields: "{
116+
\"permissions[0].allow\": [{\"path\":\"**/*\"}]
117+
}"
118+
119+
- name: Mark window title as Portable (Portable-only)
120+
if: matrix.type == 'portable'
121+
uses: restackio/update-json-file-action@6f50afee9a03a456a30cd574123db793319f7544
122+
with:
123+
file: "./src-tauri/tauri.conf.json"
124+
fields: "{\"app.windows[0].title\": \"Kaede Portable\"}"
125+
81126
- name: Bump tauri.conf.json version
82127
uses: restackio/update-json-file-action@6f50afee9a03a456a30cd574123db793319f7544
83128
with:
84129
file: "./src-tauri/tauri.conf.json"
85-
fields: '{"version": "${{ env.APP_VERSION }}"}'
130+
fields: "{\"version\": \"${{ env.APP_VERSION }}\"}"
86131

87132
- name: Bump Cargo.toml version
88133
uses: colt-1/toml-editor@da6b46ee7779ed730d2160393ed95fb20e82696d
@@ -100,6 +145,15 @@ jobs:
100145
- name: Install frontend dependencies
101146
run: bun install
102147

148+
- name: Run TypeScript checks
149+
run: bun run typecheck
150+
151+
- name: Run ESLint
152+
run: bun run lint
153+
154+
- name: Run Vitest
155+
run: bun run test
156+
103157
- name: Build a Tauri app (Non-Release)
104158
if: (startsWith(github.ref, 'refs/tags/')) != true
105159
uses: tauri-apps/tauri-action@564aea5a8075c7a54c167bb0cf5b3255314a7f9d
@@ -121,81 +175,81 @@ jobs:
121175
args: ${{ matrix.args }}
122176

123177
- name: Upload binary (Windows, NSIS)
124-
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.name == 'Windows'
178+
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.identifier == 'windows' && matrix.type != 'portable'
125179
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
126180
with:
127181
if-no-files-found: "warn"
128-
name: "${{ steps.json_properties.outputs.productName }}-nightly-windows-nsis-${{steps.json_properties.outputs.version}}-${{ github.ref_name }}"
182+
name: "${{ steps.json_properties.outputs.productName }}-dev-windows-nsis-${{steps.json_properties.outputs.version}}-${{ matrix.type }}-${{ github.ref_name }}"
129183
path: "./src-tauri/target/release/bundle/nsis/${{ steps.json_properties.outputs.productName }}_${{steps.json_properties.outputs.version}}_x64-setup.exe"
130184

131185
- name: Upload binary (Windows, MSI)
132-
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.name == 'Windows'
186+
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.identifier == 'windows' && matrix.type != 'portable'
133187
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
134188
with:
135189
if-no-files-found: "warn"
136-
name: "${{ steps.json_properties.outputs.productName }}-nightly-windows-msi-${{steps.json_properties.outputs.version}}-${{ github.ref_name }}"
190+
name: "${{ steps.json_properties.outputs.productName }}-dev-windows-msi-${{steps.json_properties.outputs.version}}-${{ matrix.type }}-${{ github.ref_name }}"
137191
path: "./src-tauri/target/release/bundle/msi/${{ steps.json_properties.outputs.productName }}_${{steps.json_properties.outputs.version}}_x64_en-US.msi"
138192

139-
- name: Upload binary (Windows, portable)
140-
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.name == 'Windows'
193+
- name: Upload binary (Windows, non-setup)
194+
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.identifier == 'windows'
141195
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
142196
with:
143197
if-no-files-found: "warn"
144-
name: "${{ steps.json_properties.outputs.productName }}-nightly-windows-portable-${{steps.json_properties.outputs.version}}-${{ github.ref_name }}"
198+
name: "${{ steps.json_properties.outputs.productName }}-dev-windows-non-setup-${{steps.json_properties.outputs.version}}-${{ matrix.type }}-${{ github.ref_name }}"
145199
path: "./src-tauri/target/release/${{ steps.json_properties.outputs.productName }}.exe"
146200

147201
- name: Upload binary (Linux, DEB)
148-
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.name == 'Linux'
202+
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.identifier == 'linux'
149203
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
150204
with:
151205
if-no-files-found: "warn"
152-
name: "${{ steps.json_properties.outputs.productName }}-nightly-linux-deb-${{steps.json_properties.outputs.version}}-${{ github.ref_name }}"
206+
name: "${{ steps.json_properties.outputs.productName }}-dev-linux-deb-${{steps.json_properties.outputs.version}}-${{ matrix.type }}-${{ github.ref_name }}"
153207
path: "./src-tauri/target/release/bundle/deb/${{ steps.json_properties.outputs.productName }}_${{steps.json_properties.outputs.version}}_amd64.deb"
154208

155209
- name: Upload binary (Linux, RPM)
156-
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.name == 'Linux'
210+
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.identifier == 'linux'
157211
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
158212
with:
159213
if-no-files-found: "warn"
160-
name: "${{ steps.json_properties.outputs.productName }}-nightly-linux-rpm-${{steps.json_properties.outputs.version}}-${{ github.ref_name }}"
214+
name: "${{ steps.json_properties.outputs.productName }}-dev-linux-rpm-${{steps.json_properties.outputs.version}}-${{ matrix.type }}-${{ github.ref_name }}"
161215
path: "./src-tauri/target/release/bundle/rpm/${{ steps.json_properties.outputs.productName }}-${{steps.json_properties.outputs.version}}-1.x86_64.rpm"
162216

163217
- name: Upload binary (Linux, AppImage)
164-
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.name == 'Linux'
218+
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.identifier == 'linux'
165219
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
166220
with:
167221
if-no-files-found: "warn"
168-
name: "${{ steps.json_properties.outputs.productName }}-nightly-linux-app-image-${{steps.json_properties.outputs.version}}-${{ github.ref_name }}"
222+
name: "${{ steps.json_properties.outputs.productName }}-dev-linux-app-image-${{steps.json_properties.outputs.version}}-${{ matrix.type }}-${{ github.ref_name }}"
169223
path: "./src-tauri/target/release/bundle/appimage/${{ steps.json_properties.outputs.productName }}_${{steps.json_properties.outputs.version}}_amd64.AppImage"
170224

171225
- name: Upload binary (macOS, x86_64, DMG)
172-
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.name == 'macOS-x86_64'
226+
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.identifier == 'macos-x86'
173227
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
174228
with:
175229
if-no-files-found: "warn"
176-
name: "${{ steps.json_properties.outputs.productName }}-nightly-macos-x86_64-dmg-${{steps.json_properties.outputs.version}}-${{ github.ref_name }}"
230+
name: "${{ steps.json_properties.outputs.productName }}-dev-macos-x86_64-dmg-${{steps.json_properties.outputs.version}}-${{ matrix.type }}-${{ github.ref_name }}"
177231
path: "./src-tauri/target/x86_64-apple-darwin/release/bundle/dmg/${{ steps.json_properties.outputs.productName }}_${{steps.json_properties.outputs.version}}_x64.dmg"
178232

179233
- name: Upload binary (macOS, x86_64, tarball)
180-
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.name == 'macOS-x86_64'
234+
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.identifier == 'macos-x86'
181235
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
182236
with:
183237
if-no-files-found: "warn"
184-
name: "${{ steps.json_properties.outputs.productName }}-nightly-macos-x86_64-tarball-${{steps.json_properties.outputs.version}}-${{ github.ref_name }}"
238+
name: "${{ steps.json_properties.outputs.productName }}-dev-macos-x86_64-tarball-${{steps.json_properties.outputs.version}}-${{ matrix.type }}-${{ github.ref_name }}"
185239
path: "./src-tauri/target/x86_64-apple-darwin/release/bundle/macos/${{ steps.json_properties.outputs.productName }}.app.tar.gz"
186240

187241
- name: Upload binary (macOS, ARM, DMG)
188-
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.name == 'macOS-ARM'
242+
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.identifier == 'macos-arm'
189243
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
190244
with:
191245
if-no-files-found: "warn"
192-
name: "${{ steps.json_properties.outputs.productName }}-nightly-macos-arm-dmg-${{steps.json_properties.outputs.version}}-${{ github.ref_name }}"
246+
name: "${{ steps.json_properties.outputs.productName }}-dev-macos-arm-dmg-${{steps.json_properties.outputs.version}}-${{ matrix.type }}-${{ github.ref_name }}"
193247
path: "./src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/${{ steps.json_properties.outputs.productName }}_${{steps.json_properties.outputs.version}}_aarch64.dmg"
194248

195249
- name: Upload binary (macOS, ARM, tarball)
196-
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.name == 'macOS-ARM'
250+
if: (startsWith(github.ref, 'refs/tags/') != true) && matrix.identifier == 'macos-arm'
197251
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
198252
with:
199253
if-no-files-found: "warn"
200-
name: "${{ steps.json_properties.outputs.productName }}-nightly-macos-arm-tarball-${{steps.json_properties.outputs.version}}-${{ github.ref_name }}"
254+
name: "${{ steps.json_properties.outputs.productName }}-dev-macos-arm-tarball-${{steps.json_properties.outputs.version}}-${{ matrix.type }}-${{ github.ref_name }}"
201255
path: "./src-tauri/target/aarch64-apple-darwin/release/bundle/macos/${{ steps.json_properties.outputs.productName }}.app.tar.gz"

.github/workflows/eslint.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Development
2+
public/
3+
14
# Logs
25
logs
36
*.log

bun.lockb

12.2 KB
Binary file not shown.

docs/CONTRIBUTING.md

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[README for JavaScript-related code](../src/README.md) | [README for Rust-related code](../src-tauri/README.md) | Contributing Guidelines
2+
13
# Contributions Guidelines
24

35
## Note
@@ -10,19 +12,39 @@ Translations are done externally via a [Kaede Translations repository](https://g
1012

1113
## Extensions
1214

13-
tbd
15+
You need this section only if you want to develop an extension.
16+
17+
### Repositories
18+
19+
Kaede has two built-in plugin repositories.
20+
21+
The first one is a [Kaede Add-ons User Repository (KAUR)](https://github.com/kaede-basement/kaur), similar to [AUR](https://aur.archlinux.org/) and [nixpkgs](https://github.com/NixOS/nixpkgs). This repository contains user published extensions.
22+
23+
The second one is a [trusted-extensions repository](https://github.com/kaede-basement/trusted-extensions). I publish my extensions there. Others may publish there too, but only by contacting me. A plugin publisher must provide me the plugin source code and build manuals. I will manually review the provided code and provide the feedback if something is not good. The reviewing procedure will happen each time a plugin publisher wants to update their extension in the repository.
24+
25+
### Safety
26+
27+
Extensions can be loaded in two environments.
28+
29+
The first one is a restricted environment (sandbox) that uses a permission-based system. When enabling the plugin for the first time, users are prompted with the permissions window. That window has permission toggles that the plugin requested. KAUR extensions are executed in this environment.
30+
31+
Restricted environment is achieved by using a [Secure ECMAScript](https://github.com/endojs/endo) framework. Each permission has its own list of globals that are passed to the plugin. Unfortunately, almost every DOM operation is prohibited since it leads to the sandbox escape.
32+
33+
The second one is an unrestricted environment that allows plugins to do everything that the Kaede can do itself. Trusted extensions are executed in this environment. Settings also have an option to enable the execution of KAUR extensions that require an unrestricted environment.
1434

1535
## Code Formatting
1636

1737
All files are formatted with [ESLint](https://eslint.org/) using the configuration in `eslint.config.js`. Ensure it is run on changed files before committing!
1838

1939
Please also follow the project's conventions for frontend:
2040

41+
- No AI slops in the launcher code (plugins don't count).
2142
- TypeScript is highly recommended.
2243
- `.vue` file names should be formatted as `PascalCase`. All other files should use `kebab-case`.
2344
- Exported constants should be formatted as `PascalCase`.
2445
- Functions, variables, non-exported constants should be formatted as `camelCase`.
25-
- Elements styling is preferred by using `Tailwind v3` classes. If there is no utility class for some case, make your own, or use CSS/JS.
46+
- Element styling is preferred by using `Tailwind v3` classes. If there is no utility class for some cases, then make your own with CSS.
47+
- [BEM](https://en.bem.info/methodology/) methodology is the preferred way to name element IDs and classes to simplify styling by extensions. All elements should have unique IDs.
2648

2749
## Commit Messages
2850

@@ -33,24 +55,24 @@ Please also follow the project's conventions for frontend:
3355
### Elements
3456

3557
- **Type**: Choose from the following list. If none of the types match, use `chore`.
36-
- `feat`: A new feature
37-
- `fix`: A bug fix
38-
- `docs`: Documentation only changes
39-
- `style`: Changes that do not affect the meaning of the code
40-
- `refactor`: Improving code structure
41-
- `perf`: A code change that improves performance
42-
- `test`: Adding missing tests or correcting existing tests
43-
- `build`: Changes that affect the build system or external dependencies
44-
- `chore`: Other changes that don't modify src or test files
45-
- `revert`: Reverts a previous commit
46-
- `release`: Releasing a new version
47-
- `ci`: Changes to our CI configuration
58+
- `feat`: A new feature.
59+
- `fix`: A bug fix.
60+
- `docs`: Documentation only changes.
61+
- `style`: Changes that do not affect the meaning of the code.
62+
- `refactor`: Improving code structure.
63+
- `perf`: A code change that improves performance.
64+
- `test`: Adding missing tests or correcting existing tests.
65+
- `build`: Changes that affect the build system or external dependencies.
66+
- `chore`: Other changes that don't modify src or test files.
67+
- `revert`: Reverts a previous commit.
68+
- `release`: Releasing a new version.
69+
- `ci`: Changes to our CI configuration.
4870
- **Scope**: As described in Conventional Commits.
4971
- **Breaking Change**: If you're introducing a breaking change, append `!` to the type or scope, e.g., `feat(ui)!: Breaking change`.
5072

5173
- **Subject**: Brief description of the change.
5274

5375
### Guidelines
5476

55-
- Use imperative mood, e.g., "add feature" instead of "adding feature" or "added feature".
77+
- Use imperative mood, e.g. "add feature" instead of "adding feature" or "added feature".
5678
- Avoid ending with a period.

0 commit comments

Comments
 (0)