未验证 提交 8103457c 编写于 作者: J Jim 提交者: GitHub

Merge pull request #3183 from derrod/disable-updater

UI: Add flag/file to disable built-in updater
......@@ -79,6 +79,7 @@ bool opt_start_virtualcam = false;
bool opt_minimize_tray = false;
bool opt_allow_opengl = false;
bool opt_always_on_top = false;
bool opt_disable_updater = false;
string opt_starting_collection;
string opt_starting_profile;
string opt_starting_scene;
......@@ -1424,6 +1425,11 @@ bool OBSApp::IsPortableMode()
return portable_mode;
}
bool OBSApp::IsUpdaterDisabled()
{
return opt_disable_updater;
}
#ifdef __APPLE__
#define INPUT_AUDIO_SOURCE "coreaudio_input_capture"
#define OUTPUT_AUDIO_SOURCE "coreaudio_output_capture"
......@@ -2450,6 +2456,9 @@ int main(int argc, char *argv[])
} else if (arg_is(argv[i], "--allow-opengl", nullptr)) {
opt_allow_opengl = true;
} else if (arg_is(argv[i], "--disable-updater", nullptr)) {
opt_disable_updater = true;
} else if (arg_is(argv[i], "--help", "-h")) {
std::string help =
"--help, -h: Get list of available commands.\n\n"
......@@ -2467,7 +2476,8 @@ int main(int argc, char *argv[])
"--multi, -m: Don't warn when launching multiple instances.\n\n"
"--verbose: Make log more verbose.\n"
"--always-on-top: Start in 'always on top' mode.\n\n"
"--unfiltered_log: Make log unfiltered.\n\n";
"--unfiltered_log: Make log unfiltered.\n\n"
"--disable-updater: Disable built-in updater (Windows/Mac only)\n\n";
#ifdef _WIN32
MessageBoxA(NULL, help.c_str(), "Help",
......@@ -2493,6 +2503,12 @@ int main(int argc, char *argv[])
os_file_exists(BASE_PATH "/portable_mode.txt") ||
os_file_exists(BASE_PATH "/obs_portable_mode.txt");
}
if (!opt_disable_updater) {
opt_disable_updater =
os_file_exists(BASE_PATH "/disable_updater") ||
os_file_exists(BASE_PATH "/disable_updater.txt");
}
#endif
upgrade_settings();
......
......@@ -144,6 +144,7 @@ public:
std::string GetVersionString() const;
bool IsPortableMode();
bool IsUpdaterDisabled();
const char *InputAudioSource() const;
const char *OutputAudioSource() const;
......
......@@ -1894,6 +1894,9 @@ void OBSBasic::OBSInit()
ui->actionUploadLastCrashLog = nullptr;
ui->menuCrashLogs = nullptr;
ui->actionCheckForUpdates = nullptr;
#elif _WIN32 || __APPLE__
if (App()->IsUpdaterDisabled())
ui->actionCheckForUpdates->setEnabled(false);
#endif
OnFirstLoad();
......@@ -3248,6 +3251,8 @@ void trigger_sparkle_update();
void OBSBasic::TimedCheckForUpdates()
{
if (App()->IsUpdaterDisabled())
return;
if (!config_get_bool(App()->GlobalConfig(), "General",
"EnableAutoUpdates"))
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册