add option to disable save_files globally
This commit is contained in:
@@ -43,6 +43,7 @@ Current known issues / missing features / things to do:
|
||||
- Code style
|
||||
- The internal menu abstraction is ugly and hard to work with. Rewrite it.
|
||||
- Add default values for all commands (like we use for Episode 3 battle commands).
|
||||
- Clean up the way proxy session options are passed to the session from the client object (and add user-settable options for e.g. chat filter, which currently doesn't appear in the menu).
|
||||
- Episode 3 bugs
|
||||
- Disconnecting during a match turns you into a COM if there are other humans in the match, even if the match is part of a tournament. This may be incorrect behavior for tournaments.
|
||||
- Disconnecting during a tournament when there are no other humans in the match simply cancels the match (so it can be replayed) instead of forfeiting, which is almost certainly incorrect behavior. (Then again, no one likes losing tournaments to COMs...)
|
||||
|
||||
@@ -154,6 +154,12 @@ void populate_state_from_config(shared_ptr<ServerState> s,
|
||||
s->catch_handler_exceptions = true;
|
||||
}
|
||||
|
||||
try {
|
||||
s->proxy_allow_save_files = d.at("ProxyAllowSaveFiles")->as_bool();
|
||||
} catch (const out_of_range&) {
|
||||
s->proxy_allow_save_files = true;
|
||||
}
|
||||
|
||||
try {
|
||||
s->ep3_behavior_flags = d.at("Episode3BehaviorFlags")->as_int();
|
||||
} catch (const out_of_range&) {
|
||||
|
||||
@@ -81,7 +81,7 @@ static const unordered_map<uint32_t, const char16_t*> proxy_options_menu_descrip
|
||||
});
|
||||
|
||||
static vector<MenuItem> proxy_options_menu_for_client(
|
||||
shared_ptr<const Client> c) {
|
||||
shared_ptr<ServerState> s, shared_ptr<const Client> c) {
|
||||
vector<MenuItem> ret;
|
||||
// Note: The descriptions are instead in the map above, because this menu is
|
||||
// dynamically created every time it's sent to the client. This is just one
|
||||
@@ -100,8 +100,10 @@ static vector<MenuItem> proxy_options_menu_for_client(
|
||||
c->proxy_block_events ? u"Block events ON" : u"Block events OFF", u"", 0);
|
||||
ret.emplace_back(ProxyOptionsMenuItemID::BLOCK_PATCHES,
|
||||
c->proxy_block_function_calls ? u"Block patches ON" : u"Block patches OFF", u"", 0);
|
||||
ret.emplace_back(ProxyOptionsMenuItemID::SAVE_FILES,
|
||||
c->proxy_save_files ? u"Save files ON" : u"Save files OFF", u"", 0);
|
||||
if (s->proxy_allow_save_files) {
|
||||
ret.emplace_back(ProxyOptionsMenuItemID::SAVE_FILES,
|
||||
c->proxy_save_files ? u"Save files ON" : u"Save files OFF", u"", 0);
|
||||
}
|
||||
ret.emplace_back(ProxyOptionsMenuItemID::SUPPRESS_LOGIN,
|
||||
c->proxy_suppress_remote_login ? u"Skip login ON" : u"Skip login OFF", u"", 0);
|
||||
ret.emplace_back(ProxyOptionsMenuItemID::SKIP_CARD,
|
||||
@@ -131,7 +133,7 @@ static void send_client_to_proxy_server(shared_ptr<ServerState> s, shared_ptr<Cl
|
||||
session->infinite_hp = c->infinite_hp;
|
||||
session->infinite_tp = c->infinite_tp;
|
||||
session->switch_assist = c->switch_assist;
|
||||
session->save_files = c->proxy_save_files;
|
||||
session->save_files = s->proxy_allow_save_files && c->proxy_save_files;
|
||||
session->suppress_remote_login = c->proxy_suppress_remote_login;
|
||||
if (c->proxy_block_events) {
|
||||
session->override_lobby_event = 0;
|
||||
@@ -1682,7 +1684,7 @@ static void on_menu_selection(shared_ptr<ServerState> s, shared_ptr<Client> c,
|
||||
c->proxy_zero_remote_guild_card = !c->proxy_zero_remote_guild_card;
|
||||
resend_proxy_options_menu:
|
||||
send_menu(c, s->name.c_str(), MenuID::PROXY_OPTIONS,
|
||||
proxy_options_menu_for_client(c));
|
||||
proxy_options_menu_for_client(s, c));
|
||||
break;
|
||||
default:
|
||||
send_message_box(c, u"Incorrect menu item ID.");
|
||||
@@ -1697,7 +1699,7 @@ static void on_menu_selection(shared_ptr<ServerState> s, shared_ptr<Client> c,
|
||||
|
||||
} else if (item_id == ProxyDestinationsMenuItemID::OPTIONS) {
|
||||
send_menu(c, s->name.c_str(), MenuID::PROXY_OPTIONS,
|
||||
proxy_options_menu_for_client(c));
|
||||
proxy_options_menu_for_client(s, c));
|
||||
|
||||
} else {
|
||||
const pair<string, uint16_t>* dest = nullptr;
|
||||
|
||||
+4
-1
@@ -31,7 +31,10 @@ ServerState::ServerState()
|
||||
ep3_card_auction_max_size(0),
|
||||
next_lobby_id(1),
|
||||
pre_lobby_event(0),
|
||||
ep3_menu_song(-1) {
|
||||
ep3_menu_song(-1),
|
||||
local_address(0),
|
||||
external_address(0),
|
||||
proxy_allow_save_files(true) {
|
||||
vector<shared_ptr<Lobby>> non_v1_only_lobbies;
|
||||
vector<shared_ptr<Lobby>> ep3_only_lobbies;
|
||||
|
||||
|
||||
@@ -110,6 +110,8 @@ struct ServerState {
|
||||
uint32_t local_address;
|
||||
uint32_t external_address;
|
||||
|
||||
bool proxy_allow_save_files;
|
||||
|
||||
std::shared_ptr<ProxyServer> proxy_server;
|
||||
std::shared_ptr<Server> game_server;
|
||||
std::shared_ptr<FileContentsCache> client_options_cache;
|
||||
|
||||
@@ -123,6 +123,12 @@
|
||||
// connect to newserv will be proxied to this destination.
|
||||
// "ProxyDestination-BB": "",
|
||||
|
||||
// There is a proxy option that allows users to save copies of various game
|
||||
// files on the server side. If you have external clients connecting to your
|
||||
// server, you can disable this option to prevent clients from generating
|
||||
// files on the server side which they will never be able to access.
|
||||
"ProxyAllowSaveFiles": true,
|
||||
|
||||
// By default, the interactive shell runs if stdin is a terminal, and doesn't
|
||||
// run if it's not. This option, if present, overrides that behavior.
|
||||
// "RunInteractiveShell": false,
|
||||
|
||||
Reference in New Issue
Block a user