webui-aria2 icon indicating copy to clipboard operation
webui-aria2 copied to clipboard

Changes in configuration.js are not reflected on docs/index.html

Open hetraeus opened this issue 6 years ago • 21 comments

Changes in configuration.js are not reflected on docs/index.html. I just followed README.md but it's not working, I have to change port and insert the secret token every time and changed settings are not stored. What am I missing?

hetraeus avatar Sep 17 '18 18:09 hetraeus

Yep, the new refactor broke the old configuration.js file. I'm not sure how you should handle this now (without rebuilding from source with your own config). May i ask why you are using configuration.js file?

anthonyraymond avatar Sep 17 '18 20:09 anthonyraymond

Authentication. I just followed the instructions. So any configuration now is hardwired and requires rebuilding?

hetraeus avatar Sep 23 '18 19:09 hetraeus

If i were you i'd just forget about the configuration.js and i'd fill the authentications on the webui form. These informations are saved into a cookie (or localstorage) anyway.

anthonyraymond avatar Sep 25 '18 21:09 anthonyraymond

If my memory is correct, there was a similar issue. configuration.js will not be read every time. It will only be read for the first time (when nothing persisted locally). If you have ever opened WebUI once, the modification to configuration.js will not work.

no1xsyzy avatar Sep 30 '18 03:09 no1xsyzy

I have the same question, the previous configuration.js doesn't working any more. I was using a local folder and open html directly from browser.

Also seems like the url mentioned in README doesn't work?

https://ziahamza.github.io/webui-aria2/docs

Thanks.

noooonee avatar Oct 06 '18 16:10 noooonee

@pratikborsadiya Any idea how to sort this out? TLDR; The configuration.js is embeded while building the project. And thus people who starts the webui with file://..../index.html can't use the configuration.js.

The problem comes from the fact that browser does not seems to persist localStorage from file:// url, and peoples have to rewrite credentials each times.

anthonyraymond avatar Oct 06 '18 20:10 anthonyraymond

There are two ways to fix this immediately.

  • Change the configuration.js file from src folder and build the source files locally.
  • Another is to change app.js inside doc directory. I know that it's not intuitive to change a minified file, to make it easy search for webui.services.configuration in the file and you will be able to locate the module easily. Or you can beautify the file using this site to make it easy to read.

I acknowledge that these are not the best solutions but they can work until we can come up with a better solution for this issue. In the meantime if anybody has any ideas regarding how to fix this I am willing to implement it.

pratikborsadiya avatar Oct 07 '18 06:10 pratikborsadiya

Regarding broken link in README file, a pull request to fix this is already open. #471

pratikborsadiya avatar Oct 07 '18 06:10 pratikborsadiya

Just open the app.js, search " (c = p && p.auth && p.auth.token ? p.auth.token : null),", find it and modify it to “(c = "xxxx-there is your own token-xxxx"),”.

It will work in anywhere, but you can't modify the token through webpage anymore. which meaning nothing for users who opens index.html from file explorer.

在app.js中搜索上面提到的那行代码,修改成上面提到的格式,这样做对于直接从文件打开index.html有效,也没有别的影响,唯一的问题只是在输入token的元素内不会显示占位符,它直接就是空的。

        if (g && u.length)
          return (
            (g = !1),
            (p = u[0]),
            // (c = p && p.auth && p.auth.token ? p.auth.token : null),//modify this line
            (c = "yourToken"),
            e.init(p),
            void (h = setTimeout(v, t))
          );

YanceyChiew avatar Oct 08 '18 21:10 YanceyChiew

I think webpack provides something called like "code-split", which enables manually setup splitting point. This could be used to load some library code from CDN or separate file. Analogically, maybe we can use this function to treat configuration.js as a library and keep it unchanged.

no1xsyzy avatar Oct 09 '18 04:10 no1xsyzy

app.js.txt

Well, I have uploaded my own modified app.js as a txt file, which once was modified for supporting packing this program into a chrome extension. It's almostly can save cookies in everywhere now, include the file:// protocol.

But remember, in this way your token won't be clear unless you do it yourself.(Open the debug page and clear localstorage).

YanceyChiew avatar Oct 09 '18 06:10 YanceyChiew

@foreverhex @hetraeus will you guys tell me that why are you guys specifically using webui from file. If it's because of being able to use the app offline I would like to inform you that the latest version of webui hosted on GitHub pages is ready to be used offline once you have visited the application while you are online.

pratikborsadiya avatar Oct 10 '18 19:10 pratikborsadiya

@pratikborsadiya For me it's just that I like self hosting my own stuff. I don't trust a remotely hosted version of this, because it could potentially be compromised and used for malicious purposes (like downloading stuff I don't want).

Neo-Oli avatar Oct 11 '18 19:10 Neo-Oli

@pratikborsadiya And for me is that github.io is not always avalible in mainland China, what if the cache of PWA is outdated and the github.io site is unavalible? So we need to use locale files, at least we can deal with this problem when it happens.

lychichem avatar Oct 12 '18 02:10 lychichem

I am also having this issue, and it is not storing connection settings to local storage (which seems to be the expected behaviour?). Clearing cookie does not help neither. Modifying app.js works for me. I am using the local index.html so I can make aria2 to only listen for local interface. Seems like using https://ziahamza.github.io/webui-aria2/ directly is the recommended way though.

Rivers47 avatar Oct 21 '18 01:10 Rivers47

I add some fuck randomly in src/js/services/configuration.js but no error reported while runing node node-server.js. Is configuration.js ever executed???

recolic avatar Feb 17 '19 00:02 recolic

@recolic configuration.js will not be executed directly as we are building the source code into one single file. It will reflect your changes if you compile the source code after making change using the steps mentioned here.

pratikborsadiya avatar Feb 17 '19 13:02 pratikborsadiya

@recolic configuration.js will not be executed directly as we are building the source code into one single file. It will reflect your changes if you compile the source code after making change using the steps mentioned here.

Thanks! It works.

Could you please add these contents into README.md? It can be confusing if the user has no experience on nodejs. By the way, currently I'm using npm run dev to run my server. But I don't want to compile it again and again on every run...

recolic avatar Feb 24 '19 00:02 recolic

I'm using npm run dev to run my server. But I don't want to compile it again and again on every run...

You can use npm run build to compile source files for production build.

pratikborsadiya avatar Feb 25 '19 14:02 pratikborsadiya

@pratikborsadiya i see. but how do I run built project?

recolic avatar Feb 25 '19 19:02 recolic

You can run node node-server.js just like you were running before making the change.

pratikborsadiya avatar Feb 26 '19 08:02 pratikborsadiya