mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 17:45:14 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=3proxy simple webUI
|
||||
LUCI_DEPENDS:=+3proxy
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_VERSION:=0.1.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -0,0 +1,2 @@
|
||||
# luci-app-3proxy
|
||||
Simple webUI OpenWrt Luci for 3proxy
|
||||
@@ -0,0 +1,111 @@
|
||||
'use strict';
|
||||
'require fs';
|
||||
'require view';
|
||||
'require ui';
|
||||
'require uci';
|
||||
|
||||
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return uci.load('3proxy');
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var configPath = '/etc/3proxy.cfg';
|
||||
|
||||
uci.sections('3proxy', '3proxy').forEach(function(s) {
|
||||
if (s['.type'] === '3proxy' && s.config) {
|
||||
configPath = s.config;
|
||||
}
|
||||
});
|
||||
|
||||
this.configPath = configPath;
|
||||
|
||||
var container = E('div', { 'class': 'cbi-map' }, [
|
||||
E('h2', {}, _('3proxy Configuration')),
|
||||
E('div', { 'class': 'cbi-section' }, [
|
||||
E('div', { 'class': 'cbi-section-descr' }, [
|
||||
_('Edit 3proxy configuration file.'),
|
||||
E('br'),
|
||||
_('Config file: '),
|
||||
E('code', {}, configPath)
|
||||
]),
|
||||
E('div', { 'class': 'cbi-value' }, [
|
||||
E('label', {
|
||||
'class': 'cbi-value-title',
|
||||
'style': 'display: block; font-weight: bold;'
|
||||
}, _('Configuration')),
|
||||
E('br'), E('br'),
|
||||
E('textarea', {
|
||||
'class': 'cbi-input-textarea',
|
||||
'rows': 20,
|
||||
'style': 'width: 100%; box-sizing: border-box;',
|
||||
'name': 'config',
|
||||
'id': 'config-textarea'
|
||||
}, '')
|
||||
]),
|
||||
E('div', {
|
||||
'class': 'cbi-value',
|
||||
'style': 'display: flex; justify-content: flex-end; margin-top: 20px; gap: 10px;'
|
||||
}, [
|
||||
E('div', { 'class': 'cbi-value-field right' }, [
|
||||
E('button', {
|
||||
'class': 'cbi-button cbi-button-save',
|
||||
'click': ui.createHandlerFn(this, 'saveConfig')
|
||||
}, _('Save')),
|
||||
' ',
|
||||
E('button', {
|
||||
'class': 'cbi-button cbi-button-apply',
|
||||
'click': ui.createHandlerFn(this, 'restartService')
|
||||
}, _('Restart 3proxy'))
|
||||
])
|
||||
])
|
||||
])
|
||||
]);
|
||||
|
||||
var self = this;
|
||||
fs.read(configPath).catch(function(err) {
|
||||
return '';
|
||||
}).then(function(content) {
|
||||
var textarea = document.getElementById('config-textarea');
|
||||
if (textarea) {
|
||||
textarea.value = content || '';
|
||||
}
|
||||
});
|
||||
|
||||
return container;
|
||||
},
|
||||
|
||||
saveConfig: function() {
|
||||
var textarea = document.querySelector('textarea[name="config"]');
|
||||
if (!textarea) {
|
||||
textarea = document.getElementById('config-textarea');
|
||||
}
|
||||
|
||||
var config = textarea.value.trim().replace(/\r\n/g, '\n') + '\n';
|
||||
|
||||
var configPath = this.configPath || '/etc/3proxy.cfg';
|
||||
|
||||
return fs.write(configPath, config).then(function() {
|
||||
ui.addNotification(null, E('p', _('Configuration saved successfully')), 'info');
|
||||
}).catch(function(err) {
|
||||
ui.addNotification(null, E('p', _('Error saving configuration: ') + err.message), 'error');
|
||||
});
|
||||
},
|
||||
|
||||
restartService: function() {
|
||||
return fs.exec('/etc/init.d/3proxy', ['restart']).then(function(res) {
|
||||
if (res.code === 0) {
|
||||
ui.addNotification(null, E('p', _('3proxy restarted successfully')), 'info');
|
||||
} else {
|
||||
ui.addNotification(null, E('p', _('Error restarting 3proxy: ') + res.stderr), 'error');
|
||||
}
|
||||
}).catch(function(err) {
|
||||
ui.addNotification(null, E('p', _('Error restarting 3proxy: ') + err.message), 'error');
|
||||
});
|
||||
},
|
||||
|
||||
handleSaveApply: null,
|
||||
handleSave: null,
|
||||
handleReset: null
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
"Language: ru\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Last-Translator: Konstantine Shevlakov <shevlakov@132lan.ru>\n"
|
||||
|
||||
msgid "Configuration"
|
||||
msgstr "Настройки"
|
||||
|
||||
msgid "3proxy Configuration"
|
||||
msgstr "Файл настройки 3proxy."
|
||||
|
||||
msgid "Config file: "
|
||||
msgstr "Файл настройки: "
|
||||
|
||||
msgid "Edit 3proxy configuration file."
|
||||
msgstr "Редактируйте файл настройки."
|
||||
|
||||
msgid "Save"
|
||||
msgstr "Сохранить"
|
||||
|
||||
msgid "Restart 3proxy"
|
||||
msgstr "Перезапустить 3proxy"
|
||||
|
||||
msgid "Configuration saved successfully"
|
||||
msgstr "Конфигурация сохранена"
|
||||
|
||||
msgid "Error saving configuration: "
|
||||
msgstr "Ошибка сохранения: "
|
||||
|
||||
msgid "3proxy restarted successfully"
|
||||
msgstr "3proxy успешно перезапущен"
|
||||
|
||||
msgid "Error restarting 3proxy: "
|
||||
msgstr "Ошибка запуска 3proxy: "
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"admin/services/3proxy": {
|
||||
"title": "3proxy",
|
||||
"action": {
|
||||
"type": "alias",
|
||||
"path": "admin/services/3proxy/config"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-3proxy" ],
|
||||
"uci": { "3proxy": true }
|
||||
}
|
||||
},
|
||||
"admin/services/3proxy/config": {
|
||||
"title": "Config",
|
||||
"order": 41,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "proxy/3proxy"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"luci-app-3proxy": {
|
||||
"description": "Grant UCI access for luci-app-3proxy",
|
||||
"read": {
|
||||
"file": {
|
||||
"/etc/3proxy.cfg": [ "read" ],
|
||||
"/etc/init.d/3proxy": [ "exec" ]
|
||||
},
|
||||
"uci": [ "3proxy" ]
|
||||
},
|
||||
"write": {
|
||||
"file": {
|
||||
"/etc/3proxy.cfg": [ "write" ]
|
||||
},
|
||||
"uci": [ "3proxy" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user