feat(update): sumber update bisa diatur (update_base_url)
All checks were successful
CI / test (push) Successful in 4m5s
All checks were successful
CI / test (push) Successful in 4m5s
- setting baru update_base_url (default https://gitea.oxpoe.xyz), menggantikan hardcode gitea.oxpoe.qzz.io - field di Pengaturan: Sumber Update + Repo Update (owner/nama) - default project_url ikut diperbarui
This commit is contained in:
@@ -293,6 +293,8 @@ function ensureDefaultSettings() {
|
||||
custom_ai_base_url: '',
|
||||
custom_ai_model: 'llama3',
|
||||
ai_self_healing_enabled: false,
|
||||
update_base_url: 'https://gitea.oxpoe.xyz',
|
||||
update_repo: 'oxpoe/open-isp',
|
||||
// RADIUS Server settings (ditambahkan untuk update dari Gitea)
|
||||
radius_enabled: '0',
|
||||
radius_secret: 'secret123',
|
||||
|
||||
@@ -396,9 +396,11 @@ function getUpdateInfo(repoRoot) {
|
||||
info.branch = branch;
|
||||
|
||||
const _repo = String(getSetting('update_repo', 'oxpoe/open-isp') || '').trim();
|
||||
const _base = String(getSetting('update_base_url', 'https://gitea.oxpoe.xyz') || '').trim().replace(/\/+$/, '');
|
||||
info.repo = _repo || 'origin';
|
||||
info.baseUrl = _base;
|
||||
const fetch = _repo
|
||||
? runCmd('git', ['fetch', '--prune', 'https://gitea.oxpoe.qzz.io/' + _repo + '.git', branch], repoRoot)
|
||||
? runCmd('git', ['fetch', '--prune', _base + '/' + _repo + '.git', branch], repoRoot)
|
||||
: runCmd('git', ['fetch', '--prune'], repoRoot);
|
||||
if (!fetch.ok) {
|
||||
info.error = 'Gagal git fetch: ' + (fetch.stderr || fetch.stdout || '').trim();
|
||||
@@ -4666,9 +4668,11 @@ router.post('/update/run', requireAdminSession, restrictToAdmin, (req, res) => {
|
||||
if (!inside.ok) throw new Error('Folder ini belum menjadi git repository.');
|
||||
|
||||
const _repo = String(getSetting('update_repo', 'oxpoe/open-isp') || '').trim();
|
||||
const _base = String(getSetting('update_base_url', 'https://gitea.oxpoe.xyz') || '').trim().replace(/\/+$/, '');
|
||||
info.repo = _repo || 'origin';
|
||||
info.baseUrl = _base;
|
||||
const fetch = _repo
|
||||
? runCmd('git', ['fetch', '--prune', 'https://gitea.oxpoe.qzz.io/' + _repo + '.git', branch], repoRoot)
|
||||
? runCmd('git', ['fetch', '--prune', _base + '/' + _repo + '.git', branch], repoRoot)
|
||||
: runCmd('git', ['fetch', '--prune'], repoRoot);
|
||||
pushCmd('git fetch --prune', fetch);
|
||||
if (!fetch.ok) throw new Error('Gagal git fetch.');
|
||||
@@ -4775,6 +4779,12 @@ router.post('/settings', requireAdminSession, express.urlencoded({ extended: tru
|
||||
if (newSettings.voucher_enabled === 'true') newSettings.voucher_enabled = true;
|
||||
else if (newSettings.voucher_enabled === 'false') newSettings.voucher_enabled = false;
|
||||
|
||||
if (newSettings.update_base_url !== undefined) {
|
||||
newSettings.update_base_url = String(newSettings.update_base_url).trim().replace(/\/+$/, '');
|
||||
}
|
||||
if (newSettings.update_repo !== undefined) {
|
||||
newSettings.update_repo = String(newSettings.update_repo).trim().replace(/^\/+|\/+$/g, '');
|
||||
}
|
||||
newSettings.ai_provider = String(newSettings.ai_provider || 'deepseek').trim().toLowerCase();
|
||||
newSettings.ai_self_healing_enabled = newSettings.ai_self_healing_enabled === 'true' || newSettings.ai_self_healing_enabled === 'on';
|
||||
for (const k of ['deepseek_api_key','openai_api_key','groq_api_key','openrouter_api_key','custom_ai_api_key','custom_ai_base_url','custom_ai_model','deepseek_model','openai_model','groq_model','openrouter_model']) {
|
||||
|
||||
@@ -640,9 +640,18 @@
|
||||
</script>
|
||||
<div class="fg">
|
||||
<label class="fl"><%= t('admin.set.repo_link','Link Repositori Proyek (Gitea)') %></label>
|
||||
<input class="fc" name="project_url" value="<%= settings.project_url || 'https://gitea.oxpoe.qzz.io/oxpoe/open-isp' %>" placeholder="https://gitea.oxpoe.qzz.io/oxpoe/open-isp">
|
||||
<input class="fc" name="project_url" value="<%= settings.project_url || 'https://gitea.oxpoe.xyz/oxpoe/open-isp' %>" placeholder="https://gitea.oxpoe.xyz/oxpoe/open-isp">
|
||||
<div style="font-size:10px; color:var(--muted); margin-top:4px"><%= t('admin.set.repo_hint','Dipakai untuk tautan ') %><b>Repo</b>, <b>Form/Issue</b> (<code>/issues/new/choose</code>), <b>Wiki</b>, dan <b>Lisensi</b> di landing page.</div>
|
||||
</div>
|
||||
<div class="fg">
|
||||
<label class="fl">Sumber Update (host Git)</label>
|
||||
<input class="fc" name="update_base_url" value="<%= settings.update_base_url || 'https://gitea.oxpoe.xyz' %>" placeholder="https://gitea.oxpoe.xyz">
|
||||
<div style="font-size:10px; color:var(--muted); margin-top:4px">Dipakai menu <b>Update</b> untuk <code>git fetch</code>. Bisa Gitea (<code>https://gitea.oxpoe.xyz</code>) atau Forgejo (<code>https://forgejo.oxpoe.xyz</code>).</div>
|
||||
</div>
|
||||
<div class="fg">
|
||||
<label class="fl">Repo Update (owner/nama)</label>
|
||||
<input class="fc" name="update_repo" value="<%= settings.update_repo || 'oxpoe/open-isp' %>" placeholder="oxpoe/open-isp">
|
||||
</div>
|
||||
<div class="fg">
|
||||
<label class="fl"><%= t('admin.set.uptime_link','Link Uptime Website (Status)') %></label>
|
||||
<input class="fc" name="uptime_url" value="<%= settings.uptime_url || '' %>" placeholder="https://status.domain-anda.com">
|
||||
|
||||
Reference in New Issue
Block a user