Compare commits

..

10 Commits

Author SHA1 Message Date
itdoginfo
16c174d624 v0.3.10 2025-02-18 13:21:52 +03:00
itdoginfo
1c02a2208b Stop service before rm 2025-02-18 13:21:31 +03:00
itdoginfo
2c93e98755 Merge pull request #29 from itdoginfo/feature/web-versions-view
feat: add validation and warning messages for regional lists
2025-02-18 13:16:04 +03:00
Ivan K
66b179f282 fix: add extra configurations section to podkop.js 2025-02-18 13:01:15 +03:00
itdoginfo
4bbaae776c Merge pull request #28 from vernette/main
fix(install): resolve update failure due to improper cleanup
2025-02-18 12:52:30 +03:00
Ivan K
e31f313819 feat: add validation and warning messages for regional options in podkop.js 2025-02-18 12:49:24 +03:00
unknown
bd0e33781f fix(install): correct continue logic for existing package files 2025-02-18 12:06:33 +03:00
Nikita Skryabin
ade2b844ec fix(init.d/podkop): change rm command to remove only *.lst files in /tmp/podkop directory 2025-02-18 10:05:34 +03:00
Nikita Skryabin
6f997a6e73 refactor(install.sh): improve download retry logic 2025-02-18 09:59:01 +03:00
Nikita Skryabin
744de6aec2 chore(install.sh): replace rm command with find 2025-02-18 09:45:49 +03:00
8 changed files with 134 additions and 25 deletions

View File

@@ -155,6 +155,7 @@ Luci: Services/podkop
- [ ] Валидации предустановленных значений. Если прописаны другие, то вывод в лог о неизвестной переменной и продолжение работы
- [ ] Добавление в список доменов домены первого уровня (LuCI)
- [ ] Проверка, что версия в makefile совпадает с тегом
- [ ] Don't touch my DHCP!
Приоритет 2
- [x] Списки доменов и подсетей с роутера

View File

@@ -43,30 +43,36 @@ main() {
add_tunnel
fi
wget -qO- "$REPO" | grep -o 'https://[^"[:space:]]*\.ipk' | while read -r url; do
download_success=0
while read -r url; do
filename=$(basename "$url")
filepath="$DOWNLOAD_DIR/$filename"
attempt=0
while [ $attempt -lt $COUNT ]; do
if [ -f "$filepath" ] && [ -s "$filepath" ]; then
echo "$filename has already been uploaded"
break
fi
echo "Download $filename (count $((attempt+1)))..."
wget -q -O "$filepath" "$url"
if [ -s "$filepath" ]; then
echo "$filename successfully downloaded"
else
echo "Download error $filename. Retry..."
rm -f "$filepath"
if wget -q -O "$filepath" "$url"; then
if [ -s "$filepath" ]; then
echo "$filename successfully downloaded"
download_success=1
break
fi
fi
echo "Download error $filename. Retry..."
rm -f "$filepath"
attempt=$((attempt+1))
done
done
if [ $attempt -eq $COUNT ]; then
echo "Failed to download $filename after $COUNT attempts"
fi
done < <(wget -qO- "$REPO" | grep -o 'https://[^"[:space:]]*\.ipk')
if [ $download_success -eq 0 ]; then
echo "No packages were downloaded successfully"
exit 1
fi
for pkg in podkop luci-app-podkop; do
file=$(ls "$DOWNLOAD_DIR" | grep "^$pkg" | head -n 1)
if [ -n "$file" ]; then
@@ -96,8 +102,7 @@ main() {
done
fi
rm -f $DOWNLOAD_DIR/podkop*.ipk $DOWNLOAD_DIR/luci-app-podkop*.ipk $DOWNLOAD_DIR/luci-i18n-podkop-ru*.ipk
find "$DOWNLOAD_DIR" -type f -name '*podkop*' -exec rm {} \;
if [ "$IS_SHOULD_RESTART_NETWORK" ]; then
printf "\033[32;1mRestart network\033[0m\n"
@@ -429,4 +434,4 @@ sing_box() {
fi
}
main
main

View File

@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-podkop
PKG_VERSION:=0.3.9
PKG_VERSION:=0.3.10
PKG_RELEASE:=1
LUCI_TITLE:=LuCI podkop app

View File

@@ -112,6 +112,76 @@ return view.extend({
o.rmempty = false;
o.ucisection = 'main';
let lastValues = [];
let isProcessing = false;
o.onchange = function (ev, section_id, value) {
if (isProcessing) return;
isProcessing = true;
try {
const values = Array.isArray(value) ? value : [value];
let newValues = [...values];
let notifications = [];
// Проверка взаимоисключающих региональных опций
const regionalOptions = ['russia_inside', 'russia_outside', 'ukraine_inside'];
const selectedRegionalOptions = regionalOptions.filter(opt => newValues.includes(opt));
if (selectedRegionalOptions.length > 1) {
// Оставляем только последний выбранный региональный вариант
const lastSelected = selectedRegionalOptions[selectedRegionalOptions.length - 1];
const removedRegions = selectedRegionalOptions.slice(0, -1);
newValues = newValues.filter(v => v === lastSelected || !regionalOptions.includes(v));
const warningMsg = _('Warning: %s cannot be used together with %s. Previous selections have been removed.').format(
removedRegions.join(', '),
lastSelected
);
notifications.push(E('p', { class: 'alert-message warning' }, [
E('strong', {}, _('Regional options cannot be used together')), E('br'),
warningMsg
]));
}
// Специальная обработка для russia_inside
if (newValues.includes('russia_inside')) {
const allowedWithRussiaInside = ['russia_inside', 'meta', 'twitter', 'discord', 'telegram'];
const removedServices = newValues.filter(v => !allowedWithRussiaInside.includes(v));
if (removedServices.length > 0) {
newValues = newValues.filter(v => allowedWithRussiaInside.includes(v));
const warningMsg = _('Warning: Russia inside can only be used with Meta, Twitter, Discord, and Telegram. %s have been removed from selection.').format(
removedServices.join(', ')
);
notifications.push(E('p', { class: 'alert-message warning' }, [
E('strong', {}, _('Russia inside restrictions')), E('br'),
warningMsg
]));
}
}
// Если были изменения, обновляем значения
if (JSON.stringify(newValues.sort()) !== JSON.stringify(values.sort())) {
this.getUIElement(section_id).setValue(newValues);
}
// Показываем все накопленные уведомления
notifications.forEach(notification => {
ui.addNotification(null, notification);
});
lastValues = newValues;
} catch (e) {
console.error('Error in onchange handler:', e);
} finally {
isProcessing = false;
}
};
o = s.taboption('basic', form.ListValue, 'custom_domains_list_type', _('User Domain List Type'), _('Select how to add your custom domains'));
o.value('disabled', _('Disabled'));
o.value('dynamic', _('Dynamic List'));
@@ -844,7 +914,6 @@ return view.extend({
});
};
// Add new section 'extra'
var s = m.section(form.TypedSection, 'extra', _('Extra configurations'));
s.anonymous = false;

View File

@@ -461,4 +461,20 @@ msgid "Show Sing-Box Config"
msgstr "Показать конфигурацию Sing-Box"
msgid "Lists Update Results"
msgstr "Результаты обновления списков"
msgstr "Результаты обновления списков"
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
msgid "Warning: %s cannot be used together with %s. Previous selections have been removed."
msgstr "Предупреждение: %s нельзя использовать вместе с %s. Предыдущие варианты были удалены."
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
msgid "Warning: Russia inside can only be used with Meta, Twitter, Discord, and Telegram. %s have been removed from selection."
msgstr "Внимание: Russia inside может использоваться только с Meta, Twitter, Discord и Telegram. %s были удалены из выбора."
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
msgid "Regional options cannot be used together"
msgstr "Нельзя использовать несколько региональных опций"
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
msgid "Russia inside restrictions"
msgstr "Ограничения Russia inside"

View File

@@ -461,4 +461,20 @@ msgid "Show Sing-Box Config"
msgstr ""
msgid "Lists Update Results"
msgstr ""
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
msgid "Warning: %s cannot be used together with %s. Previous selections have been removed."
msgstr ""
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
msgid "Warning: Russia inside can only be used with Meta, Twitter, Discord, and Telegram. %s have been removed from selection."
msgstr ""
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
msgid "Regional options cannot be used together"
msgstr ""
#: applications/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js:XXX
msgid "Russia inside restrictions"
msgstr ""

View File

@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=podkop
PKG_VERSION:=0.3.9
PKG_VERSION:=0.3.10
PKG_RELEASE:=1
PKG_MAINTAINER:=ITDog <podkop@itdog.info>
@@ -33,6 +33,8 @@ define Package/podkop/prerm
grep -q "105 podkop" /etc/iproute2/rt_tables && sed -i "/105 podkop/d" /etc/iproute2/rt_tables
/etc/init.d/podkop stop
exit 0
endef

View File

@@ -73,7 +73,7 @@ stop_service() {
remove_cron_job
dnsmasq_rm
rm -rf /tmp/podkop/*
rm -rf /tmp/podkop/*.lst
log "Flush nft"
if nft list table inet PodkopTable >/dev/null 2>&1; then
@@ -1608,4 +1608,4 @@ show_config() {
show_version() {
local version=$(opkg info podkop | grep -m 1 "Version:" | cut -d' ' -f2)
echo "$version"
}
}