Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
postbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Wen Wei Li
postbox
Commits
a2a6645a
Commit
a2a6645a
authored
Apr 08, 2020
by
Wen Wei Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug
parent
7ac3df96
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
113 additions
and
10 deletions
+113
-10
requirement.txt
requirement.txt
+0
-1
static/css/main.css
static/css/main.css
+4
-0
static/js/index.js
static/js/index.js
+88
-2
templates/index.html
templates/index.html
+4
-0
templates/main_page.html
templates/main_page.html
+4
-0
templates/otp.html
templates/otp.html
+4
-0
templates/wifi.html
templates/wifi.html
+4
-0
wifi_utils.py
wifi_utils.py
+5
-7
No files found.
requirement.txt
View file @
a2a6645a
flask
flask
flask-bootstrap
flask-bootstrap
sqlite3
pyotp
pyotp
static/css/main.css
View file @
a2a6645a
...
@@ -17,6 +17,10 @@ input {
...
@@ -17,6 +17,10 @@ input {
.btn-font
{
.btn-font
{
font-size
:
18px
;
font-size
:
18px
;
}
}
.hg-button
{
font-size
:
20px
;
height
:
60px
;
}
td
{
td
{
cursor
:
pointer
;
cursor
:
pointer
;
}
}
...
...
static/js/index.js
View file @
a2a6645a
import
(
'
./Keyboard.js
'
)
import
(
'
./Keyboard.js
'
)
let
Keyboard
=
window
.
SimpleKeyboard
.
default
;
let
Keyboard
=
window
.
SimpleKeyboard
.
default
;
let
myK
eyboard
=
new
Keyboard
({
let
k
eyboard
=
new
Keyboard
({
onChange
:
input
=>
onChange
(
input
),
onChange
:
input
=>
onChange
(
input
),
onKeyPress
:
button
=>
onKeyPress
(
button
)
onKeyPress
:
button
=>
onKeyPress
(
button
),
theme
:
"
hg-theme-default hg-theme-ios
"
,
layout
:
{
default
:
[
"
q w e r t y u i o p {bksp}
"
,
"
a s d f g h j k l
"
,
"
{shift} z x c v b n m , . {shift}
"
,
"
{alt} {space} {enter}
"
],
shift
:
[
"
Q W E R T Y U I O P {bksp}
"
,
"
A S D F G H J K L
"
,
"
{shiftactivated} Z X C V B N M , . {shiftactivated}
"
,
"
{alt} {space} {enter}
"
],
alt
:
[
"
1 2 3 4 5 6 7 8 9 0 {bksp}
"
,
`@ # $ & * ( ) ' "`
,
"
{shift} % - + = / ; : ! ? {shift}
"
,
"
{default} {space} {enter}
"
],
},
display
:
{
"
{alt}
"
:
"
.?123
"
,
"
{shift}
"
:
"
⇧
"
,
"
{shiftactivated}
"
:
"
⇧
"
,
"
{enter}
"
:
"
return
"
,
"
{bksp}
"
:
"
⌫
"
,
"
{altright}
"
:
"
.?123
"
,
"
{downkeyboard}
"
:
"
🞃
"
,
"
{space}
"
:
"
space
"
,
"
{default}
"
:
"
ABC
"
,
"
{back}
"
:
"
⇦
"
}
});
/**
* Update simple-keyboard when input is changed directly
*/
document
.
querySelector
(
"
.input
"
).
addEventListener
(
"
input
"
,
event
=>
{
keyboard
.
setInput
(
event
.
target
.
value
);
});
});
console
.
log
(
keyboard
);
function
onChange
(
input
)
{
document
.
querySelector
(
"
.input
"
).
value
=
input
;
console
.
log
(
"
Input changed
"
,
input
);
}
function
onKeyPress
(
button
)
{
console
.
log
(
"
Button pressed
"
,
button
);
/**
* Handle toggles
*/
if
(
button
.
includes
(
"
{
"
)
&&
button
.
includes
(
"
}
"
))
{
handleLayoutChange
(
button
);
}
}
function
handleLayoutChange
(
button
)
{
let
currentLayout
=
keyboard
.
options
.
layoutName
;
let
layoutName
;
switch
(
button
)
{
case
"
{shift}
"
:
case
"
{shiftactivated}
"
:
case
"
{default}
"
:
layoutName
=
currentLayout
===
"
default
"
?
"
shift
"
:
"
default
"
;
break
;
case
"
{alt}
"
:
case
"
{altright}
"
:
layoutName
=
currentLayout
===
"
alt
"
?
"
default
"
:
"
alt
"
;
break
;
default
:
break
;
}
if
(
layoutName
)
{
keyboard
.
setOptions
({
layoutName
:
layoutName
});
}
}
function
onChange
(
input
)
{
function
onChange
(
input
)
{
document
.
querySelector
(
"
.input
"
).
value
=
input
;
document
.
querySelector
(
"
.input
"
).
value
=
input
;
console
.
log
(
"
Input changed
"
,
input
);
console
.
log
(
"
Input changed
"
,
input
);
}
}
function
onKeyPress
(
button
)
{
function
onKeyPress
(
button
)
{
handleLayoutChange
(
button
);
console
.
log
(
"
Button pressed
"
,
button
);
console
.
log
(
"
Button pressed
"
,
button
);
}
}
templates/index.html
View file @
a2a6645a
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
{% block head %}
{% block head %}
<meta
http-equiv=
"cache-control"
content=
"max-age=0"
/>
<meta
http-equiv=
"cache-control"
content=
"no-store"
/>
<meta
http-equiv=
"expires"
content=
"-1"
/>
<meta
http-equiv=
"pragma"
content=
"no-cache"
/>
{{super()}}
{{super()}}
...
...
templates/main_page.html
View file @
a2a6645a
{% extends "bootstrap/base.html" %}
{% extends "bootstrap/base.html" %}
{% block head %}
{% block head %}
<meta
http-equiv=
"cache-control"
content=
"max-age=0"
/>
<meta
http-equiv=
"cache-control"
content=
"no-store"
/>
<meta
http-equiv=
"expires"
content=
"-1"
/>
<meta
http-equiv=
"pragma"
content=
"no-cache"
/>
{{super()}}
{{super()}}
<link
rel=
"stylesheet"
href=
"{{url_for('static', filename='css/bootstrap.min.css')}}"
>
<link
rel=
"stylesheet"
href=
"{{url_for('static', filename='css/bootstrap.min.css')}}"
>
...
...
templates/otp.html
View file @
a2a6645a
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
{% block head %}
{% block head %}
<meta
http-equiv=
"cache-control"
content=
"max-age=0"
/>
<meta
http-equiv=
"cache-control"
content=
"no-store"
/>
<meta
http-equiv=
"expires"
content=
"-1"
/>
<meta
http-equiv=
"pragma"
content=
"no-cache"
/>
{{super()}}
{{super()}}
...
...
templates/wifi.html
View file @
a2a6645a
{% extends "bootstrap/base.html" %}
{% extends "bootstrap/base.html" %}
{% block head %}
{% block head %}
<meta
http-equiv=
"cache-control"
content=
"max-age=0"
/>
<meta
http-equiv=
"cache-control"
content=
"no-store"
/>
<meta
http-equiv=
"expires"
content=
"-1"
/>
<meta
http-equiv=
"pragma"
content=
"no-cache"
/>
{{super()}}
{{super()}}
<link
href=
"{{url_for('static',filename='css/main.css')}}"
rel=
"stylesheet"
>
<link
href=
"{{url_for('static',filename='css/main.css')}}"
rel=
"stylesheet"
>
...
...
wifi_utils.py
View file @
a2a6645a
...
@@ -22,20 +22,18 @@ def shell_exec(cmd):
...
@@ -22,20 +22,18 @@ def shell_exec(cmd):
def
scan_wifi
():
def
scan_wifi
():
cmd
=
"nmcli d wifi list"
cmd
=
"nmcli
-t
d wifi list"
resp
=
shell_exec
(
cmd
)
resp
=
shell_exec
(
cmd
)
ret
=
[]
ret
=
[]
for
line
in
resp
.
splitlines
():
for
line
in
resp
.
splitlines
():
info
=
line
.
split
()
info
=
line
.
split
(
":"
)
if
(
info
[
0
]
==
'*'
):
print
(
info
)
cell
=
Wifi_cell
(
info
[
1
],
info
[
2
],
info
[
3
],
info
[
4
],
info
[
5
],
info
[
6
])
cell
=
Wifi_cell
(
info
[
1
],
info
[
2
],
info
[
3
],
info
[
4
],
info
[
5
],
info
[
7
])
else
:
cell
=
Wifi_cell
(
info
[
0
],
info
[
1
],
info
[
2
],
info
[
3
],
info
[
4
],
info
[
5
])
ret
.
append
(
cell
)
ret
.
append
(
cell
)
return
ret
return
ret
def
wifi_connect
(
ssid
,
password
):
def
wifi_connect
(
ssid
,
password
):
cmd
=
"nmcli d wifi connect {} password {}
con-name wifi_test
"
.
format
(
ssid
,
password
)
cmd
=
"nmcli d wifi connect {} password {}"
.
format
(
ssid
,
password
)
resp
=
shell_exec
(
cmd
)
resp
=
shell_exec
(
cmd
)
print
(
resp
)
print
(
resp
)
if
"failed"
in
resp
or
"Error"
in
resp
:
if
"failed"
in
resp
or
"Error"
in
resp
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment