update 2025-02-11 00:25:28
This commit is contained in:
parent
6b426cf259
commit
8352ff3d40
|
@ -1,30 +1,24 @@
|
|||
<?php
|
||||
$backgroundHistoryFile = $_SERVER['DOCUMENT_ROOT'] . '/nekobox/background_history.txt';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['order'])) {
|
||||
$order = $_POST['order'];
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['fileOrder'])) {
|
||||
$fileOrder = json_decode($_POST['fileOrder'], true);
|
||||
$backgroundHistoryFile = $_SERVER['DOCUMENT_ROOT'] . '/nekobox/background_history.txt';
|
||||
|
||||
$existingData = [];
|
||||
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);
|
||||
$mergedData = array_merge($existingData, $fileOrder);
|
||||
|
||||
$uniqueData = [];
|
||||
foreach ($fileOrder as $file) {
|
||||
if (!in_array($file, $uniqueData)) {
|
||||
$uniqueData[] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents($backgroundHistoryFile, implode(PHP_EOL, $newOrder));
|
||||
echo '排序已保存';
|
||||
} else {
|
||||
echo '背景历史文件不存在';
|
||||
}
|
||||
} 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>
|
||||
function showNotification(message) {
|
||||
const notification = document.createElement('div');
|
||||
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.addEventListener('DOMContentLoaded', function () {
|
||||
const isSmallScreen = window.innerWidth <= 768;
|
||||
|
||||
document.body.appendChild(notification);
|
||||
setTimeout(() => {
|
||||
notification.remove();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
if (!isSmallScreen) {
|
||||
var el = document.getElementById('fileTableBody');
|
||||
|
||||
if (window.innerWidth <= 768) {
|
||||
return;
|
||||
}
|
||||
|
||||
var sortable = new Sortable(el, {
|
||||
animation: 150,
|
||||
handle: '.file-preview',
|
||||
animation: 150,
|
||||
onEnd: function (evt) {
|
||||
var order = sortable.toArray();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'order_handler.php',
|
||||
data: { order: order },
|
||||
success: function (response) {
|
||||
showNotification('排序已成功保存!');
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
showNotification('保存排序时出错: ' + error);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: 'order_handler.php',
|
||||
success: function (response) {
|
||||
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);
|
||||
updateFileOrder();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function updateFileOrder() {
|
||||
const fileOrder = [];
|
||||
|
||||
document.querySelectorAll('.file-preview').forEach(item => {
|
||||
const fileName = item.querySelector('input').value;
|
||||
fileOrder.push(fileName);
|
||||
});
|
||||
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', 'order_handler.php', true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
xhr.send('fileOrder=' + JSON.stringify(fileOrder));
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -352,15 +352,17 @@ get_geoip() {
|
|||
local geoip_type_flag=""
|
||||
local geoip_path="$(config_t_get global_rules v2ray_location_asset)"
|
||||
geoip_path="${geoip_path%*/}/geoip.dat"
|
||||
[ -s "$geoip_path" ] || { echo ""; return; }
|
||||
[ -s "$geoip_path" ] || { echo ""; return 1; }
|
||||
case "$2" in
|
||||
"ipv4") geoip_type_flag="-ipv6=false" ;;
|
||||
"ipv6") geoip_type_flag="-ipv4=false" ;;
|
||||
esac
|
||||
if type geoview &> /dev/null; then
|
||||
geoview -input "$geoip_path" -list "$geoip_code" $geoip_type_flag -lowmem=true
|
||||
return 0
|
||||
else
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -90,10 +90,12 @@ end
|
|||
local function get_geosite(list_arg, out_path)
|
||||
local geosite_path = uci:get(appname, "@global_rules[0]", "v2ray_location_asset")
|
||||
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
|
||||
sys.exec("geoview -type geosite -append=true -input " .. geosite_path .. " -list '" .. list_arg .. "' -output " .. out_path)
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
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()
|
||||
end
|
||||
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
||||
get_geosite(geosite_arg, file_block_host)
|
||||
log(" * 解析[屏蔽列表] Geosite 到屏蔽域名表(blocklist)完成")
|
||||
if get_geosite(geosite_arg, file_block_host) == 0 then
|
||||
log(" * 解析[屏蔽列表] Geosite 到屏蔽域名表(blocklist)完成")
|
||||
else
|
||||
log(" * 解析[屏蔽列表] Geosite 到屏蔽域名表(blocklist)失败!")
|
||||
end
|
||||
end
|
||||
end
|
||||
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()
|
||||
end
|
||||
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
||||
get_geosite(geosite_arg, file_direct_host)
|
||||
log(" * 解析[直连列表] Geosite 到域名白名单(whitelist)完成")
|
||||
if get_geosite(geosite_arg, file_direct_host) == 0 then
|
||||
log(" * 解析[直连列表] Geosite 到域名白名单(whitelist)完成")
|
||||
else
|
||||
log(" * 解析[直连列表] Geosite 到域名白名单(whitelist)失败!")
|
||||
end
|
||||
end
|
||||
end
|
||||
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()
|
||||
end
|
||||
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
||||
get_geosite(geosite_arg, file_proxy_host)
|
||||
log(" * 解析[代理列表] Geosite 到代理域名表(blacklist)完成")
|
||||
if get_geosite(geosite_arg, file_proxy_host) == 0 then
|
||||
log(" * 解析[代理列表] Geosite 到代理域名表(blacklist)完成")
|
||||
else
|
||||
log(" * 解析[代理列表] Geosite 到代理域名表(blacklist)失败!")
|
||||
end
|
||||
end
|
||||
end
|
||||
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
|
||||
|
||||
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
|
||||
get_geosite(geosite_white_arg, file_white_host)
|
||||
return_white = get_geosite(geosite_white_arg, file_white_host)
|
||||
end
|
||||
if geosite_shunt_arg ~= "" then
|
||||
get_geosite(geosite_shunt_arg, file_shunt_host)
|
||||
return_shunt = get_geosite(geosite_shunt_arg, file_shunt_host)
|
||||
end
|
||||
if (return_white == nil or return_white == 0) and (return_shunt == nil or return_shunt == 0) then
|
||||
log(" * 解析[分流节点] Geosite 完成")
|
||||
else
|
||||
log(" * 解析[分流节点] Geosite 失败!")
|
||||
end
|
||||
log(" * 解析[分流节点] Geosite 完成")
|
||||
end
|
||||
|
||||
local sets = {
|
||||
|
|
|
@ -94,10 +94,12 @@ end
|
|||
local function get_geosite(list_arg, out_path)
|
||||
local geosite_path = uci:get(appname, "@global_rules[0]", "v2ray_location_asset")
|
||||
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
|
||||
sys.exec("geoview -type geosite -append=true -input " .. geosite_path .. " -list '" .. list_arg .. "' -output " .. out_path)
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
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()
|
||||
end
|
||||
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
||||
get_geosite(geosite_arg, file_block_host)
|
||||
log(" * 解析[屏蔽列表] Geosite 到屏蔽域名表(blocklist)完成")
|
||||
if get_geosite(geosite_arg, file_block_host) == 0 then
|
||||
log(" * 解析[屏蔽列表] Geosite 到屏蔽域名表(blocklist)完成")
|
||||
else
|
||||
log(" * 解析[屏蔽列表] Geosite 到屏蔽域名表(blocklist)失败!")
|
||||
end
|
||||
end
|
||||
end
|
||||
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()
|
||||
end
|
||||
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
||||
get_geosite(geosite_arg, file_direct_host)
|
||||
log(" * 解析[直连列表] Geosite 到域名白名单(whitelist)完成")
|
||||
if get_geosite(geosite_arg, file_direct_host) == 0 then
|
||||
log(" * 解析[直连列表] Geosite 到域名白名单(whitelist)完成")
|
||||
else
|
||||
log(" * 解析[直连列表] Geosite 到域名白名单(whitelist)失败!")
|
||||
end
|
||||
end
|
||||
end
|
||||
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()
|
||||
end
|
||||
if USE_GEOVIEW == "1" and geosite_arg ~= "" and api.is_finded("geoview") then
|
||||
get_geosite(geosite_arg, file_proxy_host)
|
||||
log(" * 解析[代理列表] Geosite 到代理域名表(blacklist)完成")
|
||||
if get_geosite(geosite_arg, file_proxy_host) == 0 then
|
||||
log(" * 解析[代理列表] Geosite 到代理域名表(blacklist)完成")
|
||||
else
|
||||
log(" * 解析[代理列表] Geosite 到代理域名表(blacklist)失败!")
|
||||
end
|
||||
end
|
||||
end
|
||||
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
|
||||
|
||||
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
|
||||
get_geosite(geosite_white_arg, file_white_host)
|
||||
return_white = get_geosite(geosite_white_arg, file_white_host)
|
||||
end
|
||||
if geosite_shunt_arg ~= "" then
|
||||
get_geosite(geosite_shunt_arg, file_shunt_host)
|
||||
return_shunt = get_geosite(geosite_shunt_arg, file_shunt_host)
|
||||
end
|
||||
if (return_white == nil or return_white == 0) and (return_shunt == nil or return_shunt == 0) then
|
||||
log(" * 解析[分流节点] Geosite 完成")
|
||||
else
|
||||
log(" * 解析[分流节点] Geosite 失败!")
|
||||
end
|
||||
log(" * 解析[分流节点] Geosite 完成")
|
||||
end
|
||||
|
||||
if is_file_nonzero(file_white_host) then
|
||||
|
|
|
@ -30,13 +30,13 @@ define Download/geosite
|
|||
HASH:=797e75a9cf898b45101510b809a8cf8d1b0ea939c0cf57e889a703146a6ae3c5
|
||||
endef
|
||||
|
||||
GEOSITE_IRAN_VER:=202502100035
|
||||
GEOSITE_IRAN_VER:=202502101404
|
||||
GEOSITE_IRAN_FILE:=iran.dat.$(GEOSITE_IRAN_VER)
|
||||
define Download/geosite-ir
|
||||
URL:=https://github.com/bootmortis/iran-hosted-domains/releases/download/$(GEOSITE_IRAN_VER)/
|
||||
URL_FILE:=iran.dat
|
||||
FILE:=$(GEOSITE_IRAN_FILE)
|
||||
HASH:=bec5ab1d4d30e2b928328001808b81b8043515efa4fed38e0c1a3cfbf7a12f0f
|
||||
HASH:=dd98becb334d21a4f780fac38e8c7be101dd5a9809e6607dde1f695875c0966d
|
||||
endef
|
||||
|
||||
define Package/v2ray-geodata/template
|
||||
|
|
Loading…
Reference in New Issue