Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
bitmask-vpn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vladimir KozLove
bitmask-vpn
Commits
00d9cdd2
Unverified
Commit
00d9cdd2
authored
3 years ago
by
Kali Kaneko
Browse files
Options
Downloads
Patches
Plain Diff
[refactor] move logic to js file
parent
3fdbb895
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gui/qml/logic.js
+30
-1
30 additions, 1 deletion
gui/qml/logic.js
gui/qml/main.qml
+6
-33
6 additions, 33 deletions
gui/qml/main.qml
with
36 additions
and
34 deletions
gui/qml/logic.js
+
30
−
1
View file @
00d9cdd2
...
...
@@ -34,6 +34,35 @@ function toHuman(st) {
case
"
failed
"
:
//: %1 -> application name
return
qsTr
(
"
%1 blocking internet
"
).
arg
(
ctx
.
appName
)
// TODO failed is not handed yet
ctx
.
appName
)
// TODO failed is not hand
l
ed yet
}
}
// Helper to show notification messages
function
showNotification
(
ctx
,
msg
)
{
console
.
log
(
"
Going to show notification message:
"
,
msg
)
if
(
supportsMessages
)
{
let
appname
=
ctx
?
ctx
.
appName
:
"
VPN
"
showMessage
(
appname
,
msg
,
null
,
15000
)
}
else
{
console
.
log
(
"
System doesn't support systray notifications
"
)
}
}
function
shouldAllowEmptyPass
(
providers
)
{
let
obj
=
JSON
.
parse
(
providers
.
getJson
())
let
active
=
obj
[
'
default
'
]
let
allProviders
=
obj
[
'
providers
'
]
for
(
var
i
=
0
;
i
<
allProviders
.
length
;
i
++
)
{
if
(
allProviders
[
i
][
'
name
'
]
===
active
)
{
return
(
allProviders
[
i
][
'
authEmptyPass
'
]
===
'
true
'
)
}
}
return
false
}
function
debugInit
()
{
console
.
debug
(
"
Platform:
"
,
Qt
.
platform
.
os
)
console
.
debug
(
"
DEBUG: Pre-seeded providers:
"
)
console
.
debug
(
providers
.
getJson
())
}
This diff is collapsed.
Click to expand it.
gui/qml/main.qml
+
6
−
33
View file @
00d9cdd2
...
...
@@ -241,18 +241,6 @@ ApplicationWindow {
initFailure
.
visible
=
true
}
function
shouldAllowEmptyPass
()
{
let
obj
=
JSON
.
parse
(
providers
.
getJson
())
let
active
=
obj
[
'
default
'
]
let
allProviders
=
obj
[
'
providers
'
]
for
(
var
i
=
0
;
i
<
allProviders
.
length
;
i
++
)
{
if
(
allProviders
[
i
][
'
name
'
]
===
active
)
{
return
(
allProviders
[
i
][
'
authEmptyPass
'
]
===
'
true
'
)
}
}
return
false
}
function
isManualLocation
()
{
if
(
!
ctx
)
{
return
false
...
...
@@ -264,7 +252,6 @@ ApplicationWindow {
if
(
!
ctx
.
currentLocation
)
{
return
}
const
location
=
ctx
.
currentLocation
.
toLowerCase
()
const
idx
=
gwSelector
.
model
.
indexOf
(
location
)
gwSelector
.
currentIndex
=
idx
...
...
@@ -272,13 +259,10 @@ ApplicationWindow {
}
Component.onCompleted
:
{
Logic
.
debugInit
()
loginDone
=
false
console
.
debug
(
"
Platform:
"
,
Qt
.
platform
.
os
)
console
.
debug
(
"
DEBUG: Pre-seeded providers:
"
)
console
.
debug
(
providers
.
getJson
())
allowEmptyPass
=
shouldAllowEmptyPass
()
allowEmptyPass
=
Logic
.
shouldAllowEmptyPass
(
providers
)
needsRestart
=
false
;
/* TODO get appVisible flag from backend */
app
.
visible
=
true
app
.
raise
()
...
...
@@ -441,24 +425,13 @@ ApplicationWindow {
console
.
log
(
"
show systray
"
)
if
(
Qt
.
platform
.
os
===
"
windows
"
)
{
let
appname
=
ctx
?
ctx
.
appName
:
"
VPN
"
showNotification
(
appname
+
"
is up and running. Please use system tray icon to control it.
"
)
Logic
.
showNotification
(
ctx
,
appname
+
"
is up and running. Please use system tray icon to control it.
"
)
}
}
}
// TODO move to logic, pass ctx
// Helper to show notification messages
function
showNotification
(
msg
)
{
console
.
log
(
"
Going to show notification message:
"
,
msg
)
if
(
supportsMessages
)
{
let
appname
=
ctx
?
ctx
.
appName
:
"
VPN
"
showMessage
(
appname
,
msg
,
null
,
15000
)
}
else
{
console
.
log
(
"
System doesn't support systray notifications
"
)
}
}
}
DonateDialog
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment