Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hetraeus opened this issue Sep 17, 2018 · 21 comments
Open

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

hetraeus opened this issue Sep 17, 2018 · 21 comments
Labels

Comments

@hetraeus
Copy link

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
Copy link
Collaborator

anthonyraymond commented Sep 17, 2018

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 anthonyraymond added the pourparler Needs to debate about that label Sep 21, 2018
@hetraeus
Copy link
Author

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

@anthonyraymond
Copy link
Collaborator

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
Copy link
Contributor

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
Copy link

noooonee commented Oct 6, 2018

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 anthonyraymond added bug and removed pourparler Needs to debate about that labels Oct 6, 2018
@anthonyraymond
Copy link
Collaborator

anthonyraymond commented Oct 6, 2018

@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
Copy link
Contributor

pratikborsadiya commented Oct 7, 2018

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
Copy link
Contributor

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

@YanceyChiew
Copy link

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
Copy link
Contributor

no1xsyzy commented Oct 9, 2018

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
Copy link

YanceyChiew commented Oct 9, 2018

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
Copy link
Contributor

pratikborsadiya commented Oct 10, 2018

@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
Copy link

Neo-Oli commented Oct 11, 2018

@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
Copy link
Contributor

@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
Copy link

Rivers47 commented Oct 21, 2018

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
Copy link

recolic commented Feb 17, 2019

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
Copy link
Contributor

@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
Copy link

recolic commented Feb 24, 2019

@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
Copy link
Contributor

pratikborsadiya commented Feb 25, 2019

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
Copy link

recolic commented Feb 25, 2019

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

@pratikborsadiya
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants