key-networks / ztncui

ZeroTier network controller UI
GNU General Public License v3.0
1.53k stars 228 forks source link

jquery not bundled in RPM #30

Open Zukero opened 4 years ago

Zukero commented 4 years ago

Hi,

I'm using ztncui 0.5.8-1 using your RPMs on CentOS 7 x86_64 on a test network of VMs. I can't set network member names nor effectively tick any checkboxes, and when I touch the UI elements for it in the browser, no POST request is sent to ztncui server. My browser indicates that it failed to retrieve "jquery.min.js", because it can't reach http://cdnjs.cloudflare.com/. I guess this is the cause of the issue. Bootstrap, on the other hand, is compiled inside ztncui.

Could you make it so that jquery is bundled in the ztncui binary for the next RPM builds ?

Zukero commented 4 years ago

I just confirmed this by hacking together a simple web server that serves this file, and point an /etc/hosts entry to this server for cdnjs.cloudflare.com and it fixes the issue.

key-networks commented 4 years ago

I did bundle jquery with ztncui - you can see it here: https://github.com/key-networks/ztncui/blob/master/src/package.json

IIRC, the problem was using it somehow broke packaging it with pkg, so I had to resort to using an online version. I'm not sure if that problem with pkg has been resolved yet. It may be worth trying again the next time I rebuild it.

Zukero commented 4 years ago

👍 Alright then. Thanks.

key-networks commented 3 years ago

I tried this again:

diff --git a/src/views/head_layout.pug b/src/views/head_layout.pug
index 635ed4c..599c0f1 100644
--- a/src/views/head_layout.pug
+++ b/src/views/head_layout.pug
@@ -11,7 +11,7 @@ html(lang='en')
     meta(name='viewport', content='width=device-width, initial-scale=1')
     link(rel='stylesheet', href='/bscss/bootstrap.min.css')
     link(rel='stylesheet', href='/stylesheets/style.css')
-    script(src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js')
+    script(src='/jqjs/jquery.min.js')
     script(src='/bsjs/bootstrap.min.js')
   body
     block body_content

I can GET /jqjs/jquery.min.js when it is running from source on my local machine, but after packaging with pkg, I can't GET it. So, unless anyone has any suggestions, I can't take this any further.

For those running from source, the above patch should work.

key-networks commented 3 years ago

This problem is being resolved in https://github.com/key-networks/ztncui/pull/57