Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 83bf22d36c |
@@ -1 +0,0 @@
|
|||||||
81e1a25de641f0292863b1404cba728c1eadd00d
|
|
||||||
@@ -1,232 +0,0 @@
|
|||||||
name: Build Lotus Chat Desktop
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
GITEA_URL: https://code.lotusguild.org
|
|
||||||
REPO: LotusGuild/cinny-desktop
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
prepare:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
version: ${{ steps.ver.outputs.version }}
|
|
||||||
release_id: ${{ steps.release.outputs.release_id }}
|
|
||||||
steps:
|
|
||||||
- name: Compute version
|
|
||||||
id: ver
|
|
||||||
run: echo "version=4.12.${{ github.run_number }}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Create or update release
|
|
||||||
id: release
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
||||||
run: |
|
|
||||||
VERSION="4.12.${{ github.run_number }}"
|
|
||||||
EXISTING=$(curl -sf "$GITEA_URL/api/v1/repos/$REPO/releases/tags/latest" \
|
|
||||||
-H "Authorization: token $TOKEN" 2>/dev/null || true)
|
|
||||||
RELEASE_ID=$(echo "$EXISTING" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('id',''))" 2>/dev/null || true)
|
|
||||||
if [ -n "$RELEASE_ID" ] && [ "$RELEASE_ID" != "None" ] && [ "$RELEASE_ID" != "" ]; then
|
|
||||||
curl -sf -X PATCH "$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID" \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"name\":\"Lotus Chat $VERSION\",\"body\":\"Built from ${{ github.sha }}\"}" > /dev/null
|
|
||||||
else
|
|
||||||
RELEASE_ID=$(curl -sf -X POST "$GITEA_URL/api/v1/repos/$REPO/releases" \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"tag_name\":\"latest\",\"name\":\"Lotus Chat $VERSION\",\"prerelease\":true,\"body\":\"Built from ${{ github.sha }}\"}" \
|
|
||||||
| python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
|
||||||
fi
|
|
||||||
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
build-windows:
|
|
||||||
needs: prepare
|
|
||||||
runs-on: windows
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: .node-version
|
|
||||||
|
|
||||||
- name: Checkout submodules (shallow)
|
|
||||||
shell: powershell
|
|
||||||
run: git submodule update --init --depth=1
|
|
||||||
|
|
||||||
- name: Patch version
|
|
||||||
shell: powershell
|
|
||||||
run: python3 -c "import json; d=json.load(open('src-tauri/tauri.conf.json')); d['version']='${{ needs.prepare.outputs.version }}'; open('src-tauri/tauri.conf.json','w').write(json.dumps(d,indent=2))"
|
|
||||||
|
|
||||||
- name: Install frontend deps
|
|
||||||
shell: powershell
|
|
||||||
run: cd cinny; npm ci
|
|
||||||
|
|
||||||
- name: Install Tauri deps
|
|
||||||
shell: powershell
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
shell: powershell
|
|
||||||
env:
|
|
||||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
|
||||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ''
|
|
||||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
|
||||||
run: npm run tauri -- build --bundles nsis
|
|
||||||
|
|
||||||
- name: Upload to release
|
|
||||||
shell: powershell
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
||||||
RELEASE_ID: ${{ needs.prepare.outputs.release_id }}
|
|
||||||
VERSION: ${{ needs.prepare.outputs.version }}
|
|
||||||
run: |
|
|
||||||
$releaseId = $env:RELEASE_ID
|
|
||||||
$VERSION = $env:VERSION
|
|
||||||
Write-Host "Version: $VERSION Release: $releaseId"
|
|
||||||
|
|
||||||
$nsis = "src-tauri\target\release\bundle\nsis"
|
|
||||||
$files = @(
|
|
||||||
"$nsis\Lotus Chat_${VERSION}_x64-setup.exe",
|
|
||||||
"$nsis\Lotus Chat_${VERSION}_x64-setup.nsis.zip",
|
|
||||||
"$nsis\Lotus Chat_${VERSION}_x64-setup.nsis.zip.sig"
|
|
||||||
)
|
|
||||||
$names = @("LotusChat-x86_64-setup.exe", "LotusChat-x86_64-setup.nsis.zip", "LotusChat-x86_64-setup.nsis.zip.sig")
|
|
||||||
for ($i = 0; $i -lt $files.Length; $i++) {
|
|
||||||
$existing = (Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases/$releaseId/assets" `
|
|
||||||
-Headers @{ Authorization = "token $env:TOKEN" }) | Where-Object { $_.name -eq $names[$i] }
|
|
||||||
if ($existing) {
|
|
||||||
Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases/$releaseId/assets/$($existing.id)" `
|
|
||||||
-Method Delete -Headers @{ Authorization = "token $env:TOKEN" }
|
|
||||||
}
|
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($files[$i])
|
|
||||||
Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases/$releaseId/assets?name=$($names[$i])" `
|
|
||||||
-Method Post `
|
|
||||||
-Headers @{ Authorization = "token $env:TOKEN"; "Content-Type" = "application/octet-stream" } `
|
|
||||||
-Body $bytes
|
|
||||||
}
|
|
||||||
|
|
||||||
build-linux:
|
|
||||||
needs: prepare
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: .node-version
|
|
||||||
|
|
||||||
- name: Install system deps
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y \
|
|
||||||
curl wget file \
|
|
||||||
libwebkit2gtk-4.1-dev \
|
|
||||||
libssl-dev \
|
|
||||||
libxdo-dev \
|
|
||||||
libayatana-appindicator3-dev \
|
|
||||||
librsvg2-dev \
|
|
||||||
patchelf \
|
|
||||||
xdg-utils
|
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
workspaces: src-tauri
|
|
||||||
|
|
||||||
- name: Patch version
|
|
||||||
run: python3 -c "import json; d=json.load(open('src-tauri/tauri.conf.json')); d['version']='${{ needs.prepare.outputs.version }}'; open('src-tauri/tauri.conf.json','w').write(json.dumps(d,indent=2))"
|
|
||||||
|
|
||||||
- name: Install frontend deps
|
|
||||||
run: cd cinny && npm ci
|
|
||||||
|
|
||||||
- name: Install Tauri deps
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Stage AppRun for AppImage bundler
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.cache/tauri
|
|
||||||
cp tools/AppRun-x86_64 ~/.cache/tauri/AppRun-x86_64
|
|
||||||
chmod +x ~/.cache/tauri/AppRun-x86_64
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
env:
|
|
||||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
|
||||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ''
|
|
||||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
|
||||||
run: npm run tauri -- build --bundles appimage,deb
|
|
||||||
|
|
||||||
- name: Upload to release
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
||||||
RELEASE_ID: ${{ needs.prepare.outputs.release_id }}
|
|
||||||
VERSION: ${{ needs.prepare.outputs.version }}
|
|
||||||
run: |
|
|
||||||
APPIMAGE_DIR="src-tauri/target/release/bundle/appimage"
|
|
||||||
DEB_DIR="src-tauri/target/release/bundle/deb"
|
|
||||||
|
|
||||||
upload() {
|
|
||||||
local name="$1" path="$2"
|
|
||||||
local existing_id
|
|
||||||
existing_id=$(curl -sf "$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets" \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
| python3 -c "import sys,json; assets=json.load(sys.stdin); print(next((str(a['id']) for a in assets if a['name']=='$name'), ''))" 2>/dev/null || true)
|
|
||||||
if [ -n "$existing_id" ]; then
|
|
||||||
curl -sf -X DELETE "$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets/$existing_id" \
|
|
||||||
-H "Authorization: token $TOKEN" || true
|
|
||||||
fi
|
|
||||||
echo "Uploading $name"
|
|
||||||
curl -sf -X POST \
|
|
||||||
"$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=$name" \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
-H "Content-Type: application/octet-stream" \
|
|
||||||
--data-binary @"$path"
|
|
||||||
}
|
|
||||||
|
|
||||||
upload "LotusChat-x86_64.AppImage" "$APPIMAGE_DIR/Lotus Chat_${VERSION}_amd64.AppImage"
|
|
||||||
upload "LotusChat-x86_64.AppImage.tar.gz" "$APPIMAGE_DIR/Lotus Chat_${VERSION}_amd64.AppImage.tar.gz"
|
|
||||||
upload "LotusChat-x86_64.AppImage.tar.gz.sig" "$APPIMAGE_DIR/Lotus Chat_${VERSION}_amd64.AppImage.tar.gz.sig"
|
|
||||||
upload "LotusChat-x86_64.deb" "$DEB_DIR/Lotus Chat_${VERSION}_amd64.deb"
|
|
||||||
|
|
||||||
update-manifest:
|
|
||||||
needs: [prepare, build-windows, build-linux]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Generate and upload release.json
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
||||||
RELEASE_ID: ${{ needs.prepare.outputs.release_id }}
|
|
||||||
VERSION: ${{ needs.prepare.outputs.version }}
|
|
||||||
run: |
|
|
||||||
BASE="$GITEA_URL/LotusGuild/cinny-desktop/releases/download/latest"
|
|
||||||
|
|
||||||
WIN_SIG=$(curl -sf "$BASE/LotusChat-x86_64-setup.nsis.zip.sig")
|
|
||||||
LIN_SIG=$(curl -sf "$BASE/LotusChat-x86_64.AppImage.tar.gz.sig")
|
|
||||||
DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
||||||
|
|
||||||
python3 -c "import json,sys; v,d,wu,ws,lu,ls=sys.argv[1:]; print(json.dumps({'version':v,'notes':'Latest Lotus Chat release','pub_date':d,'platforms':{'windows-x86_64':{'url':wu,'signature':ws},'linux-x86_64':{'url':lu,'signature':ls}}},indent=2))" \
|
|
||||||
"$VERSION" "$DATE" \
|
|
||||||
"$BASE/LotusChat-x86_64-setup.nsis.zip" "$WIN_SIG" \
|
|
||||||
"$BASE/LotusChat-x86_64.AppImage.tar.gz" "$LIN_SIG" \
|
|
||||||
> release.json
|
|
||||||
|
|
||||||
cat release.json
|
|
||||||
|
|
||||||
OLD=$(curl -sf "$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets" \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
| python3 -c "import sys,json; print(next((str(a['id']) for a in json.load(sys.stdin) if a['name']=='release.json'), ''))" 2>/dev/null || true)
|
|
||||||
[ -n "$OLD" ] && curl -sf -X DELETE \
|
|
||||||
"$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets/$OLD" \
|
|
||||||
-H "Authorization: token $TOKEN" || true
|
|
||||||
|
|
||||||
curl -sf -X POST \
|
|
||||||
"$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=release.json" \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
--data-binary @release.json
|
|
||||||
@@ -8,7 +8,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Create zip including submodules
|
- name: Create zip including submodules
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ jobs:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
- name: NPM Lockfile Changes
|
- name: NPM Lockfile Changes
|
||||||
uses: codepunkt/npm-lockfile-changes@b40543471c36394409466fdb277a73a0856d7891 # v1.0.0
|
uses: codepunkt/npm-lockfile-changes@b40543471c36394409466fdb277a73a0856d7891 # v1.0.0
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
@@ -60,7 +60,7 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
@@ -110,7 +110,7 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
@@ -159,7 +159,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Run release.json
|
- name: Run release.json
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
[submodule "cinny"]
|
[submodule "cinny"]
|
||||||
path = cinny
|
path = cinny
|
||||||
url = https://code.lotusguild.org/LotusGuild/cinny.git
|
url = https://github.com/cinnyapp/cinny.git
|
||||||
branch = lotus
|
|
||||||
|
|||||||
@@ -1,11 +1,29 @@
|
|||||||
{
|
{
|
||||||
"defaultHomeserver": 0,
|
"defaultHomeserver": 1,
|
||||||
"homeserverList": [
|
"homeserverList": ["converser.eu", "matrix.org", "mozilla.org", "unredacted.org", "xmr.se"],
|
||||||
"matrix.lotusguild.org",
|
|
||||||
"matrix.org",
|
|
||||||
"mozilla.org"
|
|
||||||
],
|
|
||||||
"allowCustomHomeservers": true,
|
"allowCustomHomeservers": true,
|
||||||
|
|
||||||
|
"featuredCommunities": {
|
||||||
|
"openAsDefault": false,
|
||||||
|
"spaces": [
|
||||||
|
"#cinny:matrix.org",
|
||||||
|
"#community:matrix.org",
|
||||||
|
"#space:unredacted.org",
|
||||||
|
"#librewolf-community:matrix.org",
|
||||||
|
"#stickers-and-emojis:tastytea.de",
|
||||||
|
"#videogames:waywardinn.com",
|
||||||
|
"#science-space:matrix.org",
|
||||||
|
"#libregaming-games:tchncs.de",
|
||||||
|
"#mathematics-on:matrix.org"
|
||||||
|
],
|
||||||
|
"rooms": [
|
||||||
|
"#tuwunel:grin.hu",
|
||||||
|
"#freesoftware:matrix.org",
|
||||||
|
"#gentoo:matrix.org"
|
||||||
|
],
|
||||||
|
"servers": ["matrixrooms.info", "matrix.org", "mozilla.org", "unredacted.org"]
|
||||||
|
},
|
||||||
|
|
||||||
"hashRouter": {
|
"hashRouter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"basename": "/"
|
"basename": "/"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ tauri-build = { version = "2", features = [] }
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
serde_json = "1.0.109"
|
serde_json = "1.0.109"
|
||||||
serde = { version = "1.0.193", features = ["derive"] }
|
serde = { version = "1.0.193", features = ["derive"] }
|
||||||
tauri = { version = "2", features = ["devtools", "wry"] }
|
tauri = { version = "2", features = [ "devtools"] }
|
||||||
tauri-plugin-localhost = "2"
|
tauri-plugin-localhost = "2"
|
||||||
tauri-plugin-window-state = "2"
|
tauri-plugin-window-state = "2"
|
||||||
tauri-plugin-clipboard-manager = "2"
|
tauri-plugin-clipboard-manager = "2"
|
||||||
@@ -42,9 +42,6 @@ custom-protocol = [ "tauri/custom-protocol" ]
|
|||||||
tauri-plugin-global-shortcut = "2"
|
tauri-plugin-global-shortcut = "2"
|
||||||
tauri-plugin-updater = "2"
|
tauri-plugin-updater = "2"
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
|
||||||
webview2-com = "0.38"
|
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "app_lib"
|
name = "app_lib"
|
||||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>NSCameraUsageDescription</key>
|
|
||||||
<string>Request camera access for WebRTC calls.</string>
|
|
||||||
<key>NSMicrophoneUsageDescription</key>
|
|
||||||
<string>Request microphone access for WebRTC calls.</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 15 KiB |
@@ -3,6 +3,8 @@
|
|||||||
windows_subsystem = "windows"
|
windows_subsystem = "windows"
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
// mod menu;
|
||||||
|
|
||||||
use tauri::{webview::{NewWindowResponse, WebviewWindowBuilder}, WebviewUrl};
|
use tauri::{webview::{NewWindowResponse, WebviewWindowBuilder}, WebviewUrl};
|
||||||
use tauri_plugin_opener::OpenerExt;
|
use tauri_plugin_opener::OpenerExt;
|
||||||
|
|
||||||
@@ -11,14 +13,21 @@ pub fn run() {
|
|||||||
let context = tauri::generate_context!();
|
let context = tauri::generate_context!();
|
||||||
let builder = tauri::Builder::default();
|
let builder = tauri::Builder::default();
|
||||||
|
|
||||||
|
// #[cfg(target_os = "macos")]
|
||||||
|
// {
|
||||||
|
// builder = builder.menu(menu::menu());
|
||||||
|
// }
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.plugin(tauri_plugin_localhost::Builder::new(port).build())
|
.plugin(tauri_plugin_localhost::Builder::new(port).build())
|
||||||
.plugin(tauri_plugin_window_state::Builder::default().build())
|
.plugin(tauri_plugin_window_state::Builder::default().build())
|
||||||
.plugin(tauri_plugin_opener::init())
|
.plugin(tauri_plugin_opener::init())
|
||||||
.setup(move |app| {
|
.setup(move |app| {
|
||||||
|
// Dev: use devUrl from tauri.conf.json (http://localhost:8080) to support HMR
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
let window_url = WebviewUrl::App(Default::default());
|
let window_url = WebviewUrl::App(Default::default());
|
||||||
|
|
||||||
|
// Release: tauri-plugin-localhost serves bundled frontend assets on this port
|
||||||
#[cfg(not(debug_assertions))]
|
#[cfg(not(debug_assertions))]
|
||||||
let window_url = {
|
let window_url = {
|
||||||
let url = format!("http://localhost:{}", port).parse().unwrap();
|
let url = format!("http://localhost:{}", port).parse().unwrap();
|
||||||
@@ -26,52 +35,14 @@ pub fn run() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let app_handle = app.handle().clone();
|
let app_handle = app.handle().clone();
|
||||||
let window = WebviewWindowBuilder::new(app, "main".to_string(), window_url)
|
WebviewWindowBuilder::new(app, "main".to_string(), window_url)
|
||||||
.title("Lotus Chat")
|
.title("Cinny")
|
||||||
.disable_drag_drop_handler()
|
.disable_drag_drop_handler()
|
||||||
.on_new_window(move |url, _features| {
|
.on_new_window(move |url, _features| {
|
||||||
let _ = app_handle.opener().open_url(url.as_str(), None::<&str>);
|
let _ = app_handle.opener().open_url(url.as_str(), None::<&str>);
|
||||||
NewWindowResponse::Deny
|
NewWindowResponse::Deny
|
||||||
})
|
})
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
// Grant camera and microphone to WebView2 automatically.
|
|
||||||
// Windows requires an explicit PermissionRequested COM event handler.
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
window.with_webview(|webview| {
|
|
||||||
use webview2_com::{
|
|
||||||
Microsoft::Web::WebView2::Win32::{
|
|
||||||
COREWEBVIEW2_PERMISSION_KIND,
|
|
||||||
COREWEBVIEW2_PERMISSION_KIND_CAMERA,
|
|
||||||
COREWEBVIEW2_PERMISSION_KIND_MICROPHONE,
|
|
||||||
COREWEBVIEW2_PERMISSION_STATE_ALLOW,
|
|
||||||
},
|
|
||||||
PermissionRequestedEventHandler,
|
|
||||||
};
|
|
||||||
|
|
||||||
let controller = webview.controller();
|
|
||||||
if let Ok(core) = unsafe { controller.CoreWebView2() } {
|
|
||||||
let handler = PermissionRequestedEventHandler::create(Box::new(
|
|
||||||
|_sender, args| {
|
|
||||||
if let Some(args) = args {
|
|
||||||
let mut kind = COREWEBVIEW2_PERMISSION_KIND(0);
|
|
||||||
unsafe { args.PermissionKind(&mut kind) }?;
|
|
||||||
if kind == COREWEBVIEW2_PERMISSION_KIND_MICROPHONE
|
|
||||||
|| kind == COREWEBVIEW2_PERMISSION_KIND_CAMERA
|
|
||||||
{
|
|
||||||
unsafe {
|
|
||||||
args.SetState(COREWEBVIEW2_PERMISSION_STATE_ALLOW)
|
|
||||||
}?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
},
|
|
||||||
));
|
|
||||||
let mut token = Default::default();
|
|
||||||
let _ = unsafe { core.add_PermissionRequested(&handler, &mut token) };
|
|
||||||
}
|
|
||||||
})?;
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.run(context)
|
.run(context)
|
||||||
|
|||||||
@@ -45,21 +45,21 @@
|
|||||||
"beforeDevCommand": "cd cinny && npm start",
|
"beforeDevCommand": "cd cinny && npm start",
|
||||||
"devUrl": "http://localhost:8080"
|
"devUrl": "http://localhost:8080"
|
||||||
},
|
},
|
||||||
"productName": "Lotus Chat",
|
"productName": "Cinny",
|
||||||
"mainBinaryName": "cinny",
|
"mainBinaryName": "cinny",
|
||||||
"version": "4.12.2",
|
"version": "4.12.2",
|
||||||
"identifier": "org.lotusguild.lotus-chat",
|
"identifier": "in.cinny.app",
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"updater": {
|
"updater": {
|
||||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDM1N0Y0RThCQTJEQzY1NTkKUldSWlpkeWlpMDUvTlVjejMzN0E1U0FiaVpLK05QVkRXdWlMMm1NNUprMXAvTGZSbU5maVovNmwK",
|
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE2NDc3NDBGMTAzNTk1NUYKUldSZmxUVVFEM1JIRnRuMjVRTkFOQ21lUFI5KzRMU0s4OWtBS1RNRUVCNE9LcE9GcExNZ2M2NHoK",
|
||||||
"endpoints": [
|
"endpoints": [
|
||||||
"https://code.lotusguild.org/LotusGuild/cinny-desktop/releases/download/latest/release.json"
|
"https://github.com/cinnyapp/cinny-desktop/releases/download/tauri/release.json"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"app": {
|
"app": {
|
||||||
"security": {
|
"security": {
|
||||||
"csp": "default-src 'self' blob: data: filesystem: ws: wss: http: https: tauri:; script-src 'self' 'unsafe-eval' 'unsafe-inline' blob: data: filesystem: ws: wss: http: https: tauri:; style-src 'self' 'unsafe-inline' blob: data: filesystem: http: https:; img-src 'self' data: blob: filesystem: http: https:; media-src 'self' blob: data: mediastream:; connect-src 'self' blob: ipc: ws: wss: http: https: http://ipc.localhost"
|
"csp": "default-src 'self' blob: data: filesystem: ws: wss: http: https: tauri:; script-src 'self' 'unsafe-eval' 'unsafe-inline' blob: data: filesystem: ws: wss: http: https: tauri:; style-src 'self' 'unsafe-inline' blob: data: filesystem: http: https:; img-src 'self' data: blob: filesystem: http: https:; connect-src 'self' blob: ipc: ws: wss: http: https: http://ipc.localhost"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||