mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
quickjs enable std option
This commit is contained in:
2
3rdparty/qjs
vendored
2
3rdparty/qjs
vendored
Submodule 3rdparty/qjs updated: 0df5c90086...3fb0770c9e
@@ -66,7 +66,7 @@ namespace NekoRay {
|
||||
_add(new configItem("sp_format", &system_proxy_format, itemType::string));
|
||||
_add(new configItem("sub_clear", &sub_clear, itemType::boolean));
|
||||
_add(new configItem("sub_insecure", &sub_insecure, itemType::boolean));
|
||||
_add(new configItem("enable_js_hook", &enable_js_hook, itemType::boolean));
|
||||
_add(new configItem("enable_js_hook", &enable_js_hook, itemType::integer));
|
||||
}
|
||||
|
||||
void DataStore::UpdateStartedId(int id) {
|
||||
@@ -233,49 +233,42 @@ namespace NekoRay {
|
||||
switch (item->type) {
|
||||
case itemType::string:
|
||||
if (value.type() != QJsonValue::String) {
|
||||
MessageBoxWarning("错误", "Not a string\n" + key);
|
||||
continue;
|
||||
}
|
||||
*(QString *) item->ptr = value.toString();
|
||||
break;
|
||||
case itemType::integer:
|
||||
if (value.type() != QJsonValue::Double) {
|
||||
MessageBoxWarning("错误", "Not a int\n" + key);
|
||||
continue;
|
||||
}
|
||||
*(int *) item->ptr = value.toInt();
|
||||
break;
|
||||
case itemType::integer64:
|
||||
if (value.type() != QJsonValue::Double) {
|
||||
MessageBoxWarning("错误", "Not a int64\n" + key);
|
||||
continue;
|
||||
}
|
||||
*(long long *) item->ptr = value.toDouble();
|
||||
break;
|
||||
case itemType::boolean:
|
||||
if (value.type() != QJsonValue::Bool) {
|
||||
MessageBoxWarning("错误", "Not a bool\n" + key);
|
||||
continue;
|
||||
}
|
||||
*(bool *) item->ptr = value.toBool();
|
||||
break;
|
||||
case itemType::stringList:
|
||||
if (value.type() != QJsonValue::Array) {
|
||||
MessageBoxWarning("错误", "Not a Array\n" + key);
|
||||
continue;
|
||||
}
|
||||
*(QList<QString> *) item->ptr = QJsonArray2QListString(value.toArray());
|
||||
break;
|
||||
case itemType::integerList:
|
||||
if (value.type() != QJsonValue::Array) {
|
||||
MessageBoxWarning("错误", "Not a Array\n" + key);
|
||||
continue;
|
||||
}
|
||||
*(QList<int> *) item->ptr = QJsonArray2QListInt(value.toArray());
|
||||
break;
|
||||
case itemType::jsonStore:
|
||||
if (value.type() != QJsonValue::Object) {
|
||||
MessageBoxWarning("错误", "Not a json object\n" + key);
|
||||
continue;
|
||||
}
|
||||
if (load_control_no_jsonStore)
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace NekoRay {
|
||||
// Security
|
||||
bool insecure_hint = true;
|
||||
bool skip_cert = false;
|
||||
bool enable_js_hook = false;
|
||||
int enable_js_hook = 0;
|
||||
|
||||
// Remember
|
||||
int remember_spmode = NekoRay::SystemProxyMode::DISABLE;
|
||||
|
||||
@@ -80,6 +80,7 @@ namespace NekoRay::qjs {
|
||||
this->neko_ctx = malloc(sizeof(nekoray_qjs_context));
|
||||
nekoray_qjs_new_arg arg;
|
||||
arg.neko_ctx = NEKO_CTX;
|
||||
arg.enable_std = NekoRay::dataStore->enable_js_hook == 2 ? 1 : 0;
|
||||
arg.func_log = func_log;
|
||||
nekoray_qjs_new(arg);
|
||||
#endif
|
||||
@@ -138,7 +139,7 @@ namespace NekoRay::qjs {
|
||||
|
||||
QByteArray ReadHookJS() {
|
||||
#ifndef NKR_NO_QUICKJS
|
||||
if (NekoRay::dataStore->enable_js_hook) {
|
||||
if (NekoRay::dataStore->enable_js_hook > 0) {
|
||||
return ReadFile(QString("./hook.%1.js").arg(software_name.toLower()));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -228,7 +228,7 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
|
||||
|
||||
D_LOAD_BOOL(insecure_hint)
|
||||
D_LOAD_BOOL(skip_cert)
|
||||
D_LOAD_BOOL(enable_js_hook)
|
||||
ui->enable_js_hook->setCurrentIndex(NekoRay::dataStore->enable_js_hook);
|
||||
}
|
||||
|
||||
DialogBasicSettings::~DialogBasicSettings() {
|
||||
@@ -279,7 +279,7 @@ void DialogBasicSettings::accept() {
|
||||
|
||||
D_SAVE_BOOL(insecure_hint)
|
||||
D_SAVE_BOOL(skip_cert)
|
||||
D_SAVE_BOOL(enable_js_hook)
|
||||
NekoRay::dataStore->enable_js_hook = ui->enable_js_hook->currentIndex();
|
||||
|
||||
MW_dialog_message(Dialog_DialogBasicSettings, "UpdateDataStore");
|
||||
QDialog::accept();
|
||||
|
||||
@@ -579,12 +579,43 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enable_js_hook">
|
||||
<widget class="QGroupBox" name="horizontalGroupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Enable hook.js</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="enable_js_hook">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Disable</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Enable</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Enable + load std module</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user