Compare commits
33 Commits
latest
...
f0100c0c0c
| 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 |
@@ -0,0 +1 @@
|
||||
81e1a25de641f0292863b1404cba728c1eadd00d
|
||||
@@ -10,59 +10,56 @@ env:
|
||||
REPO: LotusGuild/cinny-desktop
|
||||
|
||||
jobs:
|
||||
prepare-release:
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
release_id: ${{ steps.create.outputs.release_id }}
|
||||
version: ${{ steps.create.outputs.version }}
|
||||
version: ${{ steps.ver.outputs.version }}
|
||||
release_id: ${{ steps.release.outputs.release_id }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Compute version
|
||||
id: ver
|
||||
run: echo "version=4.12.${{ github.run_number }}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create rolling latest release
|
||||
id: create
|
||||
- name: Create or update release
|
||||
id: release
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TOKEN: ${{ secrets.RELEASE_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" \
|
||||
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)
|
||||
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
|
||||
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
|
||||
|
||||
# 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:
|
||||
needs: prepare-release
|
||||
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: Get version
|
||||
id: version
|
||||
- name: Patch 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
|
||||
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
|
||||
@@ -78,32 +75,42 @@ jobs:
|
||||
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
|
||||
run: npm run tauri -- build --bundles nsis
|
||||
|
||||
- name: Upload to release
|
||||
shell: powershell
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RELEASE_ID: ${{ needs.prepare-release.outputs.release_id }}
|
||||
VERSION: ${{ needs.prepare-release.outputs.version }}
|
||||
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
RELEASE_ID: ${{ needs.prepare.outputs.release_id }}
|
||||
VERSION: ${{ needs.prepare.outputs.version }}
|
||||
run: |
|
||||
$msi = "src-tauri\target\release\bundle\msi"
|
||||
$releaseId = $env:RELEASE_ID
|
||||
$VERSION = $env:VERSION
|
||||
Write-Host "Version: $VERSION Release: $releaseId"
|
||||
|
||||
$nsis = "src-tauri\target\release\bundle\nsis"
|
||||
$files = @(
|
||||
"$msi\Cinny_${VERSION}_x64_en-US.msi",
|
||||
"$msi\Cinny_${VERSION}_x64_en-US.msi.zip",
|
||||
"$msi\Cinny_${VERSION}_x64_en-US.msi.zip.sig"
|
||||
"$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.msi", "LotusChat-x86_64.msi.zip", "LotusChat-x86_64.msi.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/$RELEASE_ID/assets?name=$($names[$i])" `
|
||||
Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases/$releaseId/assets?name=$($names[$i])" `
|
||||
-Method Post `
|
||||
-Headers @{ Authorization = "token $TOKEN"; "Content-Type" = "application/octet-stream" } `
|
||||
-Headers @{ Authorization = "token $env:TOKEN"; "Content-Type" = "application/octet-stream" } `
|
||||
-Body $bytes
|
||||
}
|
||||
|
||||
build-linux:
|
||||
needs: prepare-release
|
||||
needs: prepare
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -114,11 +121,6 @@ jobs:
|
||||
with:
|
||||
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
|
||||
run: |
|
||||
apt-get update
|
||||
@@ -138,38 +140,93 @@ jobs:
|
||||
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
|
||||
run: npm run tauri -- build --bundles appimage,deb
|
||||
|
||||
- name: Upload to release
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RELEASE_ID: ${{ needs.prepare-release.outputs.release_id }}
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
RELEASE_ID: ${{ needs.prepare.outputs.release_id }}
|
||||
VERSION: ${{ needs.prepare.outputs.version }}
|
||||
run: |
|
||||
deb="src-tauri/target/release/bundle/deb/Cinny_${VERSION}_amd64.deb"
|
||||
appimage="src-tauri/target/release/bundle/appimage/Cinny_${VERSION}_amd64.AppImage"
|
||||
declare -A uploads=(
|
||||
["LotusChat-x86_64.deb"]="$deb"
|
||||
["LotusChat-x86_64.AppImage"]="$appimage"
|
||||
["LotusChat-x86_64.AppImage.tar.gz"]="${appimage}.tar.gz"
|
||||
["LotusChat-x86_64.AppImage.tar.gz.sig"]="${appimage}.tar.gz.sig"
|
||||
)
|
||||
for name in "${!uploads[@]}"; do
|
||||
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 @"${uploads[$name]}"
|
||||
done
|
||||
--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,29 +1,11 @@
|
||||
{
|
||||
"defaultHomeserver": 1,
|
||||
"homeserverList": ["converser.eu", "matrix.org", "mozilla.org", "unredacted.org", "xmr.se"],
|
||||
"defaultHomeserver": 0,
|
||||
"homeserverList": [
|
||||
"matrix.lotusguild.org",
|
||||
"matrix.org",
|
||||
"mozilla.org"
|
||||
],
|
||||
"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": {
|
||||
"enabled": true,
|
||||
"basename": "/"
|
||||
|
||||
@@ -17,7 +17,7 @@ tauri-build = { version = "2", features = [] }
|
||||
[dependencies]
|
||||
serde_json = "1.0.109"
|
||||
serde = { version = "1.0.193", features = ["derive"] }
|
||||
tauri = { version = "2", features = [ "devtools"] }
|
||||
tauri = { version = "2", features = ["devtools", "wry"] }
|
||||
tauri-plugin-localhost = "2"
|
||||
tauri-plugin-window-state = "2"
|
||||
tauri-plugin-clipboard-manager = "2"
|
||||
@@ -42,6 +42,9 @@ custom-protocol = [ "tauri/custom-protocol" ]
|
||||
tauri-plugin-global-shortcut = "2"
|
||||
tauri-plugin-updater = "2"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
webview2-com = "0.38"
|
||||
|
||||
[lib]
|
||||
name = "app_lib"
|
||||
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"
|
||||
)]
|
||||
|
||||
// mod menu;
|
||||
|
||||
use tauri::{webview::{NewWindowResponse, WebviewWindowBuilder}, WebviewUrl};
|
||||
use tauri_plugin_opener::OpenerExt;
|
||||
|
||||
@@ -13,21 +11,14 @@ pub fn run() {
|
||||
let context = tauri::generate_context!();
|
||||
let builder = tauri::Builder::default();
|
||||
|
||||
// #[cfg(target_os = "macos")]
|
||||
// {
|
||||
// builder = builder.menu(menu::menu());
|
||||
// }
|
||||
|
||||
builder
|
||||
.plugin(tauri_plugin_localhost::Builder::new(port).build())
|
||||
.plugin(tauri_plugin_window_state::Builder::default().build())
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.setup(move |app| {
|
||||
// Dev: use devUrl from tauri.conf.json (http://localhost:8080) to support HMR
|
||||
#[cfg(debug_assertions)]
|
||||
let window_url = WebviewUrl::App(Default::default());
|
||||
|
||||
// Release: tauri-plugin-localhost serves bundled frontend assets on this port
|
||||
#[cfg(not(debug_assertions))]
|
||||
let window_url = {
|
||||
let url = format!("http://localhost:{}", port).parse().unwrap();
|
||||
@@ -35,14 +26,52 @@ pub fn run() {
|
||||
};
|
||||
|
||||
let app_handle = app.handle().clone();
|
||||
WebviewWindowBuilder::new(app, "main".to_string(), window_url)
|
||||
.title("Cinny")
|
||||
let window = WebviewWindowBuilder::new(app, "main".to_string(), window_url)
|
||||
.title("Lotus Chat")
|
||||
.disable_drag_drop_handler()
|
||||
.on_new_window(move |url, _features| {
|
||||
let _ = app_handle.opener().open_url(url.as_str(), None::<&str>);
|
||||
NewWindowResponse::Deny
|
||||
})
|
||||
.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(())
|
||||
})
|
||||
.run(context)
|
||||
|
||||
@@ -45,21 +45,21 @@
|
||||
"beforeDevCommand": "cd cinny && npm start",
|
||||
"devUrl": "http://localhost:8080"
|
||||
},
|
||||
"productName": "Cinny",
|
||||
"productName": "Lotus Chat",
|
||||
"mainBinaryName": "cinny",
|
||||
"version": "4.12.2",
|
||||
"identifier": "in.cinny.app",
|
||||
"identifier": "org.lotusguild.lotus-chat",
|
||||
"plugins": {
|
||||
"updater": {
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE2NDc3NDBGMTAzNTk1NUYKUldSZmxUVVFEM1JIRnRuMjVRTkFOQ21lUFI5KzRMU0s4OWtBS1RNRUVCNE9LcE9GcExNZ2M2NHoK",
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDM1N0Y0RThCQTJEQzY1NTkKUldSWlpkeWlpMDUvTlVjejMzN0E1U0FiaVpLK05QVkRXdWlMMm1NNUprMXAvTGZSbU5maVovNmwK",
|
||||
"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": {
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||