Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VoxFrontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Disappointment industries™
VoxFrontend
Commits
3e8fa7b0
Verified
Commit
3e8fa7b0
authored
4 years ago
by
Tóth Miklós Tibor
Browse files
Options
Downloads
Patches
Plain Diff
misc fixes
parent
19d4351d
No related branches found
No related tags found
No related merge requests found
Pipeline
#5580
passed
4 years ago
Stage: test
Stage: build
Stage: docker
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/send.go
+12
-2
12 additions, 2 deletions
api/send.go
docker-compose.yml
+2
-0
2 additions, 0 deletions
docker-compose.yml
templates/index.template.html
+13
-1
13 additions, 1 deletion
templates/index.template.html
with
27 additions
and
3 deletions
api/send.go
+
12
−
2
View file @
3e8fa7b0
...
@@ -12,6 +12,12 @@ import (
...
@@ -12,6 +12,12 @@ import (
)
)
func
SendHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
func
SendHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
u
:=
db
.
GetUser
(
r
)
if
u
.
SchAcc
==
""
{
_
,
_
=
w
.
Write
([]
byte
(
"unauthenticated!"
))
return
}
b
,
e
:=
ioutil
.
ReadAll
(
r
.
Body
)
b
,
e
:=
ioutil
.
ReadAll
(
r
.
Body
)
if
e
!=
nil
{
if
e
!=
nil
{
_
,
_
=
w
.
Write
([]
byte
(
e
.
Error
()))
_
,
_
=
w
.
Write
([]
byte
(
e
.
Error
()))
...
@@ -26,8 +32,12 @@ func SendHandler(w http.ResponseWriter, r *http.Request) {
...
@@ -26,8 +32,12 @@ func SendHandler(w http.ResponseWriter, r *http.Request) {
}
}
msg
.
Lang
=
languages
.
Voice
(
strings
.
TrimSpace
(
string
(
msg
.
Lang
)))
msg
.
Lang
=
languages
.
Voice
(
strings
.
TrimSpace
(
string
(
msg
.
Lang
)))
msg
.
Message
=
strings
.
TrimSpace
(
msg
.
Message
)
if
msg
.
Message
==
""
{
_
,
_
=
w
.
Write
([]
byte
(
"error: empty message"
))
return
}
u
:=
db
.
GetUser
(
r
)
msg
.
SchAcc
=
u
.
SchAcc
msg
.
SchAcc
=
u
.
SchAcc
u
.
Lang
=
msg
.
Lang
u
.
Lang
=
msg
.
Lang
...
@@ -55,5 +65,5 @@ func SendHandler(w http.ResponseWriter, r *http.Request) {
...
@@ -55,5 +65,5 @@ func SendHandler(w http.ResponseWriter, r *http.Request) {
}
}
}()
}()
_
,
_
=
w
.
Write
(
b
)
_
,
_
=
w
.
Write
(
[]
byte
(
"OK"
)
)
}
}
This diff is collapsed.
Click to expand it.
docker-compose.yml
+
2
−
0
View file @
3e8fa7b0
...
@@ -11,6 +11,8 @@ services:
...
@@ -11,6 +11,8 @@ services:
-
POSTGRES=vox_postgres
-
POSTGRES=vox_postgres
env_file
:
env_file
:
-
secrets.env
-
secrets.env
depends_on
:
-
postgres
labels
:
labels
:
-
traefik.http.services.vox.loadbalancer.server.port=8080
-
traefik.http.services.vox.loadbalancer.server.port=8080
-
traefik.http.routers.vox.rule=Host(`vox.mikesweb.site`)
-
traefik.http.routers.vox.rule=Host(`vox.mikesweb.site`)
...
...
This diff is collapsed.
Click to expand it.
templates/index.template.html
+
13
−
1
View file @
3e8fa7b0
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
</div>
</div>
Vox éppen beszél...
Vox éppen beszél...
</h2>
</h2>
<h3
class=
"text-danger"
id=
"response"
style=
"width: 100%; text-align: center"
></h3>
</div>
</div>
<style>
<style>
#overlay
{
#overlay
{
...
@@ -86,8 +87,14 @@
...
@@ -86,8 +87,14 @@
const
lang
=
document
.
getElementById
(
"
langbutton
"
);
const
lang
=
document
.
getElementById
(
"
langbutton
"
);
const
msg
=
document
.
getElementById
(
"
msg
"
);
const
msg
=
document
.
getElementById
(
"
msg
"
);
const
overlay
=
document
.
getElementById
(
"
overlay
"
);
const
overlay
=
document
.
getElementById
(
"
overlay
"
);
const
resp
=
document
.
getElementById
(
"
response
"
);
function
send
()
{
function
send
()
{
if
(
!
msg
.
value
)
{
alert
(
"
Empty message!
"
);
return
;
}
const
obj
=
{
const
obj
=
{
Message
:
msg
.
value
,
Message
:
msg
.
value
,
Lang
:
lang
.
innerText
,
Lang
:
lang
.
innerText
,
...
@@ -103,7 +110,12 @@
...
@@ -103,7 +110,12 @@
xhr
.
setRequestHeader
(
"
Content-Type
"
,
"
application/json
"
);
xhr
.
setRequestHeader
(
"
Content-Type
"
,
"
application/json
"
);
xhr
.
send
(
JSON
.
stringify
(
obj
));
xhr
.
send
(
JSON
.
stringify
(
obj
));
xhr
.
onload
=
()
=>
{
xhr
.
onload
=
()
=>
{
if
(
xhr
.
responseText
===
"
OK
"
)
{
window
.
location
.
reload
();
window
.
location
.
reload
();
return
;
}
resp
.
innerText
=
xhr
.
responseText
;
}
}
}
}
...
...
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