Manifest.json : What is wrong with this file?

{
  "name": "Play Next : YouTube",
  "version": "0.1.1",
  "manifest_version": 3,
  "description": "Add videos to queue",
  "homepage_url": "https://www.youtube.com",
  "icons": {
    "16": "icons/icon16.png",
    "48": "icons/icon48.png",
    "128": "icons/icon128.png"
  },
  "browser_action": {
    "default_popup": "popup.html"
  },
  "permissions": [
    "cookies",
    "tabs",
    "storage",
    "activeTab"
  ],
  "content_scripts": [
    {
      "matches": ["*://*.youtube.com/*"],
      "css": ["src/inject/inject.css"],
      "js": ["src/inject/inject.js"]
    }
 ],
  "web_accessible_resources": [
    {
      "resources": ["src/inject/main.js"]
    }
  ]
}

Error : Invalid value for ‘web_accessible_resources[0]’. Entry must at least have resources, and one other valid key.

Question : Can someone provide a nice tutorial for Manifest V3, with examples?

How to change url param id using primeng dropdown in angular

I am very new to primeng and Angular, Can you help me in this please:

How to change my param in URL (ex. shop1 in URL) http://localhost:4200/#/shops/shop1/dashboard using Primeng drop-down in Angular:

 <p-dropdown [options]="clientShops" [(ngModel)]="selectedShop" optionLabel="name"></p-dropdown>

where shop1 is by default param and want to change it by shop2 both values are present in the Primeng drop-down.

Just want to make a code that changes a param in URL on selecting the drop-down option.

Shopify We Are Unable To Authenticate You

`
Unable to access store after attempting to download a marketing application. Message appears:

We were unable to authenticate you

Looks like something went wrong on our end. Operation engineers are aware of this problem and are working hard to get it solved. In the meantime, you can keep an eye on the status page for updates.

[LOG IN]

Request ID:
XXYYZZ
`

How to add query param in Cypress (JS)

I have to ask for help here. I’m still learning Cypress and trying to add query param to each URL and validate that some modal appears on the page when query param is added. So the way it looks:

urls = [
“/en/link1/”,
“/en/link2/”,
“/en/link3/”,
]

queryParam = [
“?param1”,
“?param2”,
“?param3”,
]

I need to write code that would do for me

  • /en/link1/?param1
  • /en/link2/?param1
  • /en/link3/?param1
  • checkCondition()
  • /en/link1/?param2
  • /en/link2/?param2
  • /en/link3/?param2
  • checkCondition()

and so on…

Could you please advise me how to do this? I’d rly appreciate any advice/link to material. Thanks a lot and happy coding!

Phone number-based login system [closed]

Consider a scenario where you have a Phone number-based login system where you send OTP to the phone number using a third-party SMS service and login the user. The third-party service charges 0.02 $ for each SMS and you have allotted 100$ as the balance for the same.

You discover that every hour 100$ is depleted and you have to keep recharging the balance despite not having huge traffic on your website/app.
Is there something wrong going on here?
If yes, How will you fix it?

Are there multiple reasons for Azure error: “The specified resource does not exist”?

I have a project with tons of users and their uploaded files. The database has all files available, but around a year ago, when connecting the project to Azure and migrating the files, some files were forgotten in the process. While the code now uploads files automatically to Azure when uploading them to database, trying to delete some older files cause issues.

Currently my code checks Azure deletion first and then decides on deleting the file from the database. When trying to delete a file, that doesn’t exist in Azure, I get the error message:

StorageError: The specified resource does not exist.

This means, that the current logic doesn’t delete it from the database either. I can always just ignore the error from Azure and delete it regardless, but I don’t know what would be the best and safest way to do it.

Easiest would probably be to either delete the file anyways

if (!error) { 
    deleteFile(); 
} else {
    console.log("Azure failed, deleting anyways", error);
    deleteFile();
}

or delete it only, if the error is the one aforementioned.

if (!error) { 
    deleteFile(); 
} else if (error.message === "The specified resource does not exist") {
    console.log("Resource doesn't exist, deleting anyways", error);
    deleteFile();
}

But I don’t know enough about the error message. Is there another reason to get the same error message and a possibility to delete a file in a wrong situation? Or are there other reasons this shouldn’t be done? I’ve searched the web using the error message, but found many posts regarding permissions, so could this lead to any security problems?

Failed to fetch dynamically imported module:

I have a few components that are lazy imporent in App.tsx that is used in Index.tsx where it is randered and appended to the body.

   const IndexPage = lazy(() => import("../features//IndexPage"));
    const TagsPage = lazy(
      () => import("../features/tags/TagsPage")
    );
    const ArticlePage = lazy(() => import("../features/article/ArticlePage"));

    const SearchResultPage = lazy(
      () => import("../features/search-result/SearchResultPage")
    );

    const ErrorPage = lazy(() => import("../features/error/ErrorPage"));

    ----

    <BrowserRouter basename={basename}>
      <Suspense fallback={<Fallback />}>
        <Routes>
          <Route path={INDEX} element={<IndexPage />} />
          <Route path={ARTICLE} element={<ArticlePage />} />
          <Route path={TAGS} element={<TagsPage />} />
          <Route path={SEARCH} element={<SearchResultPage />} />
          <Route path={ERROR} element={<ErrorPage />} />
          <Route path="/*" element={<ErrorPage />} />
        </Routes>
      </Suspense>
    </BrowserRouter>

Often, the following error happens on production.

Failed to fetch dynamically imported module:

https://help.example.io/tags/static/js/SearchResultPage-c1900fe3.js

I have changed the build path. Therfore, it is tags/static/js.

Does someone know how to fix this issue?

Rest of function is firing before value is resolved, async / await [closed]

As title says, I am trying (and failing) to make the for loop wait until data is resolved before the loop is fired, unfortuntely I’m stuck!

function getPots() {

    fetch(`${uri}/postpot`)
        .then(response => response.json())
        .then(data => {
         return data;
     })
        .catch(error => console.error('Unable to get items.', error));
}

async function displayPots() {

    const potLists = document.getElementsByClassName("potLists");

    var data = await getPots();

   //for loop goes here
}

Why var value is being updated in a function that only updates the parameter? – Job Application test Question

Here, i have some doubts with this piece of code i found in a job application test i made a few hours ago.

function foo(x){
    x['key'] = "new value"
}

var a = {'key': "old value"}

foo(a)

console.log (a)
  • Why is the a.key being updated when im just asigning a new value to
    the function parameter not to the global var?

Fiddle JS:
https://jsfiddle.net/SoujiCode/gu2xcwe6

TypeError: Cannot read properties of null (reading ‘useContext’)

While going to route / or /news in terminal this error occurs (this is a next.js project)

Warning: Invalid hook call. Hooks can only be called inside of the body of a 
function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and 
fix this problem.
TypeError: Cannot read properties of null (reading 'useContext')
 at Object.useContext (/media/jahid/SSD Remaining/Running 
 Projects/WEB/Youtube/Next.js Crash Course for Beginners 2021 - Learn NextJS from Scratch in this 100% Free Tutorial/1/nextjs-course/node_modules/react/cjs/react.development.js:1616:21)
at Head (/media/jahid/SSD Remaining/Running Projects/WEB/Youtube/Next.js Crash Course for Beginners 2021 - Learn NextJS from Scratch in this 100% Free Tutorial/1/nextjs-course/node_modules/next/dist/shared/lib/head.js:176:34)
at renderWithHooks (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5471:16)
at renderIndeterminateComponent (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5544:15)
at renderElement (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5759:7)
at renderNodeDestructive (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5898:11)
at renderNode (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6030:12)
at renderChildrenArray (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5986:7)
at renderNodeDestructive (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5918:7)
at renderNode (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6030:12)

While in console it occurs

Failed to load resource: the server responded with a status of 500 (Internal Server Error)
:3001/:1 GET http://localhost:3001/_next/static/chunks/fallback/webpack.js?ts=1653469342780 net::ERR_ABORTED 500 (Internal Server Error)
:3001/:1 GET http://localhost:3001/_next/static/chunks/fallback/main.js?ts=1653469342780 net::ERR_ABORTED 500 (Internal Server Error)
:3001/:1 GET http://localhost:3001/_next/static/chunks/fallback/pages/_app.js?ts=1653469342780 net::ERR_ABORTED 500 (Internal Server Error)
:3001/:1 GET http://localhost:3001/_next/static/chunks/fallback/pages/_error.js?ts=1653469342780 net::ERR_ABORTED 500 (Internal Server Error)
:3001/:1 GET http://localhost:3001/_next/static/chunks/fallback/react-refresh.js?ts=1653469342780 net::ERR_ABORTED 500 (Internal Server Error)
:3001/favicon.ico:1 GET http://localhost:3001/favicon.ico 500 (Internal Server Error)

index.js

export default function HomePage() {

    return <h1>The Home Page</h1>
}

news.js

export default function NewsPage() {
   return <h1>The News Page</h1>
}

React search for an element from map function and scroll to that location

I am trying to search an element from a map function and scroll to the location of that element –

const time = “1235”

return <RightWrapper>
    
    {arr.map((transcript) => (
  <p
    dangerouslySetInnerHTML={createMarkup(transcript)}
    key={transcript.id}
    
  ></p> </RightWrapper>

Here I want to search for value time(which in this case is 12345) in transcript and scroll to that part when there is a match.

Attempt to get token returns undefined

I’m using an API with javascript to make a login and, the login is working, but now, I need to make the logout and I need to get the token from the success message that appears on the console like this:

{"access":1,"message":"Success!","status":200,"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyaWQiOjQyLCJ1c2VybmFtZSI6ImJlcm5hcmRvIiwiYWNjZXNzX21vZGUiOjEsImV4cCI6MTY1MzQ3Mjk0NX0.lf6KgIF7FSjKFhPyRvOplYxgq3DLHEbDiRgHhH_oOWY","uid":42,"username":"bernardo"}

But when I tried to get the token on my fetch like this:

 fetch("https://api.secureme.pt/api/v1/auth/login", requestOptions)
        .then((response) => response.text())
        .then((result) => console.log(result.token)) <-- HERE
        .catch((error) => console.log("error", error));

It returns undefined and I don’t know why.

How can I control chrome with javascript?

I can control with right click,inspect and console a webpage.But,When the web page is refreshed, the javascript codes I wrote in the console are not valid.
So,I want to control chrome from a fixed javascript console window.The javascript codes I write should work not only on one website, but also on all websites.
Can you help me?

Why am I getting a Firebase INVALID_DYNAMIC_LINK_DOMAIN error?

I tried to add email verification in my React website but nothing seems to be working. When I initiate the sendSignInLinkToEmail function, it returns this error:

XHRPOSThttps://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=xxxxxxxxxxxxxxxxxxx
[HTTP/3 400 Bad Request 487ms]

{
  "error": {
    "code": 400,
    "message": "INVALID_DYNAMIC_LINK_DOMAIN",
    "errors": [
      {
        "message": "INVALID_DYNAMIC_LINK_DOMAIN",
        "domain": "global",
        "reason": "invalid"
      }
    ]
  }
}

Code in question:

export const registerWithEmailAndPassword = async (name, email, password) => {
  try {
    await sendSignInLinkToEmail(auth, email, actionCodeSettings)
      .then(() => {
        // The link was successfully sent. Inform the user.
        // Save the email locally so you don't need to ask the user for it again
        // if they open the link on the same device.
        window.localStorage.setItem("emailForSignIn", email);
        console.log("test");
        // ...
      })
      .catch((error) => {
        const errorCode = error.code;
        const errorMessage = error.message;
        // ...
      });
      
    const res = await createUserWithEmailAndPassword(auth, email, password);
    const user = res.user;
    await addDoc(collection(db, "users"), {
      uid: user.uid,
      name,
      authProvider: "local",
      email,
    });
  } catch (err) {
    console.error(err);
    alert(err.message);
  }
};

actionCodeSettings:

const actionCodeSettings = {
  // URL you want to redirect back to. The domain (www.example.com) for this
  // URL must be in the authorized domains list in the Firebase Console.
  url: "https://MYIPADDRESS:3000/",
  // This must be true.
  handleCodeInApp: true,
  iOS: {
    bundleId: "com.example.ios",
  },
  android: {
    packageName: "com.example.android",
    installApp: true,
    minimumVersion: "12",
  },
  dynamicLinkDomain: "https://MYIPADDRESS:3000/",
};

The problem probably lies in the actionCodeSettings, I want my website to redirect to root after performing the registration. By the way, I am locally hosting this website, it is not public, that’s why I added my ip address for the url. I have also added my ip to the authorized urls in Firebase. Also registration is on MYIPADDRESS:3000/register

Thanks in advance!