mirror of
https://github.com/PRVTPRO/Amnezia-Web-Panel.git
synced 2026-10-23 03:37:36 +09:00
fix(rknblock): marketplace Install button runs the host-level installer
The card called installFromMarketplace('rknblock'), which opened the AWG
instance installer (port/MTU/DNS/I1-I5) - none of that applies to a
host-level ipset agent with no container and no listening port. Install
now calls installRknBlock() directly (POST /rknblock/install), like the
server-page card does.
This commit is contained in:
1 parent
008e9fa260
commit
2105cc43ae
2 files changed
+7
-4
No files matched your search
@@ -1663,7 +1663,7 @@
|
||||
: baseInstalled(app.proto);
|
||||
const canInstallAnother = installed && isMultiInstanceBase(app.proto);
|
||||
const action = isRkn
|
||||
? (installed ? 'disabled' : `onclick="installFromMarketplace('rknblock', false)"`)
|
||||
? (installed ? 'disabled' : `onclick="closeModal('marketplaceModal'); installRknBlock()"`)
|
||||
: (installed && !canInstallAnother ? 'disabled' : `onclick="installFromMarketplace('${app.proto}', ${canInstallAnother ? 'true' : 'false'})"`);
|
||||
const statusBadge = isRkn
|
||||
? (installed
|
||||
@@ -4371,7 +4371,7 @@
|
||||
|
||||
async function installRknBlock() {
|
||||
const btn = document.getElementById('rknblock-install-btn');
|
||||
btn.disabled = true;
|
||||
if (btn) btn.disabled = true;
|
||||
try {
|
||||
await apiCall(`/api/servers/${SERVER_ID}/rknblock/install`, 'POST');
|
||||
showToast(_('rknblock_installed_toast'), 'success');
|
||||
@@ -4381,7 +4381,7 @@
|
||||
} catch (err) {
|
||||
showToast(_('error') + ': ' + (err.message || err), 'error');
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
if (btn) btn.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -104,8 +104,11 @@ class RknBlockUiWiringTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.page = read('templates', 'server.html')
|
||||
|
||||
def test_marketplace_card_present(self):
|
||||
def test_marketplace_card_and_modal(self):
|
||||
self.assertRegex(self.page, r"\{ proto: 'rknblock', category: 'services'")
|
||||
# host-level app installs directly, never through the AWG installer
|
||||
self.assertNotIn("installFromMarketplace('rknblock'", self.page)
|
||||
self.assertIn("installRknBlock()", self.page)
|
||||
|
||||
def test_rknblock_card_as_marketplace_app(self):
|
||||
self.assertIn('id="proto-rknblock"', self.page)
|
||||
|
||||
Reference in new issue
Block a user