Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SteamOS Devkit Service
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
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
devkit
SteamOS Devkit Service
Commits
7b271f66
"git@gitlab.steamos.cloud:steamrt/steam-runtime-tools.git" did not exist on "eee560e3e1e6f6f3d5109a2f4f9ad97feaface96"
Commit
7b271f66
authored
3 years ago
by
Jeremy Whiting
Browse files
Options
Downloads
Patches
Plain Diff
Implement properties.json request.
parent
e8dd83c5
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1
Rewrite devkit service in python.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/steamos-devkit-service.py
+15
-2
15 additions, 2 deletions
src/steamos-devkit-service.py
with
15 additions
and
2 deletions
src/steamos-devkit-service.py
+
15
−
2
View file @
7b271f66
...
...
@@ -43,18 +43,27 @@ entry_point = "devkit-1"
# root until config is loaded and told otherwise, etc.
entry_point_user
=
"
root
"
device_users
=
[]
properties
=
{}
properties
=
{
"
txtvers
"
:
1
,
"
login
"
:
entry_point_user
,
"
settings
"
:
""
,
"
devkit1
"
:
[
entry_point
]}
machine_name
=
''
hook_dirs
=
[]
use_default_hooks
=
True
global_config
=
configparser
.
ConfigParser
()
# Use str form to preserve case
global_config
.
optionxform
=
str
global_config
.
read
([
"
/etc/steamos-devkit/steamos-devkit.conf
"
,
"
/usr/share/steamos-devkit/steamos-devkit.conf
"
])
user_config_path
=
os
.
path
.
join
(
os
.
path
.
expanduser
(
'
~
'
),
'
.config
'
,
PACKAGE
,
PACKAGE
+
'
.conf
'
)
print
(
"
Trying to read user config from {}
"
.
format
(
user_config_path
))
user_config
=
configparser
.
ConfigParser
()
# Use str form to preserve case
user_config
.
optionxform
=
str
user_config
.
read
(
user_config_path
)
def
find_hook
(
hook_dirs
,
use_default_hooks
,
name
):
...
...
@@ -120,7 +129,7 @@ class DevkitHandler(BaseHTTPRequestHandler):
elif
(
self
.
path
==
"
/properties.json
"
):
self
.
_send_headers
(
200
,
"
application/json
"
)
self
.
wfile
.
write
(
json
.
dumps
(
properties
).
encode
())
self
.
wfile
.
write
(
json
.
dumps
(
properties
,
indent
=
2
).
encode
())
return
else
:
...
...
@@ -152,6 +161,7 @@ class DevkitService:
def
__init__
(
self
):
global
entry_point_user
global
device_users
global
properties
self
.
port
=
SERVICE_PORT
# TODO: Change to sanitize_machine_name if needed
...
...
@@ -173,6 +183,8 @@ class DevkitService:
if
'
Port
'
in
settings
:
self
.
port
=
int
(
settings
[
"
Port
"
])
properties
[
"
settings
"
]
=
json
.
dumps
(
self
.
settings
)
# Parse users from configs
if
os
.
geteuid
()
==
0
:
# Running as root, maybe warn?
...
...
@@ -193,6 +205,7 @@ class DevkitService:
# Otherwise entry_point_user needs to be root to be able to switch between users
if
len
(
device_users
)
==
1
:
entry_point_user
=
device_users
[
0
]
properties
[
"
login
"
]
=
entry_point_user
self
.
httpd
=
socketserver
.
TCPServer
((
""
,
self
.
port
),
DevkitHandler
,
bind_and_activate
=
False
)
print
(
"
serving at port: {}
"
.
format
(
self
.
port
))
...
...
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