Open hetraeus opened 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?
Authentication. I just followed the instructions. So any configuration now is hardwired and requires rebuilding?
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.
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.
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.
@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.
There are two ways to fix this immediately.
configuration.js
file from src
folder and build the source files locally.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.
Regarding broken link in README file, a pull request to fix this is already open. #471
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)) );
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.
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).
@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 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).
@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.
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.
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 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
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...
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 i see. but how do I run built project?
You can run node node-server.js
just like you were running before making the change.
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?