mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 05:30:06 +08:00
add disable start as admin for windows
This commit is contained in:
parent
fd4fcdae1c
commit
846d46d0e3
@ -97,6 +97,7 @@ namespace NekoGui {
|
||||
// Security
|
||||
bool skip_cert = false;
|
||||
QString utlsFingerprint = "";
|
||||
bool disable_run_admin = false; // windows only
|
||||
|
||||
// Remember
|
||||
QStringList remember_spmode = {};
|
||||
|
||||
@ -833,6 +833,16 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="windows_no_admin">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Do not attempt to start as Admin unless explicitly requested</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Always Start as Standard User</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@ -303,6 +303,7 @@ namespace NekoGui {
|
||||
_add(new configItem("redirect_listen_port", &redirect_listen_port, itemType::integer));
|
||||
_add(new configItem("system_dns_set", &system_dns_set, itemType::boolean));
|
||||
_add(new configItem("windows_set_admin", &windows_set_admin, itemType::boolean));
|
||||
_add(new configItem("disable_win_admin", &disable_run_admin, itemType::boolean));
|
||||
_add(new configItem("enable_stats", &enable_stats, itemType::boolean));
|
||||
_add(new configItem("stats_tab", &stats_tab, itemType::string));
|
||||
_add(new configItem("proxy_scheme", &proxy_scheme, itemType::string));
|
||||
|
||||
@ -157,7 +157,7 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (NekoGui::dataStore->windows_set_admin && !NekoGui::IsAdmin())
|
||||
if (NekoGui::dataStore->windows_set_admin && !NekoGui::IsAdmin() && !NekoGui::dataStore->disable_run_admin)
|
||||
{
|
||||
NekoGui::dataStore->windows_set_admin = false; // so that if permission denied, we will run as user on the next run
|
||||
NekoGui::dataStore->Save();
|
||||
|
||||
@ -41,6 +41,7 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
ui->proxy_scheme_box->hide();
|
||||
ui->windows_no_admin->hide();
|
||||
#endif
|
||||
|
||||
// Style
|
||||
@ -149,6 +150,7 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
|
||||
|
||||
ui->utlsFingerprint->addItems(Preset::SingBox::UtlsFingerPrint);
|
||||
ui->disable_priv_req->setChecked(NekoGui::dataStore->disable_privilege_req);
|
||||
ui->windows_no_admin->setChecked(NekoGui::dataStore->disable_run_admin);
|
||||
|
||||
D_LOAD_BOOL(skip_cert)
|
||||
ui->utlsFingerprint->setCurrentText(NekoGui::dataStore->utlsFingerprint);
|
||||
@ -219,6 +221,7 @@ void DialogBasicSettings::accept() {
|
||||
D_SAVE_BOOL(skip_cert)
|
||||
NekoGui::dataStore->utlsFingerprint = ui->utlsFingerprint->currentText();
|
||||
NekoGui::dataStore->disable_privilege_req = ui->disable_priv_req->isChecked();
|
||||
NekoGui::dataStore->disable_run_admin = ui->windows_no_admin->isChecked();
|
||||
|
||||
QStringList str{"UpdateDataStore"};
|
||||
if (CACHE.needRestart) str << "NeedRestart";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user