Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
skylivex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
astronomy
skylivex
Commits
0321d9b6
Commit
0321d9b6
authored
Feb 20, 2013
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Urldecode and other things
parent
2808b71c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
1 deletion
+96
-1
SkyliveX.js
gui/SkyliveX.js
+8
-0
login.html
gui/login.html
+10
-0
skproto.cpp
plugins/skproto.cpp
+44
-1
mainwin.cpp
src/mainwin.cpp
+29
-0
mainwin.h
src/mainwin.h
+5
-0
No files found.
gui/SkyliveX.js
View file @
0321d9b6
...
...
@@ -10,6 +10,14 @@ function notify(content)
if
(
typeof
(
notifycb
)
==
"function"
)
notifycb
(
content
);
}
function
msgalert
(
content
)
{
if
(
typeof
(
alertcb
)
==
"function"
)
alertcb
(
content
);
else
alert
(
content
);
}
SkyliveX
.
changeContent
.
connect
(
changeContent
);
SkyliveX
.
notify
.
connect
(
notify
);
SkyliveX
.
alert
.
connect
(
msgalert
);
gui/login.html
View file @
0321d9b6
...
...
@@ -7,6 +7,14 @@
{
SkyliveX
.
pushLogin
(
document
.
forms
.
loginform
.
user
.
value
,
document
.
forms
.
loginform
.
pass
.
value
);
}
function
notifycb
(
msg
)
{
document
.
getElementById
(
"res"
).
innerHTML
=
msg
;
}
function
alertcb
(
msg
)
{
document
.
getElementById
(
"alert"
).
innerHTML
=
msg
;
}
</script>
<style>
#page
{
...
...
@@ -20,6 +28,8 @@
<body>
<div
id=
"page"
>
<b>
SkyliveX 0.1.0 Login
</b>
<div
id=
"res"
></div>
<div
id=
"alert"
></div>
<form
id=
"login"
name=
"loginform"
>
Username:
<input
type=
"text"
value=
""
name=
"user"
placeholder=
"username"
>
Password:
<input
type=
"password"
value=
""
name=
"pass"
placeholder=
"password"
>
...
...
plugins/skproto.cpp
View file @
0321d9b6
...
...
@@ -121,7 +121,7 @@ void SkyliveProtocol::processPackets()
std
::
cout
<<
"Packet in Queue CRC "
<<
pkt
.
crc
.
toInt
()
<<
" computed CRC "
<<
pkt
.
computed_crc
<<
std
::
endl
;
if
(
pkt
.
crc
.
toInt
()
==
pkt
.
computed_crc
)
{
std
::
cout
<<
"Packet CRC OK command: "
<<
pkt
.
cmd
.
toStdString
()
<<
std
::
endl
;
std
::
cout
<<
"Packet CRC OK command: "
<<
pkt
.
cmd
.
toStdString
()
<<
" Params: "
<<
pkt
.
params
.
toStdString
()
<<
std
::
endl
;
if
(
pkt
.
cmd
==
"LOGIN"
)
{
SKMessage
::
SKMessage
msg
(
"getlogin"
);
...
...
@@ -143,6 +143,49 @@ void SkyliveProtocol::processPackets()
else
if
(
pkt
.
cmd
==
"STATUS"
)
{
}
else
if
(
pkt
.
cmd
==
"ENABLE"
)
{
SKMessage
::
SKMessage
loginmsg
(
"loginfailed"
);
if
(
pkt
.
params
==
"USERERRATO"
)
{
loginmsg
.
parameters
.
insert
(
"why"
,
"wronguser"
);
}
else
if
(
pkt
.
params
==
"ADMIN"
)
{
loginmsg
.
handle
=
"loginok"
;
loginmsg
.
parameters
.
insert
(
"level"
,
"admin"
);
}
else
if
(
pkt
.
params
==
"ENABLED"
)
{
loginmsg
.
handle
=
"loginok"
;
loginmsg
.
parameters
.
insert
(
"level"
,
"enabled"
);
}
else
if
(
pkt
.
params
==
"GUEST"
)
{
loginmsg
.
handle
=
"loginok"
;
loginmsg
.
parameters
.
insert
(
"level"
,
"guest"
);
}
else
{
loginmsg
.
parameters
.
insert
(
"why"
,
"unknown"
);
}
loginmsg
.
parameters
.
insert
(
"response"
,
pkt
.
params
);
sendMessage
(
loginmsg
);
}
else
if
(
pkt
.
cmd
==
"SERMES"
)
{
QList
<
QString
>
paramlist
=
pkt
.
params
.
split
(
PARAM_SEPARATOR
);
if
(
paramlist
[
0
]
==
"ALERT"
)
{
if
(
paramlist
.
size
()
>
1
)
// For safety
{
SKMessage
::
SKMessage
alertmsg
(
"alert"
);
alertmsg
.
parameters
.
insert
(
"msg"
,
QByteArray
::
fromPercentEncoding
(
paramlist
[
1
].
toLocal8Bit
()));
sendMessage
(
alertmsg
);
}
}
}
else
{
...
...
src/mainwin.cpp
View file @
0321d9b6
...
...
@@ -66,6 +66,10 @@ MainWin::MainWin(QString &htmlfile)
registerHandler
((
QString
)
"coreStarted"
,
&
MainWin
::
handle_corestarted
);
registerHandler
((
QString
)
"telescopeConnected"
,
&
MainWin
::
handle_connected
);
registerHandler
((
QString
)
"asklogin"
,
&
MainWin
::
handle_asklogin
);
registerHandler
((
QString
)
"alert"
,
&
MainWin
::
handle_alert
);
registerHandler
((
QString
)
"notify"
,
&
MainWin
::
handle_notify
);
registerHandler
((
QString
)
"loginok"
,
&
MainWin
::
handle_loginres
);
registerHandler
((
QString
)
"loginfailed"
,
&
MainWin
::
handle_loginres
);
}
MainWin
::~
MainWin
()
...
...
@@ -200,6 +204,31 @@ void MainWin::handle_asklogin(SKMessage::SKMessage &msg)
}
void
MainWin
::
handle_alert
(
SKMessage
::
SKMessage
&
msg
)
{
if
(
msg
.
parameters
.
contains
(
"msg"
))
jsbridge
.
alert
(
msg
.
parameters
[
"msg"
]);
}
void
MainWin
::
handle_notify
(
SKMessage
::
SKMessage
&
msg
)
{
if
(
msg
.
parameters
.
contains
(
"msg"
))
jsbridge
.
notify
(
msg
.
parameters
[
"msg"
]);
}
void
MainWin
::
handle_loginres
(
SKMessage
::
SKMessage
&
msg
)
{
if
(
msg
.
handle
==
"loginok"
)
{
std
::
cout
<<
"LOGIN OK"
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"LOGIN FAILED"
<<
std
::
endl
;
}
}
void
JSBridge
::
changePageContent
(
QString
elementid
,
QString
content
)
{
emit
changeContent
(
elementid
,
content
);
...
...
src/mainwin.h
View file @
0321d9b6
...
...
@@ -65,6 +65,8 @@ class JSBridge : public QObject
signals
:
void
changeContent
(
QString
elementid
,
QString
content
);
void
notify
(
QString
content
);
void
alert
(
QString
content
);
public
slots
:
void
pushLogin
(
QString
username
,
QString
password
);
void
resizeWin
(
int
width
,
int
height
);
...
...
@@ -103,6 +105,9 @@ class MainWin : public QWebView
void
handle_corestarted
(
SKMessage
::
SKMessage
&
msg
);
void
handle_connected
(
SKMessage
::
SKMessage
&
msg
);
void
handle_asklogin
(
SKMessage
::
SKMessage
&
msg
);
void
handle_alert
(
SKMessage
::
SKMessage
&
msg
);
void
handle_notify
(
SKMessage
::
SKMessage
&
msg
);
void
handle_loginres
(
SKMessage
::
SKMessage
&
msg
);
void
toggleBorders
(
bool
borders
);
void
toggleTransparentBackground
(
bool
transparentbg
);
...
...
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