Skip to content

Commit

Permalink
Fix login loading
Browse files Browse the repository at this point in the history
  • Loading branch information
gavingaozhangmin committed Jul 26, 2023
1 parent 0cce420 commit 516776e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 61,719 deletions.
1 change: 0 additions & 1 deletion electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"files": [ "dist" ],
"extraResources": [
{ "from": "./static/engine/aria2.conf", "to": "./engine/aria2.conf"},
{ "from": "./static/engine/ads_block.txt", "to": "./engine/ads_block.txt"},
{ "from": "./static/crx", "to": "./crx"},
{ "from": "./public/images/qrcode_1280.jpg", "to": "./images/qrcode_1280.jpg"},
{ "from": "./static/images/icon_24.png", "to": "./images/icon_24.png"},
Expand Down
5 changes: 0 additions & 5 deletions electron/main/core/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { getAsarPath, getResourcesPath, getStaticPath, getUserDataPath } from '.
import fs, { existsSync, readFileSync, writeFileSync } from 'fs'
import is from 'electron-is'
import { ShowErrorAndRelaunch } from './dialog'
import { ElectronBlocker } from '@cliqz/adblocker-electron';
import path from 'path'

export const ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.33'
Expand Down Expand Up @@ -243,10 +242,6 @@ export function createElectronWindow(width: number, height: number, center: bool
preload: getAsarPath('dist/electron/preload/index.js')
}
})
const adsRulePath: string = path.join(getStaticPath('engine'), 'ads_block.txt')
const blocker =
ElectronBlocker.parse(fs.readFileSync(adsRulePath, 'utf-8'));
blocker.enableBlockingInSession(session.defaultSession);

win.removeMenu()
if (is.dev()) {
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
"engines": {
"node": ">=16.0.0"
},
"dependencies": {},
"dependencies": {
"@cliqz/adblocker-electron": "^1.26.6",
"@cliqz/adblocker-electron-preload": "^1.26.6"
},
"devDependencies": {
"@arco-design/web-vue": "^2.45.3",
"@electron/remote": "^2.0.9",
Expand Down Expand Up @@ -50,7 +53,6 @@
"isomorphic-fetch": "^3.0.0",
"jschardet": "^3.0.0",
"lodash": "^4.17.21",
"@cliqz/adblocker-electron": "^1.26.6",
"pinia": "^2.0.35",
"secp256k1": "^5.0.0",
"socks-proxy-agent": "^7.0.0",
Expand Down
6 changes: 5 additions & 1 deletion src/user/UserLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,14 @@ export default defineComponent({
const qrCodeUrl = resp.body.qrCodeUrl
const codeStatusUrl = qrCodeUrl + '/status'
const qrCodeStatus = document.getElementById('qr-code-status') as any
webview.loadURL(qrCodeUrl)
webview.stop()
document.getElementById('loginiframe').loadURL(qrCodeUrl)
console.log("load qr code url: ", qrCodeUrl)
webview.addEventListener('did-stop-loading', () => {
const loading = document.getElementById('loginframedivloading')
if (loading) loading.parentNode!.removeChild(loading)
document.getElementById('loginframediverror')!.style.display = 'none'
console.log("load qr code url1: ", qrCodeUrl)
// Start polling QR code status
const intervalId = setInterval(async () => {
Expand Down Expand Up @@ -311,6 +314,7 @@ export default defineComponent({
tk2.access_token_v2 = response.body.access_token
tk2.expires_in_v2 = Date.now() + response.body.expires_in * 1000
tk2.token_type_v2 = response.body.token_type
tk2.refresh_token_v2 = response.body.refresh_token
UserDAL.UserLogin(tk2)
.then(() => {
useUserStore().userShowLogin = false
Expand Down
Loading

0 comments on commit 516776e

Please sign in to comment.