From 07632a758373837e4fb098946673a61aced32602 Mon Sep 17 00:00:00 2001 From: ZHAO Xudong Date: Wed, 29 Jul 2026 09:41:02 +0800 Subject: [PATCH 1/2] Fix build --- entry/src/main/ets/entryability/EntryAbility.ets | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 4f5eee3..f3ab540 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -21,7 +21,7 @@ import window from '@ohos.window'; import Want from '@ohos.app.ability.Want'; import AbilityConstant from '@ohos.app.ability.AbilityConstant'; import { Configuration } from '@ohos.app.ability.Configuration'; -import { abilityAccessCtrl, common } from '@kit.AbilityKit'; +import { abilityAccessCtrl, common, Permissions, PermissionRequestResult } from '@kit.AbilityKit'; import { Environment } from '@kit.CoreFileKit'; import fs from '@ohos.file.fs'; @@ -33,7 +33,7 @@ const TAG: string = 'ElectermEntryAbility'; // Permissions without "reason"/"usedScene" (INTERNET, GET_NETWORK_INFO, // ACCESS_CERT_MANAGER, PRINT, GYROSCOPE, ACCELEROMETER) are normal or // system-grant permissions that don't need runtime request. -const ALL_USER_PERMISSIONS: string[] = [ +const ALL_USER_PERMISSIONS: Permissions[] = [ 'ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY', 'ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY', 'ohos.permission.READ_WRITE_DESKTOP_DIRECTORY', @@ -95,8 +95,8 @@ export default class EntryAbility extends WebAbility { try { const atManager = abilityAccessCtrl.createAtManager(); const context = this.context as common.UIAbilityContext; - const result = await atManager.requestPermissionsFromUser(context, ALL_USER_PERMISSIONS); - const authResults = result.authResults; + const result: PermissionRequestResult = await atManager.requestPermissionsFromUser(context, ALL_USER_PERMISSIONS); + const authResults: number[] = result.authResults; for (let i = 0; i < authResults.length; i++) { if (authResults[i] === 0) { console.info(`[${TAG}] Permission granted: ${ALL_USER_PERMISSIONS[i]}`); From 991edfb8bf851cec8597e82a5c6887badecb053d Mon Sep 17 00:00:00 2001 From: ZHAO Xudong Date: Wed, 29 Jul 2026 09:45:11 +0800 Subject: [PATCH 2/2] Fix code --- .../main/ets/entryability/EntryAbility.ets | 9 ++--- entry/src/main/module.json5 | 40 ------------------- src/app/lib/create-window.js | 4 +- 3 files changed, 4 insertions(+), 49 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index f3ab540..284dc68 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -33,16 +33,13 @@ const TAG: string = 'ElectermEntryAbility'; // Permissions without "reason"/"usedScene" (INTERNET, GET_NETWORK_INFO, // ACCESS_CERT_MANAGER, PRINT, GYROSCOPE, ACCELEROMETER) are normal or // system-grant permissions that don't need runtime request. +// Removed LOCATION, MICROPHONE, CAMERA, ACCESS_BLUETOOTH — a terminal/SSH +// app has no use for geolocation, audio/video capture, or Bluetooth. const ALL_USER_PERMISSIONS: Permissions[] = [ 'ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY', 'ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY', 'ohos.permission.READ_WRITE_DESKTOP_DIRECTORY', - 'ohos.permission.LOCATION', - 'ohos.permission.APPROXIMATELY_LOCATION', - 'ohos.permission.MICROPHONE', - 'ohos.permission.CAMERA', - 'ohos.permission.READ_PASTEBOARD', - 'ohos.permission.ACCESS_BLUETOOTH' + 'ohos.permission.READ_PASTEBOARD' ]; export default class EntryAbility extends WebAbility { diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index f2bb6ec..91a2a5a 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -43,41 +43,9 @@ "when": "always" } }, - { - "name": "ohos.permission.LOCATION", - "reason": "$string:reason", - "usedScene": { - "abilities": ["EntryAbility"], - "when": "always" - } - }, - { - "name": "ohos.permission.APPROXIMATELY_LOCATION", - "reason": "$string:reason", - "usedScene": { - "abilities": ["EntryAbility"], - "when": "always" - } - }, { "name": "ohos.permission.ACCESS_CERT_MANAGER" }, - { - "name": "ohos.permission.MICROPHONE", - "reason": "$string:microphone", - "usedScene": { - "abilities": ["EntryAbility"], - "when": "inuse" - } - }, - { - "name": "ohos.permission.CAMERA", - "reason": "$string:camera", - "usedScene": { - "abilities": ["EntryAbility"], - "when": "inuse" - } - }, { "name": "ohos.permission.PRINT" }, @@ -89,14 +57,6 @@ "when": "inuse" } }, - { - "name": "ohos.permission.ACCESS_BLUETOOTH", - "reason": "$string:access_bluetooth", - "usedScene": { - "abilities": ["EntryAbility"], - "when": "always" - } - }, { "name": "ohos.permission.GYROSCOPE" }, diff --git a/src/app/lib/create-window.js b/src/app/lib/create-window.js index 9f47359..099fad5 100644 --- a/src/app/lib/create-window.js +++ b/src/app/lib/create-window.js @@ -6,7 +6,6 @@ const { isDev, packInfo, iconPath, isMac, minWindowWidth, minWindowHeight } = require('../common/runtime-constants') -const defaults = require('../common/default-setting') const { getWindowSize, setWindowPos @@ -28,7 +27,6 @@ exports.createWindow = async function (userConfig) { globalState.set('closeAction', 'closeApp') globalState.set('requireAuth', !!userConfig.hashedPassword) const { width, height, x, y } = await getWindowSize() - const { useSystemTitleBar = defaults.useSystemTitleBar } = userConfig // HarmonyOS: `transparent: true` and `titleBarStyle: 'hidden'` are NOT // supported — they cause a double title bar (the OS title bar plus the // app's custom one). We therefore always use the system title bar, @@ -45,7 +43,7 @@ exports.createWindow = async function (userConfig) { minWidth: minWindowWidth, minHeight: minWindowHeight, title: packInfo.name, - frame: useSystemTitleBar, + frame: true, backgroundColor: '#333333', autoHideMenuBar: true, webPreferences: {