Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f0100c0c0c | |||
| ed718704ee | |||
| 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 | |||
| adb017804d | |||
| 0e700b335a | |||
| a7b93deb98 | |||
| 99fb77b867 | |||
| 6f543f8bef | |||
| 473028491c | |||
| a598ba6049 | |||
| a7ced9d477 | |||
| 646da8276a | |||
| af9ad2eb6f |
@@ -0,0 +1 @@
|
|||||||
|
81e1a25de641f0292863b1404cba728c1eadd00d
|
||||||
@@ -0,0 +1,232 @@
|
|||||||
|
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
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
[submodule "cinny"]
|
[submodule "cinny"]
|
||||||
path = cinny
|
path = cinny
|
||||||
url = https://github.com/cinnyapp/cinny.git
|
url = https://code.lotusguild.org/LotusGuild/cinny.git
|
||||||
|
branch = lotus
|
||||||
|
|||||||
@@ -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>
|
||||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 138 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 134 KiB |
@@ -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,14 +26,52 @@ 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("Lotus Chat")
|
||||||
.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": "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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||