Sync 2024-07-19 07:16:23

This commit is contained in:
github-actions[bot] 2024-07-19 07:16:23 +08:00
parent f81c44dd8a
commit 7c8eaabc92
25 changed files with 153 additions and 928 deletions

View File

@ -0,0 +1,51 @@
'use strict';
return L.Class.extend({
desc: function(description, username, project) {
var luci_project = 'luci-app-' + project;
var title = _('if you have any problem, please click to view the project on GitHub : ') + project;
var luci_title = _('if you have any problem, please click to view the luci ui project on GitHub : ') + luci_project;
var package_label = 'package-' + project.replace(/-/g, '_') + '-default';
var luci_label = 'luci-' + project.replace(/-/g, '_') + '-default';
return "<table style='border: 0; table-layout: auto;'>" +
"<tr>" +
"<td style='border: 0;'>" + _(description) + "</td>" +
"<td style='border: 0;'>" +
"<table style='border: 0; table-layout: auto;'>" +
"<tr>" +
"<td style='border: 0;'>" +
"<a href='https://github.com/" + username + "/" + project + "' target='_blank' title='" + title + "'>" +
"<img alt='" + project + "' src='https://img.shields.io/badge/" + package_label + "' />" +
"<img alt='" + project + "' src='https://img.shields.io/github/stars/" + username + "/" + project + "?style=social' />" +
"</a>" +
"<a href='https://github.com/" + username + "/" + luci_project + "' target='_blank' title='" + luci_title + "'>" +
"<img alt='" + luci_project + "' src='https://img.shields.io/badge/" + luci_label + "' />" +
"<img alt='" + luci_project + "' src='https://img.shields.io/github/stars/" + username + "/" + luci_project + "?style=social' />" +
"</a>" +
"</td>" +
"</tr>" +
"</table>" +
"</td>" +
"</tr>" +
"</table>";
},
luci_desc: function(description, username, project) {
var luci_label = 'luci-' + project.replace(/-/g, '_') + '-default';
project = 'luci-app-' + project;
var luci_title = _('if you have any problem, please click to view the luci ui project on GitHub : ') + project;
return "<table style='border: 0; table-layout: auto;'>" +
"<tr>" +
"<td style='border: 0;'>" + _(description) + "</td>" +
"<td style='border: 0;'>" +
"<a href='https://github.com/" + username + "/" + project + "' target='_blank' title='" + luci_title + "'>" +
"<img alt='" + project + "' src='https://img.shields.io/badge/" + luci_label + "' />" +
"<img alt='" + project + "' src='https://img.shields.io/github/stars/" + username + "/" + project + "?style=social' />" +
"</a>" +
"</td>" +
"</tr>" +
"</table>";
}
});

View File

@ -1,14 +0,0 @@
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Support for ss-redir
LUCI_DEPENDS:=+luci-base +ss-redir
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=Dengfeng Liu <liu_df@qq.com>
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -1,42 +0,0 @@
## luci-app-ss-redir
该项目为ss-redir的luci配置界面
### 视频演示
<div align="center">
<a href="https://www.bilibili.com/video/BV18m411d7Yj/?vd_source=b303f6e8e0ed18809d8752d41ab1de7d">
<img width="972" alt="luci-app-ss-redir_intro_video" src="luci-app-ss-redir_intro.png">
</a>
</div>
## 如何集成到openwrt中编译
1. 复制仓库中的文件到如下目录,并执行安装
```
feeds/luci/applications/luci-app-ss-redir/
./scripts/feeds install luci -a
```
2. 选择路径
`make menuconfig`
LuCI > 3. Applications > luci-app-ss-redir
3. 编译openwrt固件
```
make -j4
```
4. 单独编译
```
make package/luci-app-ss-redir/compile
```
## 联系方式
QQ群331230369

View File

@ -1,160 +0,0 @@
'use strict';
'require view';
'require ui';
'require form';
'require rpc';
'require uci';
'require tools.widgets as widgets';
'require tools.github as github';
var methods = [
// aead
'aes-128-gcm',
'aes-192-gcm',
'aes-256-gcm',
'chacha20-ietf-poly1305',
'xchacha20-ietf-poly1305',
// stream
'table',
'rc4',
'rc4-md5',
'aes-128-cfb',
'aes-192-cfb',
'aes-256-cfb',
'aes-128-ctr',
'aes-192-ctr',
'aes-256-ctr',
'bf-cfb',
'camellia-128-cfb',
'camellia-192-cfb',
'camellia-256-cfb',
'salsa20',
'chacha20',
'chacha20-ietf',
];
var callServiceList = rpc.declare({
object: 'service',
method: 'list',
params: ['name'],
expect: { '': {} }
});
function getServiceStatus() {
return L.resolveDefault(callServiceList('ss-redir'), {}).then(function (res) {
var isRunning = false;
try {
isRunning = res['ss-redir']['instances']['instance1']['running'];
} catch (e) { }
return isRunning;
});
}
function renderStatus(isRunning) {
var renderHTML = "";
var spanTemp = '<em><span style="color:%s"><strong>%s %s</strong></span></em>';
if (isRunning) {
renderHTML += String.format(spanTemp, 'green', _("ss-redir "), _("running..."));
} else {
renderHTML += String.format(spanTemp, 'red', _("ss-redir "), _("not running..."));
}
return renderHTML;
}
return view.extend({
load: function() {
return uci.load('kcptun');
},
render: function() {
var m, s, o;
m = new form.Map('ss-redir', _('ss-redir'));
m.description = github.luci_desc('ss-redir redirect tcp service to kcptun client process.', 'liudf0716', 'ss-redir');
// add kcptun-client status section and option
s = m.section(form.NamedSection, '_status');
s.anonymous = true;
s.render = function (section_id) {
L.Poll.add(function () {
return L.resolveDefault(getServiceStatus()).then(function(res) {
var view = document.getElementById("service_status");
view.innerHTML = renderStatus(res);
});
});
return E('div', { class: 'cbi-map' },
E('fieldset', { class: 'cbi-section'}, [
E('p', { id: 'service_status' },
_('Collecting data ...'))
])
);
}
s = m.section(form.NamedSection, 'server', 'ss_redir');
s.dynamic = true;
// add two tabs
s.tab('ss-redir', _('ss-redir Settings'));
s.tab('server', _('Shadowsocks Server Settings'));
// ss-redir settings
o = s.taboption('ss-redir', form.Flag, "enabled", _("Enable"),
_("Enable ss-redir service"));
o.rmempty = false;
// server settings
o = s.taboption('ss-redir', form.Value, "server", _("Server Address"),
_("The address of kcptun client listening on. default: 127.0.0.1"));
o.datatype = "host";
o.rmempty = false;
o.titleref = L.url('admin', 'vpn', 'kcptun');
o = s.taboption('ss-redir', form.Value, "server_port", _("Server Port"),
_("The port of kcptun client listening on. default: 12948"));
o.datatype = "port";
o.rmempty = false;
o.cfgvalue = function(section_id) {
return uci.get_first('kcptun', 'client', 'local_port') || 12948;
};
o = s.taboption('ss-redir', form.Value, "password", _("Password"),
_("The password of shadowsocks server"));
o.password = true;
o.rmempty = false;
o = s.taboption('ss-redir', form.ListValue, "encrypt", _("Encryption Method"),
_("The encryption method of shadowsocks server"));
methods.forEach(function (method) {
o.value(method, method);
});
o.rmempty = false;
// add a textarea to show the config file content
o = s.taboption('server', form.DummyValue, "_config", _("Server Command"),
_("Copy the command to run ss-server on the server side"));
o.rawhtml = true;
o.cfgvalue = function(section_id) {
var server = uci.get('ss-redir', section_id, 'server');
var password = uci.get('ss-redir', section_id, 'password');
var encrypt = uci.get('ss-redir', section_id, 'encrypt');
var kcp_port = uci.get('ss-redir', section_id, 'kcp_port') || 6441;
var config = "ss-server -s " + server + " -p " + kcp_port + " -k " + password + " -m " + encrypt;
return "<textarea style='width:100%;height:50px;'>" + config + "</textarea>";
}
// add a button to copy the command
o = s.taboption('server', form.Button, "_copy", _("Copy Command"));
o.inputstyle = 'apply';
o.inputtitle = _("Copy the command to clipboard");
o.onclick = function(ev) {
var textarea = document.querySelector('textarea');
textarea.select();
document.execCommand('copy');
ui.addNotification(null, E('p', _('Copied to clipboard')), 'info');
};
return m.render();
}
});

View File

@ -1 +0,0 @@
zh_Hans

View File

@ -1,51 +0,0 @@
#: ss-redir package
msgid "ss-redir"
msgstr "SS转发服务"
msgid "ss-redir redirect tcp service to kcptun client process."
msgstr "SS转发服务将TCP流量重定向到本地KCP隧道要结合本地KCP隧道服务一起使用。"
msgid "Shadowsocks Server Settings"
msgstr "Shadowsocks服务器设置"
msgid "ss-redir Settings"
msgstr "SS转发服务设置"
msgid "The address of kcptun client listening on. default: 127.0.0.1"
msgstr "KCP隧道客户端监听地址默认: 127.0.0.1"
msgid "Server Address"
msgstr "服务器地址"
msgid "The port of kcptun client listening on. default: 12948"
msgstr "KCP隧道客户端监听端口默认: 12948"
msgid "The password of shadowsocks server"
msgstr "Shadowsocks服务器密码"
msgid "Server Port"
msgstr "服务器端口"
msgid "Encryption Method"
msgstr "加密方式"
msgid "The encryption method of shadowsocks server"
msgstr "Shadowsocks服务器的加密方式"
msgid "Enable ss-redir service"
msgstr "启用SS转发服务"
msgid "Server Command"
msgstr "服务器端命令"
msgid "Copy the command to run ss-server on the server side"
msgstr "复制在服务器端运行ss-server的命令"
msgid "Copy Command"
msgstr "复制命令"
msgid "Compy the command to clipboard"
msgstr "复制服务器端命令到剪贴板"
msgid "Copied to clipboard"
msgstr "已复制到剪贴板"

View File

@ -1,12 +0,0 @@
{
"admin/vpn/ss-redir": {
"title": "ss-redir",
"action": {
"type": "view",
"path": "ss-redir"
},
"depends": {
"uci": { "ss-redir": true }
}
}
}

View File

@ -1,14 +0,0 @@
{
"luci-app-ss-redir": {
"description": "Grant access to LuCI app ss-redir",
"read": {
"ubus": {
"service": [ "list" ]
},
"uci": ["ss-redir"]
},
"write": {
"uci": ["ss-redir"]
}
}
}

View File

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,13 +0,0 @@
# This is free software, licensed under the Apache License, Version 2.0
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Support for whispercpp
LUCI_DEPENDS:=+whispercpp
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=Dengfeng Liu <liudf0716@gmail.com>
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -1,42 +0,0 @@
## luci-app-whispercpp
该项目为whispercpp的luci配置界面
### 视频演示
<div align="center">
<a href="https://www.bilibili.com/video/BV1Y6421c78d/?vd_source=b303f6e8e0ed18809d8752d41ab1de7d">
<img width="972" alt="luci-app-whispercpp_intro_video" src="luci-app-whispercpp_intro.png">
</a>
</div>
## 如何集成到openwrt中编译
1. 复制仓库中的文件到如下目录,并执行安装
```
feeds/luci/applications/luci-app-whispercpp/
./scripts/feeds install luci -a
```
2. 选择路径
`make menuconfig`
LuCI > 3. Applications > luci-app-whispercpp
3. 编译openwrt固件
```
make -j4
```
4. 单独编译
```
make package/luci-app-whispercpp/compile
```
## 联系方式
QQ群331230369

View File

@ -1,119 +0,0 @@
'use strict';
'require view';
'require ui';
'require form';
'require rpc';
'require fs';
'require tools.widgets as widgets';
'require tools.github as github';
var isReadonlyView = !L.hasViewPermission();
var mapdata = { actions: {}};
var callWhipsercpp = rpc.declare({
object: 'whispercpp',
method: 'whispercpp',
expect: { result: [] }
});
var callFfmpeg = rpc.declare({
object: 'whispercpp',
method: 'ffmpeg',
expect: { result: [] }
});
var isFfmpegOrWhispercppRunning = rpc.declare({
object: 'luci',
method: 'isFfmpegOrWhispercppRunning',
expect: { result: {} }
});
function getServiceStatus() {
return L.resolveDefault(isFfmpegOrWhispercppRunning(), {}).then(function (res) {
if (res['ffmpeg']) {
return 'Converting ...';
} else if (res['whispercpp']) {
return 'Transcribe ...';
} else {
return 'Convert';
}
});
}
return view.extend({
uploadVideo: function(ev) {
return ui.uploadFile('/tmp/video.mp4', ev.target.firstChild)
.then(function(res){
if (res.size > 10*1024*1024) {
ui.addNotification(null, E('p', _('File size should be less than 10M')), 'error');
return fs.remove('/tmp/video.mp4');
}
ui.addNotification(null, E('p', _('Upload video complete')), 'info');
})
.catch(function(e){
ui.addNotification(null, E('p', _('Failed to upload video: %s').format(e)), 'error');
})
.finally(L.bind(function(btn){
btn.firstChild.data = _('Upload');
}, this, ev.target));
},
processVideo: function(ev) {
// find upload button and disable it
var buttons = document.querySelectorAll('.cbi-button-action');
for (var i = 0; i < buttons.length; i++)
buttons[i].setAttribute('disabled', 'true');
return fs.exec('/usr/bin/ffmpeg', ['-i', '/tmp/video.mp4', '-ar', '16000', '-ac', '1', '-c:a', 'pcm_s16le', '-y', '/tmp/output.wav']).then(function(res){
return callWhipsercpp().then(function(res){
ui.addNotification(null, E('p', _('Convert video to SRT file complete')), 'info');
});
})
.catch(function(e){
ui.addNotification(null, E('p', _('Failed to convert video: %s').format(e)), 'error');
})
.finally(function(){
// find upload button and enable it
var buttons = document.querySelectorAll('.cbi-button-action');
for (var i = 0; i < buttons.length; i++)
buttons[i].removeAttribute('disabled');
});
},
render: function() {
var m, s, o, ss;
m = new form.JSONMap(mapdata, _('Whispercpp Process'), _('Whisper is a general-purpose speech recognition model.'));
m.readonly = isReadonlyView;
m.description = github.desc('Whisper is a general-purpose speech recognition model.', 'liudf0716', 'whispercpp');
s = m.section(form.NamedSection, 'actions', _('Actions'));
o = s.option(form.SectionValue, 'actions', form.NamedSection, 'actions', 'actions',
_('Upload'), _('Click "Upload" to upload video file, file size should be less than 5M.'));
ss = o.subsection;
o = ss.option(form.Button, 'upload', _('Upload Video File'));
o.inputstyle = 'action important';
o.inputtitle = _('Upload');
o.onclick = L.bind(this.uploadVideo, this);
o = s.option(form.SectionValue, 'actions', form.NamedSection, 'actions', 'actions',
_('Convert'), _('Click "Convert" to convert video file to SRT file.'));
ss = o.subsection;
o = ss.option(form.Button, 'convert', _('Convert Video to SRT File'));
o.inputstyle = 'action important';
o.inputtitle = _('Convert');
o.onclick = L.bind(this.processVideo, this);
return m.render();
},
handleSaveApply: null,
handleSave: null,
handleReset: null
});

View File

@ -1,35 +0,0 @@
'use strict';
'require view';
'require ui';
'require form';
'require rpc';
'require fs';
'require tools.widgets as widgets';
var isReadonlyView = !L.hasViewPermission();
var mapdata = { view: {} };
return view.extend({
render: function() {
var m, s, o, ss;
m = new form.JSONMap(mapdata, _('View SRT File'), _('View SRT file converted by whispercpp.'));
m.readonly = isReadonlyView;
s = m.section(form.NamedSection, 'view', _('View'));
o = s.option(form.TextValue, 'viewlist');
o.forceWrite = true;
o.rows = 50;
o.load = function(section_id) {
return L.resolveDefault(fs.read('/tmp/output.wav.srt'), 'no result srt file');
};
return m.render();
},
handleSaveApply: null,
handleSave: null,
handleReset: null
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

View File

@ -1 +0,0 @@
zh_Hans

View File

@ -1,60 +0,0 @@
msgid "whispercpp"
msgstr "视频转文本"
msgid "Process"
msgstr "操作"
msgid "View"
msgstr "查看"
msgid "Whispercpp Process"
msgstr "whisper视频处理"
msgid "Whisper is a general-purpose speech recognition model."
msgstr "whisper是一个开源的通用人工语音识别模型"
msgid "Upload Video File"
msgstr "上传视频文件"
msgid "Click \"Upload\" to upload video file, file size should be less than 5M."
msgstr "点击\"上传\"按钮上传视频文件文件大小应小于5M"
msgid "Convert"
msgstr "视频转换"
msgid "Click \"Convert\" to convert video file to SRT file."
msgstr "点击\"视频转换\"按钮将视频文件转换为SRT文件。"
msgid "Convert Video to SRT File"
msgstr "视频转换为SRT文件"
msgid "View SRT File"
msgstr "查看SRT文件"
msgid "View SRT file converted by whispercpp."
msgstr "查看whisper转换的SRT文件。"
msgid "File size should be less than 10M"
msgstr "文件大小应小于10M"
msgid "Upload video complete"
msgstr "视频上传完成"
msgid "Convert video complete"
msgstr "视频转换完成"
msgid "Failed to upload video: %s"
msgstr "视频上传失败: %s"
msgid "Failed to convert video: %s"
msgstr "视频转换失败: %s"
msgid "Failed to convert audio"
msgstr "音频转换失败"
msgid "Transcribe ..."
msgstr "转录中 ..."
msgid "Convert ..."
msgstr "转换中 ..."

View File

@ -1,45 +0,0 @@
#!/bin/sh
convertVideoToAudio() {
input=$1
/usr/bin/ffmpeg -i "$input" -ar 16000 -ac 1 -c:a pcm_s16le -y /tmp/output.wav&> /dev/null
echo "/tmp/output.wav"
}
convertAudioToSubtitle() {
whispercpp_pid = $(pgrep whispercpp)
if [ -n "$whispercpp_pid" ]; then
kill -9 $whispercpp_pid
fi
input=$1
/usr/bin/whispercpp -m /usr/share/whispercpp/model/ggml-tiny.en-q5_0.bin -osrt -f "$input"
}
handleRequest() {
action=$1
if [ "$action" = "list" ]; then
methods="{\"ffmpeg\":{\"description\":\"Convert video to audio\",\"params\":{\"input\":{\"type\":\"string\",\"description\":\"Input video file\"}}},\"whispercpp\":{\"description\":\"Convert audio to subtitle\",\"params\":{\"input\":{\"type\":\"string\",\"description\":\"Input audio file\"}}}}"
echo "$methods"
elif [ "$action" = "call" ]; then
method=$2
if [ "$method" = "ffmpeg" ]; then
input="/tmp/video.mp4"
output=$(convertVideoToAudio "$input")
result="{\"result\":\"ok\",\"data\":{\"output\":\"$output\"}}"
echo "$result"
elif [ "$method" = "whispercpp" ]; then
input="/tmp/output.wav"
convertAudioToSubtitle "$input"
result="{\"result\":\"ok\",\"data\":{\"output\":\"/tmp/output.srt\"}}"
echo "$result"
else
errorResult="{\"result\":\"error\",\"message\":\"Unknown method\"}"
echo "$errorResult"
fi
fi
}
handleRequest "$@"

View File

@ -1,35 +0,0 @@
{
"admin/services/whispercpp": {
"title": "whispercpp",
"action": {
"type": "firstchild"
},
"depends": {
"acl": [ "luci-app-whispercpp" ]
}
},
"admin/services/whispercpp/process": {
"title": "Process",
"order": 1,
"action": {
"type": "view",
"path": "/whispercpp/process"
},
"depends": {
"acl": [ "luci-app-whispercpp" ]
}
},
"admin/services/whispercpp/view": {
"title": "View",
"order": 2,
"action": {
"type": "view",
"path": "/whispercpp/view"
},
"depends": {
"acl": [ "luci-app-whispercpp" ]
}
},
}

View File

@ -1,33 +0,0 @@
{
"luci-app-whispercpp": {
"description": "Grant access to LuCI app whispercpp",
"read": {
"ubus": {
"file": [ "exec", "read", "stat" ],
"luci": [ "isFfmpegOrWhispercppRunning" ]
},
"file": {
"/usr/share/whispercpp/model/ggml-tiny.en-q5_0.bin": ["read"],
"/tmp/output.wav.srt": ["read"]
},
"cgi-io": [ "download" ]
},
"write": {
"cgi-io": [ "upload"],
"file": {
"/usr/bin/ffmpeg -i /tmp/video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le -y /tmp/output.wav": ["exec"],
"/usr/bin/whispercpp -m /usr/share/whispercpp/model/ggml-tiny.en-q5_0.bin -osrt -f /tmp/output.wav": ["exec"],
"/bin/rm -f /tmp/output.wav": ["exec"],
"/bin/rm -f /tmp/video.mp4": ["exec"],
"/bin/rm -f /tmp/output.wav.srt": ["exec"],
"/tmp/video.mp4": ["write"],
"/tmp/output.wav": ["write"],
"/tmp/output.wav.srt": ["write"]
},
"ubus": {
"file": [ "exec", "remove", "write" ],
"whispercpp": [ "whispercpp", "ffmpeg" ]
}
}
}
}

View File

@ -0,0 +1,51 @@
'use strict';
return L.Class.extend({
desc: function(description, username, project) {
var luci_project = 'luci-app-' + project;
var title = _('if you have any problem, please click to view the project on GitHub : ') + project;
var luci_title = _('if you have any problem, please click to view the luci ui project on GitHub : ') + luci_project;
var package_label = 'package-' + project.replace(/-/g, '_') + '-default';
var luci_label = 'luci-' + project.replace(/-/g, '_') + '-default';
return "<table style='border: 0; table-layout: auto;'>" +
"<tr>" +
"<td style='border: 0;'>" + _(description) + "</td>" +
"<td style='border: 0;'>" +
"<table style='border: 0; table-layout: auto;'>" +
"<tr>" +
"<td style='border: 0;'>" +
"<a href='https://github.com/" + username + "/" + project + "' target='_blank' title='" + title + "'>" +
"<img alt='" + project + "' src='https://img.shields.io/badge/" + package_label + "' />" +
"<img alt='" + project + "' src='https://img.shields.io/github/stars/" + username + "/" + project + "?style=social' />" +
"</a>" +
"<a href='https://github.com/" + username + "/" + luci_project + "' target='_blank' title='" + luci_title + "'>" +
"<img alt='" + luci_project + "' src='https://img.shields.io/badge/" + luci_label + "' />" +
"<img alt='" + luci_project + "' src='https://img.shields.io/github/stars/" + username + "/" + luci_project + "?style=social' />" +
"</a>" +
"</td>" +
"</tr>" +
"</table>" +
"</td>" +
"</tr>" +
"</table>";
},
luci_desc: function(description, username, project) {
var luci_label = 'luci-' + project.replace(/-/g, '_') + '-default';
project = 'luci-app-' + project;
var luci_title = _('if you have any problem, please click to view the luci ui project on GitHub : ') + project;
return "<table style='border: 0; table-layout: auto;'>" +
"<tr>" +
"<td style='border: 0;'>" + _(description) + "</td>" +
"<td style='border: 0;'>" +
"<a href='https://github.com/" + username + "/" + project + "' target='_blank' title='" + luci_title + "'>" +
"<img alt='" + project + "' src='https://img.shields.io/badge/" + luci_label + "' />" +
"<img alt='" + project + "' src='https://img.shields.io/github/stars/" + username + "/" + project + "?style=social' />" +
"</a>" +
"</td>" +
"</tr>" +
"</table>";
}
});

View File

@ -0,0 +1,51 @@
'use strict';
return L.Class.extend({
desc: function(description, username, project) {
var luci_project = 'luci-app-' + project;
var title = _('if you have any problem, please click to view the project on GitHub : ') + project;
var luci_title = _('if you have any problem, please click to view the luci ui project on GitHub : ') + luci_project;
var package_label = 'package-' + project.replace(/-/g, '_') + '-default';
var luci_label = 'luci-' + project.replace(/-/g, '_') + '-default';
return "<table style='border: 0; table-layout: auto;'>" +
"<tr>" +
"<td style='border: 0;'>" + _(description) + "</td>" +
"<td style='border: 0;'>" +
"<table style='border: 0; table-layout: auto;'>" +
"<tr>" +
"<td style='border: 0;'>" +
"<a href='https://github.com/" + username + "/" + project + "' target='_blank' title='" + title + "'>" +
"<img alt='" + project + "' src='https://img.shields.io/badge/" + package_label + "' />" +
"<img alt='" + project + "' src='https://img.shields.io/github/stars/" + username + "/" + project + "?style=social' />" +
"</a>" +
"<a href='https://github.com/" + username + "/" + luci_project + "' target='_blank' title='" + luci_title + "'>" +
"<img alt='" + luci_project + "' src='https://img.shields.io/badge/" + luci_label + "' />" +
"<img alt='" + luci_project + "' src='https://img.shields.io/github/stars/" + username + "/" + luci_project + "?style=social' />" +
"</a>" +
"</td>" +
"</tr>" +
"</table>" +
"</td>" +
"</tr>" +
"</table>";
},
luci_desc: function(description, username, project) {
var luci_label = 'luci-' + project.replace(/-/g, '_') + '-default';
project = 'luci-app-' + project;
var luci_title = _('if you have any problem, please click to view the luci ui project on GitHub : ') + project;
return "<table style='border: 0; table-layout: auto;'>" +
"<tr>" +
"<td style='border: 0;'>" + _(description) + "</td>" +
"<td style='border: 0;'>" +
"<a href='https://github.com/" + username + "/" + project + "' target='_blank' title='" + luci_title + "'>" +
"<img alt='" + project + "' src='https://img.shields.io/badge/" + luci_label + "' />" +
"<img alt='" + project + "' src='https://img.shields.io/github/stars/" + username + "/" + project + "?style=social' />" +
"</a>" +
"</td>" +
"</tr>" +
"</table>";
}
});

View File

@ -1,48 +0,0 @@
#
# Copyright (C) 2024 Dengfeng Liu <liudf0716@gmail.com>
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=whispercpp
PKG_VERSION:=1.6.2
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/ggerganov/whisper.cpp/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/whisper.cpp-$(PKG_VERSION)
PKG_MAINTAINER:=Dengfeng Liu <liudf0716@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/whispercpp
SECTION:=multimedia
CATEGORY:=Multimedia
DEPENDS:=@(aarch64||i386||x86_64) +libstdcpp +ffmpeg
TITLE:=Port of OpenAI's Whisper model in C/C++
URL:=https://github.com/ggerganov/whisper.cpp
endef
define Package/whispercpp/description
Whisper is a general-purpose speech recognition model.
Whispercpp is a port of OpenAI's Whisper model in C/C++.
endef
define Package/whispercpp/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/main $(1)/usr/bin/whispercpp
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libwhisper.so $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/share/whispercpp/model
$(CP) ./files/ggml-tiny.en-q5_0.bin $(1)/usr/share/whispercpp/model/
endef
$(eval $(call BuildPackage,whispercpp))

View File

@ -1,2 +0,0 @@
# whispercpp
whisper.cpp package for openwrt