ziahamza / webui-aria2

The aim for this project is to create the worlds best and hottest interface to interact with aria2. Very simple to use, just download and open index.html in any web browser.
MIT License
9.98k stars 1.48k forks source link

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

Open hetraeus opened 6 years ago

hetraeus commented 6 years ago

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?

anthonyraymond commented 6 years ago

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?

hetraeus commented 6 years ago

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

anthonyraymond commented 6 years ago

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.

no1xsyzy commented 6 years ago

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.

noooonee commented 6 years ago

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.

anthonyraymond commented 6 years ago

@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.

pratikborsadiya commented 6 years ago

There are two ways to fix this immediately.

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 commented 6 years ago

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

YanceyChiew commented 6 years ago

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))
          );
no1xsyzy commented 6 years ago

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.

YanceyChiew commented 6 years ago

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).

pratikborsadiya commented 6 years ago

@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.

Neo-Oli commented 6 years ago

@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).

lychichem commented 6 years ago

@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.

Rivers47 commented 6 years ago

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.

recolic commented 5 years ago

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???

pratikborsadiya commented 5 years ago

@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.

recolic commented 5 years ago

@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...

pratikborsadiya commented 5 years ago

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.

recolic commented 5 years ago

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

pratikborsadiya commented 5 years ago

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