Compare commits
31 Commits
latest
...
dffe5fb05a
| Author | SHA1 | Date | |
|---|---|---|---|
| dffe5fb05a | |||
| 03d7ae05e0 | |||
| 2f55bb3f6d | |||
| c151c2936c | |||
| 7c77c8e850 | |||
| 667ad72583 | |||
| 4b71e80636 | |||
| 07327845b3 | |||
| d043f9c416 | |||
| eadd3bfc48 | |||
| 26bd0722bc | |||
| 443c85c9b5 | |||
| efcc11771e | |||
| 4288eb2c02 | |||
| e009af0575 | |||
| c466d93519 | |||
| d4968b935b | |||
| f45817d4ac | |||
| a6aae9d6f2 | |||
| 838c69f46e | |||
| 0b7ace5dfa | |||
| 8f0f8db201 | |||
| ceda17edc4 | |||
| 12c860de0c | |||
| 12a559dc6d | |||
| 938fa0953b | |||
| 5f678ff088 | |||
| df39489916 | |||
| b2288bc9b2 | |||
| 0923312111 | |||
| 279117ecf2 |
@@ -0,0 +1 @@
|
|||||||
|
81e1a25de641f0292863b1404cba728c1eadd00d
|
||||||
+117
-81
@@ -10,41 +10,7 @@ env:
|
|||||||
REPO: LotusGuild/cinny-desktop
|
REPO: LotusGuild/cinny-desktop
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prepare-release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
release_id: ${{ steps.create.outputs.release_id }}
|
|
||||||
version: ${{ steps.create.outputs.version }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Create rolling latest release
|
|
||||||
id: create
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
VERSION=$(python3 -c "import json; print(json.load(open('src-tauri/tauri.conf.json'))['version'])")
|
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# Delete existing latest release+tag if present
|
|
||||||
OLD=$(curl -sf "$GITEA_URL/api/v1/repos/$REPO/releases/tags/latest" \
|
|
||||||
-H "Authorization: token $TOKEN" 2>/dev/null || true)
|
|
||||||
OLD_ID=$(echo "$OLD" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
|
|
||||||
if [ -n "$OLD_ID" ] && [ "$OLD_ID" != "None" ] && [ "$OLD_ID" != "" ]; then
|
|
||||||
curl -sf -X DELETE "$GITEA_URL/api/v1/repos/$REPO/releases/$OLD_ID" -H "Authorization: token $TOKEN" || true
|
|
||||||
curl -f -X DELETE "$GITEA_URL/api/v1/repos/$REPO/tags/latest" -H "Authorization: token $TOKEN" || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create fresh release
|
|
||||||
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'])")
|
|
||||||
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
needs: prepare-release
|
|
||||||
runs-on: windows
|
runs-on: windows
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -53,17 +19,6 @@ jobs:
|
|||||||
shell: powershell
|
shell: powershell
|
||||||
run: git submodule update --init --depth=1
|
run: git submodule update --init --depth=1
|
||||||
|
|
||||||
- name: Get version
|
|
||||||
id: version
|
|
||||||
shell: powershell
|
|
||||||
run: |
|
|
||||||
$v = (Get-Content src-tauri\tauri.conf.json | ConvertFrom-Json).version
|
|
||||||
"version=$v" >> $env:GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
workspaces: src-tauri
|
|
||||||
|
|
||||||
- name: Install frontend deps
|
- name: Install frontend deps
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: cd cinny; npm ci
|
run: cd cinny; npm ci
|
||||||
@@ -78,32 +33,48 @@ jobs:
|
|||||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ''
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ''
|
||||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
||||||
run: npm run tauri -- build
|
run: npm run tauri -- build -- --bundles nsis
|
||||||
|
|
||||||
- name: Upload to release
|
- name: Upload to release
|
||||||
shell: powershell
|
shell: powershell
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
RELEASE_ID: ${{ needs.prepare-release.outputs.release_id }}
|
|
||||||
VERSION: ${{ needs.prepare-release.outputs.version }}
|
|
||||||
run: |
|
run: |
|
||||||
$msi = "src-tauri\target\release\bundle\msi"
|
$VERSION = (Get-Content "src-tauri\tauri.conf.json" | ConvertFrom-Json).version
|
||||||
$files = @(
|
Write-Host "Version: $VERSION"
|
||||||
"$msi\Cinny_${VERSION}_x64_en-US.msi",
|
|
||||||
"$msi\Cinny_${VERSION}_x64_en-US.msi.zip",
|
$release = Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases/tags/latest" `
|
||||||
"$msi\Cinny_${VERSION}_x64_en-US.msi.zip.sig"
|
-Headers @{ Authorization = "token $env:TOKEN" } -ErrorAction SilentlyContinue
|
||||||
)
|
if (-not $release) {
|
||||||
$names = @("LotusChat-x86_64.msi", "LotusChat-x86_64.msi.zip", "LotusChat-x86_64.msi.zip.sig")
|
$release = Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases" `
|
||||||
for ($i = 0; $i -lt $files.Length; $i++) {
|
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($files[$i])
|
|
||||||
Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases/$RELEASE_ID/assets?name=$($names[$i])" `
|
|
||||||
-Method Post `
|
-Method Post `
|
||||||
-Headers @{ Authorization = "token $TOKEN"; "Content-Type" = "application/octet-stream" } `
|
-Headers @{ Authorization = "token $env:TOKEN"; "Content-Type" = "application/json" } `
|
||||||
|
-Body "{`"tag_name`":`"latest`",`"name`":`"Lotus Chat $VERSION`",`"prerelease`":true,`"body`":`"Built from ${{ github.sha }}`"}"
|
||||||
|
}
|
||||||
|
$releaseId = $release.id
|
||||||
|
|
||||||
|
$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
|
-Body $bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
needs: prepare-release
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -114,11 +85,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version-file: .node-version
|
node-version-file: .node-version
|
||||||
|
|
||||||
- name: Get version
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
echo "version=$(python3 -c "import json; print(json.load(open('src-tauri/tauri.conf.json'))['version'])")" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Install system deps
|
- name: Install system deps
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
@@ -144,32 +110,102 @@ jobs:
|
|||||||
- name: Install Tauri deps
|
- name: Install Tauri deps
|
||||||
run: npm ci
|
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
|
- name: Build
|
||||||
env:
|
env:
|
||||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ''
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ''
|
||||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
||||||
run: npm run tauri -- build
|
run: npm run tauri -- build --bundles appimage,deb
|
||||||
|
|
||||||
- name: Upload to release
|
- name: Upload to release
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
RELEASE_ID: ${{ needs.prepare-release.outputs.release_id }}
|
|
||||||
VERSION: ${{ steps.version.outputs.version }}
|
|
||||||
run: |
|
run: |
|
||||||
deb="src-tauri/target/release/bundle/deb/Cinny_${VERSION}_amd64.deb"
|
VERSION=$(python3 -c "import json; print(json.load(open('src-tauri/tauri.conf.json'))['version'])")
|
||||||
appimage="src-tauri/target/release/bundle/appimage/Cinny_${VERSION}_amd64.AppImage"
|
echo "Version: $VERSION"
|
||||||
declare -A uploads=(
|
|
||||||
["LotusChat-x86_64.deb"]="$deb"
|
APPIMAGE_DIR="src-tauri/target/release/bundle/appimage"
|
||||||
["LotusChat-x86_64.AppImage"]="$appimage"
|
DEB_DIR="src-tauri/target/release/bundle/deb"
|
||||||
["LotusChat-x86_64.AppImage.tar.gz"]="${appimage}.tar.gz"
|
|
||||||
["LotusChat-x86_64.AppImage.tar.gz.sig"]="${appimage}.tar.gz.sig"
|
RELEASE=$(curl -sf "$GITEA_URL/api/v1/repos/$REPO/releases/tags/latest" \
|
||||||
)
|
-H "Authorization: token $TOKEN" 2>/dev/null || true)
|
||||||
for name in "${!uploads[@]}"; do
|
RELEASE_ID=$(echo "$RELEASE" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
|
||||||
|
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "None" ]; then
|
||||||
|
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
|
||||||
|
|
||||||
|
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"
|
echo "Uploading $name"
|
||||||
curl -sf -X POST \
|
curl -sf -X POST \
|
||||||
"$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=$name" \
|
"$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=$name" \
|
||||||
-H "Authorization: token $TOKEN" \
|
-H "Authorization: token $TOKEN" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
--data-binary @"${uploads[$name]}"
|
--data-binary @"$path"
|
||||||
done
|
}
|
||||||
|
|
||||||
|
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: [build-windows, build-linux]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GITEA_URL: https://code.lotusguild.org
|
||||||
|
REPO: LotusGuild/cinny-desktop
|
||||||
|
steps:
|
||||||
|
- name: Generate and upload release.json
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
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")
|
||||||
|
|
||||||
|
RELEASE=$(curl -sf "$GITEA_URL/api/v1/repos/$REPO/releases/tags/latest" \
|
||||||
|
-H "Authorization: token $TOKEN")
|
||||||
|
RELEASE_ID=$(echo "$RELEASE" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
||||||
|
VERSION=$(echo "$RELEASE" | python3 -c "import sys,json; print(json.load(sys.stdin)['name'].split()[-1])")
|
||||||
|
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
|
||||||
|
|||||||
+1
-1
Submodule cinny updated: 71386f4ef2...5469740f4c
+6
-24
@@ -1,29 +1,11 @@
|
|||||||
{
|
{
|
||||||
"defaultHomeserver": 1,
|
"defaultHomeserver": 0,
|
||||||
"homeserverList": ["converser.eu", "matrix.org", "mozilla.org", "unredacted.org", "xmr.se"],
|
"homeserverList": [
|
||||||
|
"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"] }
|
tauri = { version = "2", features = ["devtools", "wry"] }
|
||||||
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,6 +42,9 @@ 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"]
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?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>
|
||||||
+39
-10
@@ -3,8 +3,6 @@
|
|||||||
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;
|
||||||
|
|
||||||
@@ -13,21 +11,14 @@ 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();
|
||||||
@@ -35,7 +26,7 @@ pub fn run() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let app_handle = app.handle().clone();
|
let app_handle = app.handle().clone();
|
||||||
WebviewWindowBuilder::new(app, "main".to_string(), window_url)
|
let window = WebviewWindowBuilder::new(app, "main".to_string(), window_url)
|
||||||
.title("Cinny")
|
.title("Cinny")
|
||||||
.disable_drag_drop_handler()
|
.disable_drag_drop_handler()
|
||||||
.on_new_window(move |url, _features| {
|
.on_new_window(move |url, _features| {
|
||||||
@@ -43,6 +34,44 @@ pub fn run() {
|
|||||||
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": "Cinny",
|
"productName": "Lotus Chat",
|
||||||
"mainBinaryName": "cinny",
|
"mainBinaryName": "cinny",
|
||||||
"version": "4.12.2",
|
"version": "4.12.2",
|
||||||
"identifier": "in.cinny.app",
|
"identifier": "org.lotusguild.lotus-chat",
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"updater": {
|
"updater": {
|
||||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE2NDc3NDBGMTAzNTk1NUYKUldSZmxUVVFEM1JIRnRuMjVRTkFOQ21lUFI5KzRMU0s4OWtBS1RNRUVCNE9LcE9GcExNZ2M2NHoK",
|
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDM1N0Y0RThCQTJEQzY1NTkKUldSWlpkeWlpMDUvTlVjejMzN0E1U0FiaVpLK05QVkRXdWlMMm1NNUprMXAvTGZSbU5maVovNmwK",
|
||||||
"endpoints": [
|
"endpoints": [
|
||||||
"https://github.com/cinnyapp/cinny-desktop/releases/download/tauri/release.json"
|
"https://code.lotusguild.org/LotusGuild/cinny-desktop/releases/download/latest/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:; 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:; media-src 'self' blob: data: mediastream:; connect-src 'self' blob: ipc: ws: wss: http: https: http://ipc.localhost"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Executable
BIN
Binary file not shown.
Reference in New Issue
Block a user