Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SFPhoton Web
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
Schulcz Ferenc
SFPhoton Web
Commits
4043c0c1
Commit
4043c0c1
authored
10 months ago
by
Ferenc Schulcz
Browse files
Options
Downloads
Patches
Plain Diff
Handle Minecraft in docker
parent
edea641c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
service_plugins/minecraft.py
+2
-1
2 additions, 1 deletion
service_plugins/minecraft.py
service_plugins/minecraft_admin.py
+2
-1
2 additions, 1 deletion
service_plugins/minecraft_admin.py
with
4 additions
and
2 deletions
service_plugins/minecraft.py
+
2
−
1
View file @
4043c0c1
...
@@ -3,6 +3,7 @@ import services
...
@@ -3,6 +3,7 @@ import services
import
db
import
db
import
mysql.connector
import
mysql.connector
AUTHME_DB_HOST
=
"
172.16.25.101
"
def
register
(
add_endpoint
,
add_postable_endpoint
,
add_menu
):
def
register
(
add_endpoint
,
add_postable_endpoint
,
add_menu
):
add_endpoint
(
'
minecraft
'
,
minecraft
)
add_endpoint
(
'
minecraft
'
,
minecraft
)
...
@@ -46,7 +47,7 @@ def minecraft_username(**kwargs):
...
@@ -46,7 +47,7 @@ def minecraft_username(**kwargs):
with
Client
(
'
127.0.0.1
'
,
25575
,
passwd
=
'
nagy0nmen0rc0n
'
)
as
mcclient
:
with
Client
(
'
127.0.0.1
'
,
25575
,
passwd
=
'
nagy0nmen0rc0n
'
)
as
mcclient
:
response
=
mcclient
.
run
(
'
kick
'
,
x
[
'
mcuser
'
])
response
=
mcclient
.
run
(
'
kick
'
,
x
[
'
mcuser
'
])
authmedb
=
mysql
.
connector
.
connect
(
authmedb
=
mysql
.
connector
.
connect
(
host
=
'
localhost
'
,
user
=
'
authme
'
,
password
=
'
12345
'
,
database
=
'
authme
'
)
host
=
AUTHME_DB_HOST
,
user
=
'
authme
'
,
password
=
'
12345
'
,
database
=
'
authme
'
,
charset
=
"
utf8mb3
"
)
authmecursor
=
authmedb
.
cursor
()
authmecursor
=
authmedb
.
cursor
()
sql
=
"
UPDATE authme SET realname=%s, username=%s where realname=%s
"
sql
=
"
UPDATE authme SET realname=%s, username=%s where realname=%s
"
val
=
(
request
.
form
[
'
username
'
],
val
=
(
request
.
form
[
'
username
'
],
...
...
This diff is collapsed.
Click to expand it.
service_plugins/minecraft_admin.py
+
2
−
1
View file @
4043c0c1
...
@@ -124,7 +124,8 @@ def mcrestart(**kwargs):
...
@@ -124,7 +124,8 @@ def mcrestart(**kwargs):
if
not
services
.
authorize_user
(
session
[
'
username
'
],
'
mcadmin
'
):
if
not
services
.
authorize_user
(
session
[
'
username
'
],
'
mcadmin
'
):
return
rqtools
.
get_403
(
None
)
return
rqtools
.
get_403
(
None
)
# this line needs the following in sudoers: `[user running this server] ALL=(root) NOPASSWD: /usr/bin/systemctl restart minecraft-spigotd.service`
# this line needs the following in sudoers: `[user running this server] ALL=(root) NOPASSWD: /usr/bin/systemctl restart minecraft-spigotd.service`
os
.
system
(
'
sudo /usr/bin/systemctl restart minecraft-spigotd.service
'
)
#os.system('sudo /usr/bin/systemctl restart minecraft-spigotd.service')
os
.
system
(
'
/usr/bin/docker restart minecraft
'
)
db
.
sendMessage
(
session
[
'
username
'
],
'
Server is restarting.
'
)
db
.
sendMessage
(
session
[
'
username
'
],
'
Server is restarting.
'
)
return
rqtools
.
redirect
(
rqtools
.
url_for
(
'
service
'
,
servicename
=
'
mcadmin
'
))
return
rqtools
.
redirect
(
rqtools
.
url_for
(
'
service
'
,
servicename
=
'
mcadmin
'
))
...
...
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