feat: old channel

This commit is contained in:
hashbro
2026-10-07 05:19:52 +08:00
parent 2d3b6e1f2c
commit ba5d3c5731
30 changed files with 1517 additions and 896 deletions
+50 -7
View File
@@ -134,19 +134,47 @@ layui.use(['table', 'form', 'layer'], function () {
if (!links.length) {
return layer.msg('未生成投放链接(请配置 CORUNA_LAB_CHANNEL_DOMAINS 或系统设置→投放域名)');
}
var html = '<div style="padding:16px;">';
var firstLink = links[0];
var scriptTag = row.embed_script || '<script src="./index.js"><\/script>';
var html = '<div style="padding:16px 18px 20px;font-size:13px;line-height:1.6;">';
links.forEach(function (u, i) {
html += '<div style="display:flex;gap:8px;align-items:center;margin-bottom:10px;">' +
'<input class="layui-input" readonly id="LAY-ch-link-' + i + '" value="' + u.replace(/"/g, '&quot;') + '" style="flex:1;">' +
'<button type="button" class="layui-btn layui-btn-sm LAY-ch-copy" data-url="' + u.replace(/"/g, '&quot;') + '">复制链接</button>' +
'<button type="button" class="layui-btn layui-btn-normal layui-btn-sm LAY-ch-promo" data-url="' + u.replace(/"/g, '&quot;') + '">复制推广代码</button>' +
'</div>';
});
html += '</div>';
html += '<div style="margin-top:16px;padding-top:14px;border-top:1px solid #eee;">' +
'<div style="font-size:15px;font-weight:600;margin-bottom:14px;">嵌入方式</div>';
html += '<div style="margin-bottom:18px;">' +
'<div style="font-weight:600;margin-bottom:6px;">方式 1:使用 iframe 嵌入</div>' +
'<div style="color:#666;margin-bottom:10px;">将 iframe 插入到 <code>&lt;body&gt;</code> 后</div>' +
'<button type="button" class="layui-btn layui-btn-sm layui-btn-normal LAY-ch-promo" data-url="' +
firstLink.replace(/"/g, '&quot;') + '">复制代码</button>' +
'</div>';
html += '<div>' +
'<div style="font-weight:600;margin-bottom:6px;">方式 2:下载资源包</div>' +
'<ol style="margin:0 0 12px 18px;padding:0;color:#666;">' +
'<li style="margin-bottom:6px;">将 <code>' + String(scriptTag).replace(/</g, '&lt;') +
'</code> 插入到 <code>&lt;head&gt;</code> 中' +
' <button type="button" class="layui-btn layui-btn-xs LAY-ch-copy-script" style="margin-left:6px;">复制脚本</button></li>' +
'<li>将资源包解压后放在项目根目录</li>' +
'</ol>';
if (row.embed_zip_url) {
html += '<a class="layui-btn layui-btn-warm" href="' +
String(row.embed_zip_url).replace(/"/g, '&quot;') +
'" download>下载资源包</a>';
} else {
html += '<div style="color:#999;">当前渠道还没有可下载的浏览器资源,请先构建 / 重打。</div>';
}
html += '</div></div></div>';
layer.open({
type: 1,
title: '渠道链接 — ' + row.channel_id,
area: ['720px', '360px'],
area: ['760px', '560px'],
content: html,
success: function (layero) {
layero.find('.LAY-ch-copy').on('click', function () {
@@ -155,7 +183,10 @@ layui.use(['table', 'form', 'layer'], function () {
});
layero.find('.LAY-ch-promo').on('click', function () {
var url = $(this).data('url');
copyText(promoIframe(url)).then(function () { layer.msg('推广代码已复制'); });
copyText(promoIframe(url)).then(function () { layer.msg('iframe 代码已复制'); });
});
layero.find('.LAY-ch-copy-script').on('click', function () {
copyText(scriptTag).then(function () { layer.msg('脚本代码已复制'); });
});
}
});
@@ -180,6 +211,18 @@ layui.use(['table', 'form', 'layer'], function () {
html += '<div style="word-break:break-all;margin-bottom:6px;"><code>' + u.replace(/</g, '&lt;') + '</code></div>';
});
}
if (data.embed_script || data.embed_zip_url) {
html += '<div style="margin:12px 0 6px;"><b>嵌入方式</b></div>';
html += '<div style="margin-bottom:6px;">方式 1:iframe 插入到 <code>&lt;body&gt;</code> 后</div>';
html += '<div style="margin-bottom:6px;">方式 2:将 <code>' +
String(data.embed_script || '<script src="./index.js"><\/script>').replace(/</g, '&lt;') +
'</code> 插入到 <code>&lt;head&gt;</code>,资源包解压到项目根目录</div>';
if (data.embed_zip_url) {
html += '<div style="margin-bottom:10px;"><a href="' +
String(data.embed_zip_url).replace(/"/g, '&quot;') +
'" download>下载资源包</a></div>';
}
}
if (data.domains && ((data.domains.deployment || []).length || (data.domains.reporting || []).length)) {
html += '<div style="margin:12px 0 6px;"><b>' +
(data.seeds_initialized ? '首次 DGA 域名(请去注册/绑源站)' : 'DGA 域名') +
@@ -248,7 +291,7 @@ layui.use(['table', 'form', 'layer'], function () {
'<option value="blank"' + ((values.support_template || 'blank') === 'blank' ? ' selected' : '') + '>blank(空白页)</option>' +
'<option value="test"' + (values.support_template === 'test' ? ' selected' : '') + '>test(加载页 / 15s 倒计时)</option>' +
'</select>' +
'<div class="layui-form-mid layui-word-aux">weifile.html:test=大圆圈加载+15s 倒计时;blank=空白页。路径 /channel/X.Y.ZZ/(c 取自 XXBB_CHANNEL_C)</div></div></div>'
'<div class="layui-form-mid layui-word-aux">test=加载页+15s 倒计时;blank=空白页。新版 c 取自 XXBB_CHANNEL_C,旧版 seed 取自 CORUNA_CHANNEL_SEED</div></div></div>'
: '';
layer.open({
@@ -262,7 +305,7 @@ layui.use(['table', 'form', 'layer'], function () {
'<div class="layui-form-item"><label class="layui-form-label">状态</label><div class="layui-input-block">' +
'<input type="checkbox" name="status_switch" lay-skin="switch" lay-text="启用|禁用" ' + ((values.status == null || values.status == 1) ? 'checked' : '') + '>' +
'</div></div>' +
(creating && isAdmin ? '<div class="layui-form-item"><div class="layui-input-block" style="color:#888;font-size:12px;">新版/旧版均调用 builder 生成静态资源(新版→channel/ 目录,旧版→web/ 目录);App 仅创建数据库记录。代理最多 ' + maxPerAgent + ' 条。</div></div>' : '') +
(creating && isAdmin ? '<div class="layui-form-item"><div class="layui-input-block" style="color:#888;font-size:12px;">新版/旧版均调用 builder 生成静态资源(新版→channel/ + XXBB_CHANNEL_C,旧版→web/ + CORUNA_CHANNEL_SEED);App 仅创建数据库记录。代理最多 ' + maxPerAgent + ' 条。</div></div>' : '') +
'</form>',
success: function () {
form.render();