Skip to content

Commit

Permalink
Implement locale and timezone setting
Browse files Browse the repository at this point in the history
Add SetLocale and SetTimezone methods to givc-admin for changing the system settings.
When set, the value are stored to a configuration file, and reported back to agents
when they register.

Adjust givc-agent to handle the timezone and locale settings repotrted by the admin; use
systemd's localectl, timedatectl and systemctl set-environment to apply the settings. Add
policykit policy to allow locale and timezone setting to the givc user.

Signed-off-by: Santtu Lakkala <[email protected]>
  • Loading branch information
slakkala committed Sep 25, 2024
1 parent c50f663 commit 1f23c6c
Show file tree
Hide file tree
Showing 16 changed files with 523 additions and 157 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ http = "0.2"
http-body = "0.4.2"
hyper = "0.14"
prost = "0.12"
tokio = {version = "1.0", features = ["rt-multi-thread", "time", "macros"]}
tokio = {version = "1.0", features = ["rt-multi-thread", "time", "macros", "fs"]}
tokio-stream = "0.1"
tonic = {version="0.11.0", features = ["tls"]}
tonic-types = {version="0.11.0"}
Expand Down
383 changes: 264 additions & 119 deletions api/admin/admin.pb.go

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion api/admin/admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ message RegistryRequest {
}

message RegistryResponse {
string CmdStatus = 1;
string Timezone = 1;
string Locale = 2;
}

message ApplicationRequest {
Expand Down Expand Up @@ -65,12 +66,22 @@ message WatchItem {
}
}

message LocaleRequest {
string Locale = 1;
}

message TimezoneRequest {
string Timezone = 1;
}

service AdminService {
rpc RegisterService(RegistryRequest) returns (RegistryResponse) {}
rpc StartApplication(ApplicationRequest) returns (ApplicationResponse) {}
rpc PauseApplication(ApplicationRequest) returns (ApplicationResponse) {}
rpc ResumeApplication(ApplicationRequest) returns (ApplicationResponse) {}
rpc StopApplication(ApplicationRequest) returns (ApplicationResponse) {}
rpc SetLocale(LocaleRequest) returns (Empty) {}
rpc SetTimezone(TimezoneRequest) returns (Empty) {}
rpc Poweroff(Empty) returns (Empty) {}
rpc Reboot(Empty) returns (Empty) {}
rpc Suspend(Empty) returns (Empty) {}
Expand Down
76 changes: 75 additions & 1 deletion api/admin/admin_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions api/hwid/hwid.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/hwid/hwid_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions api/systemd/systemd.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/systemd/systemd_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions api/wifi/wifi.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/wifi/wifi_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1f23c6c

Please sign in to comment.