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

bug: webui not loading in firefox with cookies and localStorage disabled #2190

Open
ivan386 opened this issue Dec 15, 2023 · 13 comments · May be fixed by #2192
Open

bug: webui not loading in firefox with cookies and localStorage disabled #2190

ivan386 opened this issue Dec 15, 2023 · 13 comments · May be fixed by #2192
Labels
effort/days Estimated to take multiple days, but less than a week exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature kind/support A question or request for support need/analysis Needs further analysis before proceeding P3 Low: Not priority right now status/deferred Conscious decision to pause or backlog topic/infra Infrastructure

Comments

@ivan386
Copy link

ivan386 commented Dec 15, 2023

Describe the bug
I try to open webui and browser show me nothing.

My browser Firefox in private mod. All cookies disabled in settings. It is block access to local storage.

In console i see errors:

First error:

17:08:30.946 Uncaught DOMException: The operation is insecure.
    value i18nextLocalStorageBackend.js:50
    e i18nextLocalStorageBackend.js:60
    value i18nextChainedBackend.js:19
    value i18nextChainedBackend.js:49
    n i18next.js:1925
    value i18next.js:2361
    61455 i18n.js:19
    Webpack 4
        __webpack_require__
        <anonymous>
        <anonymous>
        <anonymous>
main.20056d59.js:2
    value i18nextLocalStorageBackend.js:50
    e i18nextLocalStorageBackend.js:60
    value i18nextChainedBackend.js:19
    forEach self-hosted:203
    value i18nextChainedBackend.js:49
    n i18next.js:1925
    value i18next.js:2361
    61455 i18n.js:19
    Webpack 4
        __webpack_require__
        <анонимный>
        <анонимный>
        <анонимный>

Error happen here in code (i18nextLocalStorageBackend.js:50):

function getDefaults() {
  return {
    prefix: 'i18next_res_',
    expirationTime: 7 * 24 * 60 * 60 * 1000,
    defaultVersion: undefined,
    versions: {},
    store: typeof window !== 'undefined' ? window.localStorage : null /* error on this line */
  };
}

Second error:

17:08:30.988 Uncaught (in promise) DOMException: The operation is insecure.
    n money-clip.m.js:32
2 main.20056d59.js:2

Error happen here in code (money-clip.m.js:32):

function createStore(dbName, storeName) {
    const dbp = idbReady().then(() => {
        const request = indexedDB.open(dbName); /* error on this line */
        request.onupgradeneeded = () => request.result.createObjectStore(storeName);
        return promisifyRequest(request);
    });
    return (txMode, callback) => dbp.then((db) => callback(db.transaction(storeName, txMode).objectStore(storeName)));
}

To Reproduce
Steps to reproduce the behavior:

  1. Disable all cookies in Firefox
  2. Open webui in private mod

Expected behavior
Web UI is shown

Desktop (please complete the following information):

  • OS: Windows 7
  • Browser Firefox
  • Version 115.5.0esr (64-разрядный)
@ivan386 ivan386 added the need/triage Needs initial labeling and prioritization label Dec 15, 2023
Copy link

welcome bot commented Dec 15, 2023

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment.
Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

@whizzzkid
Copy link
Contributor

Thanks for submitting this issue @ivan386 looks like an issue with the underlying https://github.com/i18next/i18next-localstorage-backend package. Did you also disable access to localstorage? the package uses localStorage to store defaults and not cookies. Can you try enabling localStorage to see if it works?

@whizzzkid whizzzkid added need/author-input Needs input from the original author and removed need/triage Needs initial labeling and prioritization labels Dec 21, 2023
@ivan386
Copy link
Author

ivan386 commented Dec 23, 2023

@whizzzkid localstorage are blocked with cookie blocking. When i disable protection which allows cookie and localstorage it works fine.

In first place you can wrap around line with localStorage in try{}catch(e){}. Will it works with second error i don't know.

Copy link
Contributor

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

@whizzzkid
Copy link
Contributor

Thanks for the update @ivan386, I am still not sure if this can be entertained as a bug on ipfs-webui, how critical is using ipfs-webui with cookies disabled?

Maybe, this: #2192 fixes your concern (based on: https://github.com/i18next/i18next-localstorage-backend/tree/e04dc1ff60e521e39caf13a875e7eb76d19fcd20?tab=readme-ov-file#cache-backend-options)

However, I am not sure how the translation options behave in such scenario, the changes will definitely not persist but to counter that you can use ?lng=<lang> in the URL as described here in the original PR: #1658

@whizzzkid
Copy link
Contributor

@ivan386
Copy link
Author

ivan386 commented Jan 8, 2024

@whizzzkid same errors

00:12:46.779 Uncaught DOMException: The operation is insecure.
    32821 i18n.js:30
    Webpack 4
main.c684dc3e.js:2
00:12:46.789 Uncaught (in promise) DOMException: The operation is insecure.
    n money-clip.m.js:32
2 main.c684dc3e.js:2

i18n.js:30

        { // LocalStorageBackend
          defaultVersion: version,
          expirationTime: (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') ? 1 : 7 * 24 * 60 * 60 * 1000,
          store: typeof window !== 'undefined' && 'localStorage' in window ? window.localStorage : null /* error on this line */
        },

money-clip.m.js:32

function createStore(dbName, storeName) {
    const dbp = idbReady().then(() => {
        const request = indexedDB.open(dbName); /* error on this line */
        request.onupgradeneeded = () => request.result.createObjectStore(storeName);
        return promisifyRequest(request);
    });
    return (txMode, callback) => dbp.then((db) => callback(db.transaction(storeName, txMode).objectStore(storeName)));
}

localStorage exist in window

00:19:05.120 'localStorage' in window
00:19:05.170 true

but if i try to get it

00:26:52.819 window.localStorage
00:26:52.849 Uncaught DOMException: The operation is insecure.
    <anonymous> debugger eval code:1
debugger eval code:1:1

@SgtPooki SgtPooki changed the title I try to open webui and browser show me nothing. bug: webui not loading in firefox with cookies and localStorage disabled Jan 9, 2024
@whizzzkid
Copy link
Contributor

@ivan386 I updated #2192 to not load localStorage backend entirely. Please try once again: https://bafybeih4ludx4qgmotk44fjt66elhbnxnziknvhrbvkg3pvz4ira7rwwti.on.fleek.co/

@ivan386
Copy link
Author

ivan386 commented Jan 16, 2024

@whizzzkid same errors

18:03:52.693 Uncaught DOMException: The operation is insecure.
    32821 i18n.js:32
    Webpack 4
main.df1fdf8c.js:2
    32821 i18n.js:32
    Webpack 4
18:03:52.705 Uncaught (in promise) DOMException: The operation is insecure.
    n money-clip.m.js:32
2 main.df1fdf8c.js:2

i18n.js:

if (typeof window !== 'undefined' && 'localStorage' in window) {
  i18nBackend = [LocalStorageBackend, ...i18nBackend]
  i18nBackendOptions = [
    { // LocalStorageBackend
      defaultVersion: version,
      expirationTime: (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') ? 1 : 7 * 24 * 60 * 60 * 1000,
      store: typeof window !== 'undefined' && 'localStorage' in window ? window.localStorage : null /* error on this line */
    },
    ...i18nBackendOptions
  ]
}

money-clip.m.js:

function createStore(dbName, storeName) {
    const dbp = idbReady().then(() => {
        const request = indexedDB.open(dbName); /* error on this line */
        request.onupgradeneeded = () => request.result.createObjectStore(storeName);
        return promisifyRequest(request);
    });
    return (txMode, callback) => dbp.then((db) => callback(db.transaction(storeName, txMode).objectStore(storeName)));
}

maybe you can change part in i18n.js

window.localStorage

to

(()=>{try{return window.localStorage}catch(e){}})()

Copy link
Contributor

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

Copy link
Contributor

This issue was closed because it is missing author input.

@SgtPooki SgtPooki reopened this Feb 7, 2024
@SgtPooki
Copy link
Member

SgtPooki commented Feb 7, 2024

@ivan386 can you confirm that the latest in #2192 works for you?

@SgtPooki SgtPooki self-assigned this Feb 7, 2024
@SgtPooki SgtPooki added kind/bug A bug in existing code (including security flaws) help wanted Seeking public contribution on this issue status/deferred Conscious decision to pause or backlog exp/expert Having worked on the specific codebase is important and removed need/author-input Needs input from the original author kind/bug A bug in existing code (including security flaws) kind/stale labels Feb 7, 2024
@SgtPooki SgtPooki added P3 Low: Not priority right now kind/enhancement A net-new feature or improvement to an existing feature need/analysis Needs further analysis before proceeding effort/days Estimated to take multiple days, but less than a week kind/support A question or request for support topic/infra Infrastructure labels Feb 7, 2024
@SgtPooki
Copy link
Member

SgtPooki commented Feb 7, 2024

I can reproduce this error by explicitly setting Block for https://bafybeih4ludx4qgmotk44fjt66elhbnxnziknvhrbvkg3pvz4ira7rwwti.on.fleek.co/#/welcome in firefox settings:

image

However, I don't think we have the bandwidth to work around someone explicitly disabling functionality this app requires to function (translations, etc..)

I would recommend adding an exception to allow webui.ipfs.io or whichever URL you're using to access the webui

If someone can figure out a way to support browsers where these functionalities are disabled without hindering functionality for more common usecases, I'm all for approving a PR.

@SgtPooki SgtPooki removed their assignment Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/days Estimated to take multiple days, but less than a week exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature kind/support A question or request for support need/analysis Needs further analysis before proceeding P3 Low: Not priority right now status/deferred Conscious decision to pause or backlog topic/infra Infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants