-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce AllowlistMode option to accomodate for this. It can be disabled when using a config file too if you prefer so.
- Loading branch information
Showing
4 changed files
with
42 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,10 +41,10 @@ class LMApplication : Application { | |
}; | ||
|
||
add_main_option_entries(options); | ||
set_option_context_parameter_string("config-file.ini"); | ||
set_option_context_parameter_string("[config-file.ini]"); | ||
set_option_context_summary("""Summary: | ||
Cemuhook UDP motion server for WiiMotes on Linux."""); | ||
set_option_context_description("""I plan to soon make a handy GUI configuration tool for this program. Once done, I'll mention it here. | ||
set_option_context_description("""I plan to eventually make a handy GUI configuration tool for this program. Once done, I'll mention it here. | ||
Copyright 2022 v1993 <[email protected]> | ||
This program is free software: you can redistribute it and/or modify | ||
|
@@ -54,31 +54,35 @@ the Free Software Foundation, either version 3 of the License, or | |
} | ||
|
||
public override void activate() { | ||
print("No config file specified - call with `--help' for usage information.\n"); | ||
Process.exit(1); | ||
try { | ||
hold(); | ||
server = new Server(config.port); | ||
} catch(Error e) { | ||
print("Failed to start server: %s\n", e.message); | ||
return; | ||
} | ||
} | ||
|
||
public override void open(File[] files, string hint) { | ||
if (files.length != 1) { | ||
print("Exactly single config file must be provided."); | ||
print("Zero or one config files must be provided.\n"); | ||
Process.exit(1); | ||
} | ||
|
||
try { | ||
config.allowlist_mode = true; // For compatibility with older versions | ||
config.kfile.load_from_file(files[0].get_path(), NONE); | ||
config.init_from_keyfile(); | ||
} catch (Error e) { | ||
print("Error reading config file: %s\n", e.message); | ||
return; | ||
} | ||
|
||
try { | ||
hold(); | ||
server = new Server(config.port); | ||
} catch(Error e) { | ||
print("Failed to start server: %s\n", e.message); | ||
return; | ||
if (config.allowlist_mode) { | ||
print("Allowlist mode enabled - only devices with a section in config will be served.\n"); | ||
} | ||
|
||
activate(); | ||
} | ||
|
||
public override int handle_local_options(VariantDict opt) { | ||
|