Skip to content

Commit

Permalink
fix: 🐛 Add gnirehtet fix option
Browse files Browse the repository at this point in the history
  • Loading branch information
viarotel committed Nov 3, 2023
1 parent b5a45e2 commit f9c6c32
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 13 deletions.
12 changes: 9 additions & 3 deletions electron/exposes/gnirehtet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,15 @@ const run = async (deviceId) => {
throw new Error(error?.message || 'Gnirehtet Relay fail')
})

await install(deviceId).catch((error) => {
throw new Error(error?.message || 'Gnirehtet Install Client fail')
})
const gnirehtetFix = appStore.get('common.gnirehtetFix') || false
const isInstalled = installed(deviceId)

if (gnirehtetFix || !isInstalled) {
console.log('Installing Gnirehtet Client...')
await install(deviceId).catch((error) => {
throw new Error(error?.message || 'Gnirehtet Install Client fail')
})
}

await start(deviceId).catch((error) => {
throw new Error(error?.message || 'Gnirehtet Start fail')
Expand Down
8 changes: 0 additions & 8 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,6 @@ function createWindow() {
return { action: 'deny' }
})

// Test active push message to Renderer-process.
mainWindow.webContents.on('did-finish-load', () => {
mainWindow?.webContents.send(
'main-process-message',
new Date().toLocaleString(),
)
})

if (VITE_DEV_SERVER_URL) {
mainWindow.loadURL(VITE_DEV_SERVER_URL)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Device/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export default {
})
},
beforeUnmount() {
this?.unAdbWatch()
this?.unAdbWatch?.()
},
methods: {
onStdout() {},
Expand Down
5 changes: 5 additions & 0 deletions src/components/Preference/LanguageSelect/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export default {
},
},
},
watch: {
inputValue(value) {
this.locale = value
},
},
methods: {},
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Preference/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<div class="flex-1 w-0 truncate pl-4 text-base">
{{ $t(item.label) }}
</div>
<div class="flex-none pl-4 pr-12">
<div class="flex-none pl-4 pr-12" @click.stop>
<el-button type="primary" text @click="handleReset(name)">
{{ $t("preferences.reset") }}
</el-button>
Expand Down
3 changes: 3 additions & 0 deletions src/locales/languages/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@
"preferences.common.gnirehtet.name": "Gnirehtet Path",
"preferences.common.gnirehtet.placeholder": "Set gnirehtet path",
"preferences.common.gnirehtet.tips": "The path for gnirehtet used to provide reverse tethering for devices.",
"preferences.common.gnirehtet.fix.name": "Gnirehtet Fix",
"preferences.common.gnirehtet.fix.placeholder": "Turning this on will try to fix reverse tethering issues on some devices",
"preferences.common.gnirehtet.fix.tips": "Note: May cause duplicate gnirehtet client installations",
"preferences.common.language.name": "Language",
"preferences.common.language.placeholder": "Select language",
"preferences.common.language.chinese": "中文",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/languages/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@
"preferences.common.gnirehtet.name": "gnirehtet 路径",
"preferences.common.gnirehtet.placeholder": "请设置 gnirehtet 路径",
"preferences.common.gnirehtet.tips": "用于为设备反向供网的 gnirehtet 地址。",
"preferences.common.gnirehtet.fix.name": "gnirehtet 修复",
"preferences.common.gnirehtet.fix.placeholder": "开启将尝试修复某些机型二次开启反向供网功能失败的问题",
"preferences.common.gnirehtet.fix.tips": "注意:可能导致 gnirehtet 客户端重复安装",
"preferences.common.language.name": "语言",
"preferences.common.language.placeholder": "选择你需要的语言",
"preferences.common.language.chinese": "中文",
Expand Down
8 changes: 8 additions & 0 deletions src/store/preference/model/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ export default {
{ name: 'preferences.common.gnirehtet.name', extensions: ['*'] },
],
},
gnirehtetFix: {
label: 'preferences.common.gnirehtet.fix.name',
field: 'gnirehtetFix',
type: 'Switch',
value: false,
placeholder: 'preferences.common.gnirehtet.fix.placeholder',
tips: 'preferences.common.gnirehtet.fix.tips',
},
debug: {
label: 'preferences.common.debug.name',
field: 'debug',
Expand Down

0 comments on commit f9c6c32

Please sign in to comment.