update 2025-02-11 00:25:28
This commit is contained in:
parent
6b426cf259
commit
8352ff3d40
|
@ -1,30 +1,24 @@
|
||||||
<?php
|
<?php
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['fileOrder'])) {
|
||||||
|
$fileOrder = json_decode($_POST['fileOrder'], true);
|
||||||
$backgroundHistoryFile = $_SERVER['DOCUMENT_ROOT'] . '/nekobox/background_history.txt';
|
$backgroundHistoryFile = $_SERVER['DOCUMENT_ROOT'] . '/nekobox/background_history.txt';
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['order'])) {
|
$existingData = [];
|
||||||
$order = $_POST['order'];
|
|
||||||
|
|
||||||
if (file_exists($backgroundHistoryFile)) {
|
if (file_exists($backgroundHistoryFile)) {
|
||||||
$backgroundFiles = array_filter(array_map('trim', file($backgroundHistoryFile)));
|
$existingData = array_filter(array_map('trim', file($backgroundHistoryFile)));
|
||||||
|
|
||||||
$newOrder = [];
|
|
||||||
foreach ($order as $file) {
|
|
||||||
$newOrder[] = basename($file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents($backgroundHistoryFile, implode(PHP_EOL, $newOrder));
|
$mergedData = array_merge($existingData, $fileOrder);
|
||||||
echo '排序已保存';
|
|
||||||
} else {
|
$uniqueData = [];
|
||||||
echo '背景历史文件不存在';
|
foreach ($fileOrder as $file) {
|
||||||
|
if (!in_array($file, $uniqueData)) {
|
||||||
|
$uniqueData[] = $file;
|
||||||
}
|
}
|
||||||
} elseif ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
|
||||||
if (file_exists($backgroundHistoryFile)) {
|
|
||||||
$backgroundFiles = array_filter(array_map('trim', file($backgroundHistoryFile)));
|
|
||||||
echo json_encode(array_values($backgroundFiles));
|
|
||||||
} else {
|
|
||||||
echo json_encode([]);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
echo '无效的请求';
|
file_put_contents($backgroundHistoryFile, implode("\n", $uniqueData) . "\n");
|
||||||
|
|
||||||
|
echo "文件顺序更新成功";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -5097,68 +5097,35 @@ function togglePictureInPicture(videoElement) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function showNotification(message) {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const notification = document.createElement('div');
|
const isSmallScreen = window.innerWidth <= 768;
|
||||||
notification.style.position = 'fixed';
|
|
||||||
notification.style.top = '10px';
|
|
||||||
notification.style.right = '10px';
|
|
||||||
notification.style.padding = '10px';
|
|
||||||
notification.style.backgroundColor = '#4CAF50';
|
|
||||||
notification.style.color = '#fff';
|
|
||||||
notification.style.borderRadius = '5px';
|
|
||||||
notification.style.zIndex = 9999;
|
|
||||||
notification.textContent = message;
|
|
||||||
|
|
||||||
document.body.appendChild(notification);
|
if (!isSmallScreen) {
|
||||||
setTimeout(() => {
|
|
||||||
notification.remove();
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', (event) => {
|
|
||||||
var el = document.getElementById('fileTableBody');
|
var el = document.getElementById('fileTableBody');
|
||||||
|
|
||||||
if (window.innerWidth <= 768) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var sortable = new Sortable(el, {
|
var sortable = new Sortable(el, {
|
||||||
|
handle: '.file-preview',
|
||||||
animation: 150,
|
animation: 150,
|
||||||
onEnd: function (evt) {
|
onEnd: function (evt) {
|
||||||
var order = sortable.toArray();
|
updateFileOrder();
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: 'order_handler.php',
|
|
||||||
data: { order: order },
|
|
||||||
success: function (response) {
|
|
||||||
showNotification('排序已成功保存!');
|
|
||||||
},
|
|
||||||
error: function (xhr, status, error) {
|
|
||||||
showNotification('保存排序时出错: ' + error);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
|
function updateFileOrder() {
|
||||||
|
const fileOrder = [];
|
||||||
|
|
||||||
|
document.querySelectorAll('.file-preview').forEach(item => {
|
||||||
|
const fileName = item.querySelector('input').value;
|
||||||
|
fileOrder.push(fileName);
|
||||||
});
|
});
|
||||||
|
|
||||||
$.ajax({
|
const xhr = new XMLHttpRequest();
|
||||||
type: 'GET',
|
xhr.open('POST', 'order_handler.php', true);
|
||||||
url: 'order_handler.php',
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||||
success: function (response) {
|
xhr.send('fileOrder=' + JSON.stringify(fileOrder));
|
||||||
var savedOrder = JSON.parse(response);
|
|
||||||
var fileTableBody = document.getElementById('fileTableBody');
|
|
||||||
var rows = Array.from(fileTableBody.children);
|
|
||||||
rows.sort(function(a, b) {
|
|
||||||
return savedOrder.indexOf(a.id) - savedOrder.indexOf(b.id);
|
|
||||||
});
|
|
||||||
rows.forEach(function(row) {
|
|
||||||
fileTableBody.appendChild(row);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error: function (xhr, status, error) {
|
|
||||||
console.error('加载排序时出错: ' + error);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -352,15 +352,17 @@ get_geoip() {
|
||||||
local geoip_type_flag=""
|
local geoip_type_flag=""
|
||||||
local geoip_path="$(config_t_get global_rules v2ray_location_asset)"
|
local geoip_path="$(config_t_get global_rules v2ray_location_asset)"
|
||||||
geoip_path="${geoip_path%*/}/geoip.dat"
|
geoip_path="${geoip_path%*/}/geoip.dat"
|
||||||
[ -s "$geoip_path" ] || { echo ""; return; }
|
[ -s "$geoip_path" ] || { echo ""; return 1; }
|
||||||
case "$2" in
|
case "$2" in
|
||||||
"ipv4") geoip_type_flag="-ipv6=false" ;;
|
"ipv4") geoip_type_flag="-ipv6=false" ;;
|
||||||
"ipv6") geoip_type_flag="-ipv4=false" ;;
|
"ipv6") geoip_type_flag="-ipv4=false" ;;
|
||||||
esac
|
esac
|
||||||
if type geoview &> /dev/null; then
|
if type geoview &> /dev/null; then
|
||||||
geoview -input "$geoip_path" -list "$geoip_code" $geoip_type_flag -lowmem=true
|
geoview -input "$geoip_path" -list "$geoip_code" $geoip_type_flag -lowmem=true
|
||||||
|
return 0
|
||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,10 +90,12 @@ end
|
||||||
local function get_geosite(list_arg, out_path)
|
local function get_geosite(list_arg, out_path)
|
||||||
local geosite_path = uci:get(appname, "@global_rules[0]", "v2ray_location_asset")
|
local geosite_path = uci:get(appname, "@global_rules[0]", "v2ray_location_asset")
|
||||||
geosite_path = geosite_path:match("^(.*)/") .. "/geosite.dat"
|
geosite_path = geosite_path:match("^(.*)/") .. "/geosite.dat"
|
||||||
if not is_file_nonzero(geosite_path) then return end
|
if not is_file_nonzero(geosite_path) then return 1 end
|
||||||
if api.is_finded("geoview") and list_arg and out_path then
|
if api.is_finded("geoview") and list_arg and out_path then
|
||||||
sys.exec("geoview -type geosite -append=true -input " .. geosite_path .. " -list '" .. list_arg .. "' -output " .. out_path)
|
sys.exec("geoview -type geosite -append=true -input " .. geosite_path .. " -list '" .. list_arg .. "' -output " .. out_path)
|
||||||
|
return 0
|
||||||
end
|
end
|
||||||
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if not fs.access(FLAG_PATH) then
|
if not fs.access(FLAG_PATH) then
|
||||||
|
@ -142,8 +144,11 @@ if USE_BLOCK_LIST == "1" and not fs.access(file_block_host) then
|
||||||
f_out:close()
|
f_out:close()
|
||||||
end
|
end
|
||||||
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
||||||
get_geosite(geosite_arg, file_block_host)
|
if get_geosite(geosite_arg, file_block_host) == 0 then
|
||||||
log(" * 解析[屏蔽列表] Geosite 到屏蔽域名表(blocklist)完成")
|
log(" * 解析[屏蔽列表] Geosite 到屏蔽域名表(blocklist)完成")
|
||||||
|
else
|
||||||
|
log(" * 解析[屏蔽列表] Geosite 到屏蔽域名表(blocklist)失败!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if USE_BLOCK_LIST == "1" and is_file_nonzero(file_block_host) then
|
if USE_BLOCK_LIST == "1" and is_file_nonzero(file_block_host) then
|
||||||
|
@ -211,8 +216,11 @@ if USE_DIRECT_LIST == "1" and not fs.access(file_direct_host) then
|
||||||
f_out:close()
|
f_out:close()
|
||||||
end
|
end
|
||||||
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
||||||
get_geosite(geosite_arg, file_direct_host)
|
if get_geosite(geosite_arg, file_direct_host) == 0 then
|
||||||
log(" * 解析[直连列表] Geosite 到域名白名单(whitelist)完成")
|
log(" * 解析[直连列表] Geosite 到域名白名单(whitelist)完成")
|
||||||
|
else
|
||||||
|
log(" * 解析[直连列表] Geosite 到域名白名单(whitelist)失败!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if USE_DIRECT_LIST == "1" and is_file_nonzero(file_direct_host) then
|
if USE_DIRECT_LIST == "1" and is_file_nonzero(file_direct_host) then
|
||||||
|
@ -254,8 +262,11 @@ if USE_PROXY_LIST == "1" and not fs.access(file_proxy_host) then
|
||||||
f_out:close()
|
f_out:close()
|
||||||
end
|
end
|
||||||
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
||||||
get_geosite(geosite_arg, file_proxy_host)
|
if get_geosite(geosite_arg, file_proxy_host) == 0 then
|
||||||
log(" * 解析[代理列表] Geosite 到代理域名表(blacklist)完成")
|
log(" * 解析[代理列表] Geosite 到代理域名表(blacklist)完成")
|
||||||
|
else
|
||||||
|
log(" * 解析[代理列表] Geosite 到代理域名表(blacklist)失败!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if USE_PROXY_LIST == "1" and is_file_nonzero(file_proxy_host) then
|
if USE_PROXY_LIST == "1" and is_file_nonzero(file_proxy_host) then
|
||||||
|
@ -404,13 +415,18 @@ if uci:get(appname, TCP_NODE, "protocol") == "_shunt" then
|
||||||
end
|
end
|
||||||
|
|
||||||
if GFWLIST == "1" and CHNLIST == "0" and USE_GEOVIEW == "1" and api.is_finded("geoview") then --仅GFW模式解析geosite
|
if GFWLIST == "1" and CHNLIST == "0" and USE_GEOVIEW == "1" and api.is_finded("geoview") then --仅GFW模式解析geosite
|
||||||
|
local return_white, return_shunt
|
||||||
if geosite_white_arg ~= "" then
|
if geosite_white_arg ~= "" then
|
||||||
get_geosite(geosite_white_arg, file_white_host)
|
return_white = get_geosite(geosite_white_arg, file_white_host)
|
||||||
end
|
end
|
||||||
if geosite_shunt_arg ~= "" then
|
if geosite_shunt_arg ~= "" then
|
||||||
get_geosite(geosite_shunt_arg, file_shunt_host)
|
return_shunt = get_geosite(geosite_shunt_arg, file_shunt_host)
|
||||||
end
|
end
|
||||||
|
if (return_white == nil or return_white == 0) and (return_shunt == nil or return_shunt == 0) then
|
||||||
log(" * 解析[分流节点] Geosite 完成")
|
log(" * 解析[分流节点] Geosite 完成")
|
||||||
|
else
|
||||||
|
log(" * 解析[分流节点] Geosite 失败!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local sets = {
|
local sets = {
|
||||||
|
|
|
@ -94,10 +94,12 @@ end
|
||||||
local function get_geosite(list_arg, out_path)
|
local function get_geosite(list_arg, out_path)
|
||||||
local geosite_path = uci:get(appname, "@global_rules[0]", "v2ray_location_asset")
|
local geosite_path = uci:get(appname, "@global_rules[0]", "v2ray_location_asset")
|
||||||
geosite_path = geosite_path:match("^(.*)/") .. "/geosite.dat"
|
geosite_path = geosite_path:match("^(.*)/") .. "/geosite.dat"
|
||||||
if not is_file_nonzero(geosite_path) then return end
|
if not is_file_nonzero(geosite_path) then return 1 end
|
||||||
if api.is_finded("geoview") and list_arg and out_path then
|
if api.is_finded("geoview") and list_arg and out_path then
|
||||||
sys.exec("geoview -type geosite -append=true -input " .. geosite_path .. " -list '" .. list_arg .. "' -output " .. out_path)
|
sys.exec("geoview -type geosite -append=true -input " .. geosite_path .. " -list '" .. list_arg .. "' -output " .. out_path)
|
||||||
|
return 0
|
||||||
end
|
end
|
||||||
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if not fs.access(FLAG_PATH) then
|
if not fs.access(FLAG_PATH) then
|
||||||
|
@ -257,8 +259,11 @@ if USE_BLOCK_LIST == "1" and not fs.access(file_block_host) then
|
||||||
f_out:close()
|
f_out:close()
|
||||||
end
|
end
|
||||||
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
||||||
get_geosite(geosite_arg, file_block_host)
|
if get_geosite(geosite_arg, file_block_host) == 0 then
|
||||||
log(" * 解析[屏蔽列表] Geosite 到屏蔽域名表(blocklist)完成")
|
log(" * 解析[屏蔽列表] Geosite 到屏蔽域名表(blocklist)完成")
|
||||||
|
else
|
||||||
|
log(" * 解析[屏蔽列表] Geosite 到屏蔽域名表(blocklist)失败!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if USE_BLOCK_LIST == "1" and is_file_nonzero(file_block_host) then
|
if USE_BLOCK_LIST == "1" and is_file_nonzero(file_block_host) then
|
||||||
|
@ -329,8 +334,11 @@ if USE_DIRECT_LIST == "1" and not fs.access(file_direct_host) then
|
||||||
f_out:close()
|
f_out:close()
|
||||||
end
|
end
|
||||||
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
||||||
get_geosite(geosite_arg, file_direct_host)
|
if get_geosite(geosite_arg, file_direct_host) == 0 then
|
||||||
log(" * 解析[直连列表] Geosite 到域名白名单(whitelist)完成")
|
log(" * 解析[直连列表] Geosite 到域名白名单(whitelist)完成")
|
||||||
|
else
|
||||||
|
log(" * 解析[直连列表] Geosite 到域名白名单(whitelist)失败!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if USE_DIRECT_LIST == "1" and is_file_nonzero(file_direct_host) then
|
if USE_DIRECT_LIST == "1" and is_file_nonzero(file_direct_host) then
|
||||||
|
@ -374,8 +382,11 @@ if USE_PROXY_LIST == "1" and not fs.access(file_proxy_host) then
|
||||||
f_out:close()
|
f_out:close()
|
||||||
end
|
end
|
||||||
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
||||||
get_geosite(geosite_arg, file_proxy_host)
|
if get_geosite(geosite_arg, file_proxy_host) == 0 then
|
||||||
log(" * 解析[代理列表] Geosite 到代理域名表(blacklist)完成")
|
log(" * 解析[代理列表] Geosite 到代理域名表(blacklist)完成")
|
||||||
|
else
|
||||||
|
log(" * 解析[代理列表] Geosite 到代理域名表(blacklist)失败!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if USE_PROXY_LIST == "1" and is_file_nonzero(file_proxy_host) then
|
if USE_PROXY_LIST == "1" and is_file_nonzero(file_proxy_host) then
|
||||||
|
@ -536,13 +547,18 @@ if uci:get(appname, TCP_NODE, "protocol") == "_shunt" then
|
||||||
end
|
end
|
||||||
|
|
||||||
if USE_GFW_LIST == "1" and CHN_LIST == "0" and USE_GEOVIEW == "1" and api.is_finded("geoview") then --仅GFW模式解析geosite
|
if USE_GFW_LIST == "1" and CHN_LIST == "0" and USE_GEOVIEW == "1" and api.is_finded("geoview") then --仅GFW模式解析geosite
|
||||||
|
local return_white, return_shunt
|
||||||
if geosite_white_arg ~= "" then
|
if geosite_white_arg ~= "" then
|
||||||
get_geosite(geosite_white_arg, file_white_host)
|
return_white = get_geosite(geosite_white_arg, file_white_host)
|
||||||
end
|
end
|
||||||
if geosite_shunt_arg ~= "" then
|
if geosite_shunt_arg ~= "" then
|
||||||
get_geosite(geosite_shunt_arg, file_shunt_host)
|
return_shunt = get_geosite(geosite_shunt_arg, file_shunt_host)
|
||||||
end
|
end
|
||||||
|
if (return_white == nil or return_white == 0) and (return_shunt == nil or return_shunt == 0) then
|
||||||
log(" * 解析[分流节点] Geosite 完成")
|
log(" * 解析[分流节点] Geosite 完成")
|
||||||
|
else
|
||||||
|
log(" * 解析[分流节点] Geosite 失败!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_file_nonzero(file_white_host) then
|
if is_file_nonzero(file_white_host) then
|
||||||
|
|
|
@ -30,13 +30,13 @@ define Download/geosite
|
||||||
HASH:=797e75a9cf898b45101510b809a8cf8d1b0ea939c0cf57e889a703146a6ae3c5
|
HASH:=797e75a9cf898b45101510b809a8cf8d1b0ea939c0cf57e889a703146a6ae3c5
|
||||||
endef
|
endef
|
||||||
|
|
||||||
GEOSITE_IRAN_VER:=202502100035
|
GEOSITE_IRAN_VER:=202502101404
|
||||||
GEOSITE_IRAN_FILE:=iran.dat.$(GEOSITE_IRAN_VER)
|
GEOSITE_IRAN_FILE:=iran.dat.$(GEOSITE_IRAN_VER)
|
||||||
define Download/geosite-ir
|
define Download/geosite-ir
|
||||||
URL:=https://github.com/bootmortis/iran-hosted-domains/releases/download/$(GEOSITE_IRAN_VER)/
|
URL:=https://github.com/bootmortis/iran-hosted-domains/releases/download/$(GEOSITE_IRAN_VER)/
|
||||||
URL_FILE:=iran.dat
|
URL_FILE:=iran.dat
|
||||||
FILE:=$(GEOSITE_IRAN_FILE)
|
FILE:=$(GEOSITE_IRAN_FILE)
|
||||||
HASH:=bec5ab1d4d30e2b928328001808b81b8043515efa4fed38e0c1a3cfbf7a12f0f
|
HASH:=dd98becb334d21a4f780fac38e8c7be101dd5a9809e6607dde1f695875c0966d
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/v2ray-geodata/template
|
define Package/v2ray-geodata/template
|
||||||
|
|
Loading…
Reference in New Issue