Skip to content

Commit 4d34907

Browse files
authored
Merge branch 'v2' into add-flag-i18nReady
2 parents a5961e1 + eddb082 commit 4d34907

File tree

8 files changed

+307
-99
lines changed

8 files changed

+307
-99
lines changed

.github/workflows/assign.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ on:
77
jobs:
88
auto_assign:
99
runs-on: ubuntu-latest
10-
1110
steps:
1211
- name: Auto-assign PR to author
1312
env:
14-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
GH_TOKEN: ${{ secrets.ORG_TAURI_BOT_PAT }}
1514
run: |
1615
pr_number=${{ github.event.pull_request.number }}
1716
pr_author=${{ github.event.pull_request.user.login }}

.github/workflows/priority.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ jobs:
1313
permissions:
1414
pull-requests: write
1515
issues: write
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.ORG_TAURI_BOT_PAT }}
1618
steps:
19+
- name: Set up GitHub CLI
20+
run: |
21+
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
1722
- name: Get project data
1823
env:
1924
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/status.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,10 @@ jobs:
88
set_statuses:
99
runs-on: ubuntu-latest
1010
if: ${{ !contains(github.event.issue.labels.*.name, 'manual') && !contains(github.event.pull_request.labels.*.name, 'manual') }}
11-
permissions:
12-
contents: write
13-
pull-requests: write
14-
issues: write
1511
steps:
16-
- name: Set up GitHub CLI
17-
run: |
18-
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
1912
- name: Get project data
2013
env:
21-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14+
GH_TOKEN: ${{ secrets.ORG_TAURI_BOT_PAT }}
2215
ORGANIZATION: tauri-apps
2316
PROJECT_NUMBER: 27
2417
run: |
@@ -56,7 +49,7 @@ jobs:
5649
5750
- name: Add/get item id
5851
env:
59-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
GH_TOKEN: ${{ secrets.ORG_TAURI_BOT_PAT }}
6053
run: |
6154
if [ "${{ github.event.pull_request.node_id }}" != "" ]; then
6255
echo "NODE_ID=${{ github.event.pull_request.node_id }}" >> $GITHUB_ENV
@@ -109,7 +102,7 @@ jobs:
109102

110103
- name: Set fields
111104
env:
112-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
GH_TOKEN: ${{ secrets.ORG_TAURI_BOT_PAT }}
113106
run: |
114107
gh api graphql -f query='
115108
mutation (

pnpm-lock.yaml

Lines changed: 84 additions & 84 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/content/docs/develop/index.mdx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,25 @@ import CommandTabs from '@components/CommandTabs.astro';
1818

1919
### 1. Start Your Dev server
2020

21-
Now that you have [everything set up](../start/), you should start your application development server provided by your UI framework or bundler (assuming you're using one, of course). If you followed our guides you will have `beforeDevCommand` configured to do this for you in step 2.
21+
Now that you have [everything set up](../start/), you should start your application development server
22+
provided by your UI framework or bundler (assuming you're using one, of course).
23+
If you followed our guides you will have `beforeDevCommand` configured to do this for you in step 2.
2224

2325
:::note
2426

2527
Every framework has its own development tooling. It is outside of the scope of this document to cover them all or stay up to date.
2628

2729
:::
2830

31+
:::caution[Plain/Vanilla Dev Server Security]
32+
33+
The built-in Tauri development server does not support mutual authentication
34+
or encryption. You should never use it for development on untrusted networks.
35+
See the [development server security considerations](/security/lifecycle#development-server)
36+
for a more detailed explanation.
37+
38+
:::
39+
2940
### 2. Start Tauri Development Window
3041

3142
<CommandTabs
@@ -41,7 +52,7 @@ Once Rust has finished building, the webview opens, displaying your web app. You
4152

4253
Note that Tauri's APIs only work in your app windows, so once you start using them you won't be able to open your frontend in your system's browser anymore.
4354

44-
:::caution[About Cargo.toml and Source Control]
55+
:::note[About Cargo.toml and Source Control]
4556

4657
In your project repository, you **SHOULD** commit the `src-tauri/Cargo.lock` along with the `src-tauri/Cargo.toml` to git because Cargo uses the lockfile to provide deterministic builds. As a result, it is recommended that all applications check in their `Cargo.lock`. You **SHOULD NOT** commit the `src-tauri/target` folder or any of its contents.
4758

src/content/docs/plugin/sql.mdx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,26 @@ fn main() {
221221
222222
### Applying Migrations
223223
224-
Migrations are applied automatically when the plugin is initialized. The plugin runs these migrations against the database specified by the connection string. Ensure that the migrations are defined in the correct order and are idempotent (safe to run multiple times).
224+
To apply the migrations when the plugin is initialized, add the connection string to the `tauri.conf.json` file:
225+
226+
```json title="src-tauri/tauri.conf.json" {3-5}
227+
{
228+
"plugins": {
229+
"sql": {
230+
"preload": ["sqlite:mydatabase.db"]
231+
}
232+
}
233+
}
234+
```
235+
236+
Alternatively, the client side `load()` also runs the migrations for a given connection string:
237+
238+
```ts
239+
import Database from '@tauri-apps/plugin-sql';
240+
const db = await Database.load('sqlite:mydatabase.db');
241+
```
242+
243+
Ensure that the migrations are defined in the correct order and are safe to run multiple times.
225244
226245
### Migration Management
227246

src/content/docs/security/lifecycle.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,30 @@ which are usually considered to be attacks on direct dependencies of your projec
7171
However, a growing class of attacks in the wild directly target development machines,
7272
and you would be well off to address this head-on.
7373

74+
### Development Server
75+
76+
Tauri application frontends can be developed using a number of web frameworks.
77+
Each of these frameworks usually ship their own development server, which is exposing
78+
the frontend assets via an open port to the local system or network.
79+
This allows the frontend to be hot-reloaded and debugged in the WebView or Browser.
80+
81+
In practice this connection is often neither encrypted nor authenticated by default.
82+
This is also the case for the built-in Tauri development server and exposes your
83+
frontend and assets to the local network. Additionally, this allows attackers
84+
to push their own frontend code to development devices in the same network as the attacker.
85+
Depending on what kind of functionality is exposed this could lead to device compromise
86+
in the worst case.
87+
88+
You should only develop on trusted networks where you can safely expose your
89+
development device. If this is not possible you MUST ensure that your development
90+
server uses **mutual** authentication and encryption (e.g. mTLS) for connections
91+
with your development devices.
92+
93+
:::note
94+
The built-in Tauri development server does not support
95+
mutual authentication and transport encryption at the moment and should not be used on untrusted networks.
96+
:::
97+
7498
### Harden Development machines
7599

76100
Hardening your development systems depends on various factors and on your personal
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
title: Snapcraft
3+
sidebar:
4+
order: 1
5+
---
6+
7+
## 前置条件
8+
9+
import { Tabs, TabItem, Card } from '@astrojs/starlight/components';
10+
11+
**1. 安装 `snap`**
12+
13+
{/* prettier-ignore */}
14+
<Tabs>
15+
<TabItem label="Debian">
16+
```shell
17+
sudo apt install snapd
18+
```
19+
</TabItem>
20+
<TabItem label="Arch">
21+
```shell
22+
sudo pacman -S --needed git base-devel
23+
git clone https://aur.archlinux.org/snapd.git
24+
cd snapd
25+
makepkg -si
26+
sudo systemctl enable --now snapd.socket
27+
sudo systemctl start snapd.socket
28+
sudo systemctl enable --now snapd.apparmor.service
29+
```
30+
</TabItem>
31+
<TabItem label="Fedora">
32+
```shell
33+
sudo dnf install snapd
34+
# Enable classic snap support
35+
sudo ln -s /var/lib/snapd/snap /snap
36+
```
37+
38+
然后重新启动系统。
39+
40+
</TabItem>
41+
</Tabs>
42+
43+
**2. 安装 snap 基座**
44+
45+
```shell
46+
sudo snap install core22
47+
```
48+
49+
**3. 安装 `snapcraft`**
50+
51+
```shell
52+
sudo snap install snapcraft --classic
53+
```
54+
55+
## 配置
56+
57+
1. 创建一个 UbuntuOne 账号。
58+
2. 请前往 [Snapcraft](https://snapcraft.io) 网站注册一个应用名称。
59+
3. 在你项目的根目录创建一个 snapcraft.yaml 文件。
60+
4. 调整 snapcraft.yaml 文件中的 name。
61+
62+
```yaml
63+
name: app
64+
base: core22
65+
version: '2.0.4'
66+
summary: Your summary # 79 char long summary
67+
description: |
68+
Your Description
69+
70+
grade: stable
71+
confinement: strict
72+
73+
apps:
74+
app:
75+
command: bin/app
76+
desktop: usr/share/applications/app.desktop
77+
78+
package-repositories:
79+
- type: apt
80+
components: [main]
81+
suites: [noble]
82+
key-id: 78E1918602959B9C59103100F1831DDAFC42E99D
83+
url: http://ppa.launchpad.net/snappy-dev/snapcraft-daily/ubuntu
84+
85+
parts:
86+
prep:
87+
plugin: dump
88+
build-snaps:
89+
- node/20/stable
90+
- rustup/latest/stable
91+
build-packages:
92+
- libwebkit2gtk-4.1-dev
93+
- build-essential
94+
- curl
95+
- wget
96+
- file
97+
- libxdo-dev
98+
- libssl-dev
99+
- libayatana-appindicator3-dev
100+
- librsvg2-dev
101+
- dpkg
102+
stage-packages:
103+
- libwebkit2gtk-4.1-0
104+
- libglu1-mesa
105+
- libsoup-3.0-0
106+
- freeglut3
107+
source: .
108+
override-pull: |
109+
set -eu
110+
craftctl default
111+
rustup default nightly
112+
npm install
113+
npm run tauri build -- --bundles deb
114+
dpkg -x src-tauri/target/release/bundle/deb/*.deb here
115+
sed -i -e "s|Icon=app|Icon=/usr/share/icons/hicolor/32x32/apps/app.png|g" here/usr/share/applications/app.desktop
116+
cp -r here/* .
117+
organize:
118+
usr/bin/app: bin/app
119+
```
120+
121+
### 解释
122+
123+
- `name` 变量定义了你的应用程序的名称,并且必须设置为之前注册的名称。
124+
- `base` 变量定义了你正在使用的核心。
125+
- `version` 变量定义了版本,并且应该随着源代码库的每次更改而更新。
126+
- `apps` 部分允许你公开桌面和二进制文件以供用户运行你的应用。
127+
- `package-repositories` 部分允许你添加一个包仓库来帮助你满足你的依赖。
128+
- `build-packages`/`build-snaps` 为你的 snap 定义构建依赖。
129+
- `stage-packages`/`stage-snaps` 定义了你的 snap 的运行时依赖。
130+
- `override-pull` 部分在拉取数据源之前运行一系列命令。
131+
- `craftctl default` 执行默认的拉取命令。
132+
- `organize` 部分将文件移动到合适的目录,以便二进制文件和桌面文件可以暴露给 `apps` 部分。
133+
134+
## 构建
135+
136+
```sh
137+
sudo snapcraft
138+
```
139+
140+
## 测试
141+
142+
```shell
143+
snap run your-app
144+
```
145+
146+
## 手动发布
147+
148+
```shell
149+
snapcraft login # 用你的 UbuntuOne 凭证登录
150+
snapcraft upload --release=stable mysnap_latest_amd64.snap
151+
```
152+
153+
## 自动构建
154+
155+
1. 在你的 app 开发者页面上,点击 `builds` 选项卡。
156+
2. 点击 `login with github`.
157+
3. 输入存储库的详细信息。

0 commit comments

Comments
 (0)