diff --git a/backend/database.js b/backend/database.js index 7456706..d52f552 100644 --- a/backend/database.js +++ b/backend/database.js @@ -2750,6 +2750,62 @@ const DeviceSessionDB = { `).all(Math.floor(uid), safeLimit); }, + listActiveByDevice(userId, options = {}) { + const uid = Number(userId); + if (!Number.isFinite(uid) || uid <= 0) return []; + + const clientType = this._normalizeClientType(options.clientType); + const deviceId = this._normalizeText(options.deviceId, 128); + const deviceName = this._normalizeText(options.deviceName, 120); + const platform = this._normalizeText(options.platform, 80); + const safeLimit = Math.max(1, Math.min(50, Math.floor(Number(options.limit) || 20))); + + if (deviceId) { + return db.prepare(` + SELECT * + FROM user_device_sessions + WHERE user_id = ? + AND client_type = ? + AND device_id = ? + AND revoked_at IS NULL + AND expires_at > datetime('now', 'localtime') + ORDER BY datetime(COALESCE(last_active_at, created_at)) DESC, created_at DESC + LIMIT ? + `).all(Math.floor(uid), clientType, deviceId, safeLimit); + } + + if (clientType !== 'desktop') { + return []; + } + + const extraConditions = []; + const params = [Math.floor(uid), clientType]; + if (deviceName) { + extraConditions.push("COALESCE(device_name, '') = ?"); + params.push(deviceName); + } + if (platform) { + extraConditions.push("COALESCE(platform, '') = ?"); + params.push(platform); + } + if (extraConditions.length === 0) { + return []; + } + + params.push(safeLimit); + return db.prepare(` + SELECT * + FROM user_device_sessions + WHERE user_id = ? + AND client_type = ? + AND ${extraConditions.join(' AND ')} + AND revoked_at IS NULL + AND expires_at > datetime('now', 'localtime') + ORDER BY datetime(COALESCE(last_active_at, created_at)) DESC, created_at DESC + LIMIT ? + `).all(...params); + }, + touch(sessionId, options = {}) { const sid = this._normalizeSessionId(sessionId); if (!sid) return { changes: 0 }; diff --git a/backend/server.js b/backend/server.js index 5e7f767..6854709 100644 --- a/backend/server.js +++ b/backend/server.js @@ -112,11 +112,11 @@ const DOWNLOAD_SIGNED_URL_EXPIRES_SECONDS = Math.max( 10, Math.min(3600, Number(process.env.DOWNLOAD_SIGNED_URL_EXPIRES_SECONDS || 30)) ); -const DEFAULT_DESKTOP_VERSION = process.env.DESKTOP_LATEST_VERSION || '0.1.8'; +const DEFAULT_DESKTOP_VERSION = process.env.DESKTOP_LATEST_VERSION || '0.1.9'; const DEFAULT_DESKTOP_INSTALLER_URL = process.env.DESKTOP_INSTALLER_URL || ''; const DEFAULT_DESKTOP_RELEASE_NOTES = process.env.DESKTOP_RELEASE_NOTES || ''; const DESKTOP_INSTALLERS_DIR = path.resolve(__dirname, '../frontend/downloads'); -const DESKTOP_INSTALLER_FILE_PATTERN = /^wanwan-cloud-desktop_.*_x64-setup\.exe$/i; +const DESKTOP_INSTALLER_FILE_PATTERN = /^(wanwan-cloud-desktop|玩玩云)_.*_x64-setup\.exe$/i; const RESUMABLE_UPLOAD_SESSION_TTL_MS = Number(process.env.RESUMABLE_UPLOAD_SESSION_TTL_MS || (24 * 60 * 60 * 1000)); // 24小时 const RESUMABLE_UPLOAD_CHUNK_SIZE_BYTES = Number(process.env.RESUMABLE_UPLOAD_CHUNK_SIZE_BYTES || (4 * 1024 * 1024)); // 4MB const RESUMABLE_UPLOAD_MAX_CHUNK_SIZE_BYTES = Number(process.env.RESUMABLE_UPLOAD_MAX_CHUNK_SIZE_BYTES || (32 * 1024 * 1024)); // 32MB @@ -2931,7 +2931,7 @@ function resolveClientType(clientType, userAgent = '') { const normalized = normalizeClientType(clientType); if (normalized) return normalized; const ua = String(userAgent || '').toLowerCase(); - if (ua.includes('tauri') || ua.includes('electron') || ua.includes('wanwan-cloud-desktop')) { + if (ua.includes('tauri') || ua.includes('electron') || ua.includes('wanwan-cloud-desktop') || ua.includes('玩玩云')) { return 'desktop'; } return detectDeviceTypeFromUserAgent(ua) === 'mobile' ? 'mobile' : 'web'; @@ -2987,6 +2987,46 @@ function formatOnlineDeviceRecord(row, currentSessionId = '') { }; } +function buildDeviceDedupKey(row = {}) { + const sessionId = String(row?.session_id || '').trim(); + const clientType = String(row?.client_type || 'web').trim().toLowerCase() || 'web'; + const deviceId = String(row?.device_id || '').trim(); + if (deviceId) { + return `${clientType}:id:${deviceId}`; + } + + if (clientType === 'desktop') { + const deviceName = String(row?.device_name || '').trim().toLowerCase(); + const platform = String(row?.platform || '').trim().toLowerCase(); + return `${clientType}:fallback:${deviceName}|${platform}`; + } + + return `session:${sessionId}`; +} + +function dedupeOnlineDeviceRows(rows = [], currentSessionId = '') { + if (!Array.isArray(rows) || rows.length <= 1) return Array.isArray(rows) ? rows : []; + const currentSid = String(currentSessionId || '').trim(); + const deduped = new Map(); + for (const row of rows) { + const key = buildDeviceDedupKey(row); + const sid = String(row?.session_id || '').trim(); + if (!deduped.has(key)) { + deduped.set(key, row); + continue; + } + + const currentPicked = deduped.get(key); + const pickedSid = String(currentPicked?.session_id || '').trim(); + const incomingIsCurrent = !!currentSid && sid === currentSid; + const pickedIsCurrent = !!currentSid && pickedSid === currentSid; + if (incomingIsCurrent && !pickedIsCurrent) { + deduped.set(key, row); + } + } + return Array.from(deduped.values()); +} + function normalizeTimeHHmm(value) { if (typeof value !== 'string') return null; const trimmed = value.trim(); @@ -4228,8 +4268,35 @@ app.post('/api/login', }); let sessionId = null; try { + let reusedSessionId = ''; + const shouldReuseDeviceSession = Boolean(deviceContext.deviceId) || deviceContext.clientType === 'desktop'; + if (shouldReuseDeviceSession) { + const matchedDeviceSessions = DeviceSessionDB.listActiveByDevice(user.id, { + clientType: deviceContext.clientType, + deviceId: deviceContext.deviceId, + deviceName: deviceContext.deviceName, + platform: deviceContext.platform, + limit: 20 + }); + if (matchedDeviceSessions.length > 0) { + reusedSessionId = String(matchedDeviceSessions[0]?.session_id || '').trim(); + let revokedCount = 0; + for (const matched of matchedDeviceSessions) { + const duplicateSid = String(matched?.session_id || '').trim(); + if (!duplicateSid || duplicateSid === reusedSessionId) continue; + const revokeResult = DeviceSessionDB.revoke(duplicateSid, user.id, 'dedupe_login_same_device'); + if (Number(revokeResult?.changes || 0) > 0) { + revokedCount += 1; + } + } + if (revokedCount > 0) { + console.log(`[在线设备] 登录会话去重 user=${user.id}, revoked=${revokedCount}`); + } + } + } + const createdSession = DeviceSessionDB.create({ - sessionId: crypto.randomBytes(24).toString('hex'), + sessionId: reusedSessionId || crypto.randomBytes(24).toString('hex'), userId: user.id, clientType: deviceContext.clientType, deviceId: deviceContext.deviceId, @@ -4426,9 +4493,9 @@ app.get('/api/user/profile', authMiddleware, (req, res) => { app.get('/api/user/online-devices', authMiddleware, (req, res) => { try { const currentSessionId = String(req.authSessionId || '').trim(); - const devices = DeviceSessionDB - .listActiveByUser(req.user.id, 80) - .map((row) => formatOnlineDeviceRecord(row, currentSessionId)); + const rawRows = DeviceSessionDB.listActiveByUser(req.user.id, 80); + const dedupedRows = dedupeOnlineDeviceRows(rawRows, currentSessionId); + const devices = dedupedRows.map((row) => formatOnlineDeviceRecord(row, currentSessionId)); res.json({ success: true, diff --git a/desktop-client/package.json b/desktop-client/package.json index de2f252..66f1ead 100644 --- a/desktop-client/package.json +++ b/desktop-client/package.json @@ -1,7 +1,7 @@ { "name": "desktop-client", "private": true, - "version": "0.1.8", + "version": "0.1.9", "type": "module", "scripts": { "dev": "vite", diff --git a/desktop-client/src-tauri/Cargo.lock b/desktop-client/src-tauri/Cargo.lock index 7d2ff6a..28bd726 100644 --- a/desktop-client/src-tauri/Cargo.lock +++ b/desktop-client/src-tauri/Cargo.lock @@ -693,7 +693,7 @@ dependencies = [ [[package]] name = "desktop-client" -version = "0.1.8" +version = "0.1.9" dependencies = [ "reqwest 0.12.28", "rusqlite", diff --git a/desktop-client/src-tauri/Cargo.toml b/desktop-client/src-tauri/Cargo.toml index acbaa79..9e28f9f 100644 --- a/desktop-client/src-tauri/Cargo.toml +++ b/desktop-client/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "desktop-client" -version = "0.1.8" +version = "0.1.9" description = "A Tauri App" authors = ["you"] edition = "2021" diff --git a/desktop-client/src-tauri/icons/128x128.png b/desktop-client/src-tauri/icons/128x128.png index 6be5e50..1cfe585 100644 Binary files a/desktop-client/src-tauri/icons/128x128.png and b/desktop-client/src-tauri/icons/128x128.png differ diff --git a/desktop-client/src-tauri/icons/128x128@2x.png b/desktop-client/src-tauri/icons/128x128@2x.png index e81bece..a1f2d50 100644 Binary files a/desktop-client/src-tauri/icons/128x128@2x.png and b/desktop-client/src-tauri/icons/128x128@2x.png differ diff --git a/desktop-client/src-tauri/icons/32x32.png b/desktop-client/src-tauri/icons/32x32.png index a437dd5..9055e56 100644 Binary files a/desktop-client/src-tauri/icons/32x32.png and b/desktop-client/src-tauri/icons/32x32.png differ diff --git a/desktop-client/src-tauri/icons/64x64.png b/desktop-client/src-tauri/icons/64x64.png new file mode 100644 index 0000000..b4441ee Binary files /dev/null and b/desktop-client/src-tauri/icons/64x64.png differ diff --git a/desktop-client/src-tauri/icons/Square107x107Logo.png b/desktop-client/src-tauri/icons/Square107x107Logo.png index 0ca4f27..9a0d7dd 100644 Binary files a/desktop-client/src-tauri/icons/Square107x107Logo.png and b/desktop-client/src-tauri/icons/Square107x107Logo.png differ diff --git a/desktop-client/src-tauri/icons/Square142x142Logo.png b/desktop-client/src-tauri/icons/Square142x142Logo.png index b81f820..5fb2ede 100644 Binary files a/desktop-client/src-tauri/icons/Square142x142Logo.png and b/desktop-client/src-tauri/icons/Square142x142Logo.png differ diff --git a/desktop-client/src-tauri/icons/Square150x150Logo.png b/desktop-client/src-tauri/icons/Square150x150Logo.png index 624c7bf..938ed44 100644 Binary files a/desktop-client/src-tauri/icons/Square150x150Logo.png and b/desktop-client/src-tauri/icons/Square150x150Logo.png differ diff --git a/desktop-client/src-tauri/icons/Square284x284Logo.png b/desktop-client/src-tauri/icons/Square284x284Logo.png index c021d2b..fdfccce 100644 Binary files a/desktop-client/src-tauri/icons/Square284x284Logo.png and b/desktop-client/src-tauri/icons/Square284x284Logo.png differ diff --git a/desktop-client/src-tauri/icons/Square30x30Logo.png b/desktop-client/src-tauri/icons/Square30x30Logo.png index 6219700..2b39582 100644 Binary files a/desktop-client/src-tauri/icons/Square30x30Logo.png and b/desktop-client/src-tauri/icons/Square30x30Logo.png differ diff --git a/desktop-client/src-tauri/icons/Square310x310Logo.png b/desktop-client/src-tauri/icons/Square310x310Logo.png index f9bc048..32b6873 100644 Binary files a/desktop-client/src-tauri/icons/Square310x310Logo.png and b/desktop-client/src-tauri/icons/Square310x310Logo.png differ diff --git a/desktop-client/src-tauri/icons/Square44x44Logo.png b/desktop-client/src-tauri/icons/Square44x44Logo.png index d5fbfb2..d67534e 100644 Binary files a/desktop-client/src-tauri/icons/Square44x44Logo.png and b/desktop-client/src-tauri/icons/Square44x44Logo.png differ diff --git a/desktop-client/src-tauri/icons/Square71x71Logo.png b/desktop-client/src-tauri/icons/Square71x71Logo.png index 63440d7..c1b5141 100644 Binary files a/desktop-client/src-tauri/icons/Square71x71Logo.png and b/desktop-client/src-tauri/icons/Square71x71Logo.png differ diff --git a/desktop-client/src-tauri/icons/Square89x89Logo.png b/desktop-client/src-tauri/icons/Square89x89Logo.png index f3f705a..a6e6eab 100644 Binary files a/desktop-client/src-tauri/icons/Square89x89Logo.png and b/desktop-client/src-tauri/icons/Square89x89Logo.png differ diff --git a/desktop-client/src-tauri/icons/StoreLogo.png b/desktop-client/src-tauri/icons/StoreLogo.png index 4556388..0cd7aa1 100644 Binary files a/desktop-client/src-tauri/icons/StoreLogo.png and b/desktop-client/src-tauri/icons/StoreLogo.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-anydpi-v26/ic_launcher.xml b/desktop-client/src-tauri/icons/android/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..2ffbf24 --- /dev/null +++ b/desktop-client/src-tauri/icons/android/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/desktop-client/src-tauri/icons/android/mipmap-hdpi/ic_launcher.png b/desktop-client/src-tauri/icons/android/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a82ce99 Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-hdpi/ic_launcher.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png b/desktop-client/src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..5cd55f3 Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png b/desktop-client/src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..10f529b Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-mdpi/ic_launcher.png b/desktop-client/src-tauri/icons/android/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..dc8aa56 Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-mdpi/ic_launcher.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png b/desktop-client/src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..037679a Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png b/desktop-client/src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..3391c73 Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png b/desktop-client/src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..299112f Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png b/desktop-client/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..6d574ba Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png b/desktop-client/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..138eb1f Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png b/desktop-client/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..37cb3f5 Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png b/desktop-client/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..83d36ca Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png b/desktop-client/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..94f6c3c Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png b/desktop-client/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..3916a84 Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png b/desktop-client/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..f0d8e47 Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/desktop-client/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png b/desktop-client/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..2176d71 Binary files /dev/null and b/desktop-client/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/desktop-client/src-tauri/icons/android/values/ic_launcher_background.xml b/desktop-client/src-tauri/icons/android/values/ic_launcher_background.xml new file mode 100644 index 0000000..ea9c223 --- /dev/null +++ b/desktop-client/src-tauri/icons/android/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #fff + \ No newline at end of file diff --git a/desktop-client/src-tauri/icons/icon.icns b/desktop-client/src-tauri/icons/icon.icns index 12a5bce..0effa7e 100644 Binary files a/desktop-client/src-tauri/icons/icon.icns and b/desktop-client/src-tauri/icons/icon.icns differ diff --git a/desktop-client/src-tauri/icons/icon.ico b/desktop-client/src-tauri/icons/icon.ico index b3636e4..ddf3796 100644 Binary files a/desktop-client/src-tauri/icons/icon.ico and b/desktop-client/src-tauri/icons/icon.ico differ diff --git a/desktop-client/src-tauri/icons/icon.png b/desktop-client/src-tauri/icons/icon.png index e1cd261..0fff248 100644 Binary files a/desktop-client/src-tauri/icons/icon.png and b/desktop-client/src-tauri/icons/icon.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-20x20@1x.png b/desktop-client/src-tauri/icons/ios/AppIcon-20x20@1x.png new file mode 100644 index 0000000..35e06f6 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-20x20@1x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-20x20@2x-1.png b/desktop-client/src-tauri/icons/ios/AppIcon-20x20@2x-1.png new file mode 100644 index 0000000..41861f9 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-20x20@2x-1.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-20x20@2x.png b/desktop-client/src-tauri/icons/ios/AppIcon-20x20@2x.png new file mode 100644 index 0000000..41861f9 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-20x20@2x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-20x20@3x.png b/desktop-client/src-tauri/icons/ios/AppIcon-20x20@3x.png new file mode 100644 index 0000000..a742ffd Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-20x20@3x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-29x29@1x.png b/desktop-client/src-tauri/icons/ios/AppIcon-29x29@1x.png new file mode 100644 index 0000000..821dcb2 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-29x29@1x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-29x29@2x-1.png b/desktop-client/src-tauri/icons/ios/AppIcon-29x29@2x-1.png new file mode 100644 index 0000000..b066b03 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-29x29@2x-1.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-29x29@2x.png b/desktop-client/src-tauri/icons/ios/AppIcon-29x29@2x.png new file mode 100644 index 0000000..b066b03 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-29x29@2x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-29x29@3x.png b/desktop-client/src-tauri/icons/ios/AppIcon-29x29@3x.png new file mode 100644 index 0000000..85cb0c1 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-29x29@3x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-40x40@1x.png b/desktop-client/src-tauri/icons/ios/AppIcon-40x40@1x.png new file mode 100644 index 0000000..41861f9 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-40x40@1x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-40x40@2x-1.png b/desktop-client/src-tauri/icons/ios/AppIcon-40x40@2x-1.png new file mode 100644 index 0000000..3d99d59 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-40x40@2x-1.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-40x40@2x.png b/desktop-client/src-tauri/icons/ios/AppIcon-40x40@2x.png new file mode 100644 index 0000000..3d99d59 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-40x40@2x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-40x40@3x.png b/desktop-client/src-tauri/icons/ios/AppIcon-40x40@3x.png new file mode 100644 index 0000000..e648d58 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-40x40@3x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-512@2x.png b/desktop-client/src-tauri/icons/ios/AppIcon-512@2x.png new file mode 100644 index 0000000..6a6770a Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-512@2x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-60x60@2x.png b/desktop-client/src-tauri/icons/ios/AppIcon-60x60@2x.png new file mode 100644 index 0000000..e648d58 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-60x60@2x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-60x60@3x.png b/desktop-client/src-tauri/icons/ios/AppIcon-60x60@3x.png new file mode 100644 index 0000000..09cc291 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-60x60@3x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-76x76@1x.png b/desktop-client/src-tauri/icons/ios/AppIcon-76x76@1x.png new file mode 100644 index 0000000..dfcf0b6 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-76x76@1x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-76x76@2x.png b/desktop-client/src-tauri/icons/ios/AppIcon-76x76@2x.png new file mode 100644 index 0000000..c9e0045 Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-76x76@2x.png differ diff --git a/desktop-client/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png b/desktop-client/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png new file mode 100644 index 0000000..372c80b Binary files /dev/null and b/desktop-client/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png differ diff --git a/desktop-client/src-tauri/icons/wanwan-dog-source.png b/desktop-client/src-tauri/icons/wanwan-dog-source.png new file mode 100644 index 0000000..888c281 Binary files /dev/null and b/desktop-client/src-tauri/icons/wanwan-dog-source.png differ diff --git a/desktop-client/src-tauri/src/lib.rs b/desktop-client/src-tauri/src/lib.rs index 5bf5616..2fdf89d 100644 --- a/desktop-client/src-tauri/src/lib.rs +++ b/desktop-client/src-tauri/src/lib.rs @@ -7,11 +7,16 @@ use std::env; use std::fs; use std::io::Write; use std::io::{Read, Seek, SeekFrom}; +#[cfg(target_os = "windows")] +use std::os::windows::process::CommandExt; use std::path::{Path, PathBuf}; use std::process::Command; use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; use tauri::Emitter; +#[cfg(target_os = "windows")] +const CREATE_NO_WINDOW: u32 = 0x08000000; + struct ApiState { client: reqwest::Client, } @@ -1122,21 +1127,25 @@ fn api_silent_install_and_restart(installer_path: String) -> Resultnul\r\n\ start \"\" /wait \"%INSTALLER%\" /S\r\n\ -start \"\" \"%APP_EXE%\"\r\n\ +if exist \"%APP_EXE%\" start \"\" \"%APP_EXE%\"\r\n\ del \"%~f0\" >nul 2>nul\r\n", installer = installer_text, app_exe = app_text ); fs::write(&script_path, script_content).map_err(|err| format!("写入更新脚本失败: {}", err))?; - let script_arg = script_path.to_string_lossy().to_string(); - Command::new("cmd") - .args(["/C", "start", "", "/min", &script_arg]) + let script_arg = format!("\"{}\"", script_path.to_string_lossy().replace('\"', "\"\"")); + let mut updater_cmd = Command::new("cmd"); + updater_cmd + .args(["/D", "/C", &script_arg]) + .current_dir(&temp_dir) + .creation_flags(CREATE_NO_WINDOW) .spawn() .map_err(|err| format!("启动静默更新流程失败: {}", err))?; } diff --git a/desktop-client/src-tauri/tauri.conf.json b/desktop-client/src-tauri/tauri.conf.json index 7316142..4d14b50 100644 --- a/desktop-client/src-tauri/tauri.conf.json +++ b/desktop-client/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", - "productName": "wanwan-cloud-desktop", - "version": "0.1.8", + "productName": "玩玩云", + "version": "0.1.9", "identifier": "cn.workyai.wanwancloud.desktop", "build": { "beforeDevCommand": "npm run dev", @@ -12,7 +12,7 @@ "app": { "windows": [ { - "title": "Wanwan Cloud Desktop", + "title": "玩玩云", "width": 1360, "height": 860, "minWidth": 1120, diff --git a/desktop-client/src/App.vue b/desktop-client/src/App.vue index 0e49133..1984062 100644 --- a/desktop-client/src/App.vue +++ b/desktop-client/src/App.vue @@ -153,7 +153,7 @@ const syncState = reactive({ nextRunAt: "", }); const updateState = reactive({ - currentVersion: "0.1.8", + currentVersion: "0.1.9", latestVersion: "", available: false, mandatory: false, @@ -927,7 +927,7 @@ async function installLatestUpdate(): Promise { resetUpdateRuntime(); updateRuntime.downloading = true; const taskId = `UPD-${Date.now()}`; - const installerName = `wanwan-cloud-desktop_v${updateState.latestVersion || updateState.currentVersion}.exe`; + const installerName = `玩玩云_v${updateState.latestVersion || updateState.currentVersion}.exe`; updateRuntime.taskId = taskId; updateRuntime.progress = 1; updateRuntime.speed = "准备下载";