How to optimize premissions on my front-end

I have a navbar and set of permissions coming from the backend I stored them inside user object in my global context, and I can reach them by typinguser.permissions

{addCustomer: false, editAndDeleteCustomer: false, showAllCustomers: false, addEmployee: false, editAndDeleteEmployee: false, …}

How can I optimize my Navlinks by just displaying the True fields?

for example: if addCustomer is false, add customer shouldn’t appear in menuItems and so on.

here is my code:

const NavLinks = ({ ToggleSideBar }) => {
  const { user } = useAppContext();

  const links = [
    {
      id: 1,
      text: "panel",

      path: "/",
      icon: <IoBarChartSharp />,
      menuItems: ["panel"],
    },
    {
      id: 2,
      text: "employee",
      // path: "all-jobs",
      path: ["add-employee", "all-employee"],
      icon: <MdQueryStats />,
      menuItems: [
        "add new employee",
        // "أدوار الموظفين",
        "all employees",
        // "الموظف المثالي",
      ],
    },
    {
      id: 3,
      text: "customer",
      // path: "add-job",
      path: ["add-customer", "emp-customers", "all-customers"],
      icon: <FaWpforms />,
      menuItems: [
        "add new customer",
        // "ارسال عميل",
        // "الحسابات المنتظرة",
        "my customers",
        "all customers",
      ],
    },
    {
      id: 4,
      text: "التقارير",
      // path: 'profile',
      path: ["profile", "aw", "all-jobs", "add-job"],
      icon: <ImProfile />,
      menuItems: [
        "add customer",
        "customer Roles",
        "all customers",
        "الموظف المثالي",
      ],
    },
    
  ];
 
  const [isDropdownOpen2, setIsDropdownOpen2] = useState(false);
  const [isDropdownOpen3, setIsDropdownOpen3] = useState(false);

  const toggleDropdown2 = () => {
    setIsDropdownOpen2(!isDropdownOpen2);
  };
  const toggleDropdown3 = () => {
    setIsDropdownOpen3(!isDropdownOpen3);
  };

  const [activeStatus, setActiveStatus] = useState({
    firstnavcontainer: false,
    secondnavcontainer: false,
    thirdnavcontainer: false,
  });

  const firstFunction = () => {
    setActiveStatus((prevState) => ({
      firstnavcontainer: true,
      secondnavcontainer: false,
      thirdnavcontainer: false,
    }));
  };
  const secondFunction = () => {
    setActiveStatus((prevState) => ({
      ...prevState,
      firstnavcontainer: false,
      secondnavcontainer: true,
      thirdnavcontainer: false,
    }));
    console.log(activeStatus);
  };
  const thirdFunction = () => {
    setActiveStatus((prevState) => ({
      ...prevState,
      firstnavcontainer: false,
      secondnavcontainer: false,
      thirdnavcontainer: true,
    }));
  };
  return (
    <div className="nav-links">
      {links.map((link) => {
        const { text, path, id, icon, menuItems } = link;
        return (
          <>
            {/* first item */}
            {id === 1 && (
              <div className="nav-item extra" onClick={firstFunction}>
                <ul className="dropdown-menu">
                  {menuItems.map((item, index) => (
                    <NavLink
                      to={path[index]}
                      // onClick={ToggleSideBar}
                      className={({ isActive }) =>
                        isActive
                          ? "dropdownmenu-item red-background"
                          : "dropdownmenu-item"
                      }
                    >
                      <div className="dropdown-itemcontainer">
                        <span className="dropdown-itemtext">{item}</span>
                      </div>
                    </NavLink>
                  ))}
                </ul>
              </div>
            )}
            {/* second section */}
            {id === 2 && (
              <div className="nav-item extra" onClick={secondFunction}>
                <button
                  className={`dropdown-toggle ${
                    activeStatus.secondnavcontainer ? "red-background" : ""
                  }`}
                >
                  <div className="dropdownbtn">
                    <span className="icon">{icon}</span>
                    <span>{text}</span>
                  </div>
                  <BsChevronDown
                    className="dropdown-icon"
                    onClick={toggleDropdown2}
                  />
                </button>
                {isDropdownOpen2 && (
                  <ul className="dropdown-menu">
                    {menuItems.map((item, index) => (
                      <NavLink
                        to={path[index]}
                        // onClick={ToggleSideBar}
                        className={({ isActive }) =>
                          isActive
                            ? "dropdownmenu-item active"
                            : "dropdownmenu-item"
                        }
                      >
                        <div className="dropdown-itemcontainer">
                          <span className="dropdown-itemtext">{item}</span>
                        </div>
                      </NavLink>
                    ))}
                  </ul>
                )}
              </div>
            )}
            {/* third section */}
            {id === 3 && (
              <div className="nav-item extra" onClick={thirdFunction}>
                <button
                  className={`dropdown-toggle ${
                    activeStatus.thirdnavcontainer ? "red-background" : ""
                  }`}
                >
                  <div className="dropdownbtn">
                    <span className="icon">{icon}</span>
                    <span>{text}</span>
                  </div>
                  <BsChevronDown
                    className="dropdown-icon"
                    onClick={toggleDropdown3}
                  />
                </button>
                {isDropdownOpen3 && (
                  <ul className="dropdown-menu">
                    {menuItems.map((item, index) => (
                      <NavLink
                        to={path[index]}
                        // onClick={ToggleSideBar}
                        className={({ isActive }) =>
                          isActive
                            ? "dropdownmenu-item active"
                            : "dropdownmenu-item"
                        }
                      >
                        <div className="dropdown-itemcontainer">
                          <span className="dropdown-itemtext">{item}</span>
                        </div>
                      </NavLink>
                    ))}
                  </ul>
                )}
              </div>
            )}
          </>
        );
      })}
    </div>
  );
};

export default NavLinks;

Since It is a permissions-related problem, is there another approach to do this?

Deploying NextJS project to Vercel failed

I have deployed a few projects to Vercel however I have never faced this issue. I have linked the logs below. Can anyone help me on this?

Running build in Washington, D.C., USA (East) – iad1
Cloning github.com/Yener07/abc (Branch: master, Commit: 2af820d)
Skipping build cache, deployment was triggered without cache.
Cloning completed: 368.242ms
Running "vercel build"
Vercel CLI 29.3.6
Installing dependencies...
yarn install v1.22.17
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @material-ui/[email protected]" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
warning " > @material-ui/[email protected]" has incorrect peer dependency "react-dom@^16.8.0 || ^17.0.0".
warning "@material-ui/core > @material-ui/[email protected]" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
warning "@material-ui/core > @material-ui/[email protected]" has incorrect peer dependency "react-dom@^16.8.0 || ^17.0.0".
warning "@material-ui/core > @material-ui/[email protected]" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
warning "@material-ui/core > @material-ui/[email protected]" has incorrect peer dependency "react-dom@^16.8.0 || ^17.0.0".
warning "@material-ui/core > @material-ui/[email protected]" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
warning "@material-ui/core > @material-ui/[email protected]" has incorrect peer dependency "react-dom@^16.8.0 || ^17.0.0".
warning " > @mui/[email protected]" has unmet peer dependency "@mui/material@^5.0.0".
warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning " > [email protected]" has incorrect peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0-0".
[4/4] Building fresh packages...
Done in 49.36s.
Detected Next.js version: 13.4.2
Running "yarn run build"
yarn run v1.22.17
$ next build
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
- info Creating an optimized production build...
- info Compiled successfully
- info Linting and checking validity of types...
Failed to compile.
./src/app/page.js
119:6  Warning: React Hook useEffect has a missing dependency: 'markers'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps
154:6  Warning: React Hook useEffect has a missing dependency: 'markers'. Either include it or remove the dependency array. Outer scope values like 'battleData' aren't valid dependencies because mutating them doesn't re-render the component.  react-hooks/exhaustive-deps
174:11  Warning: Custom fonts not added in `pages/_document.js` will only load for a single page. This is discouraged. See: https://nextjs.org/docs/messages/no-page-custom-font  @next/next/no-page-custom-font
208:13  Error: Missing "key" prop for element in iterator  react/jsx-key
216:21  Warning: Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element  @next/next/no-img-element
228:13  Error: Missing "key" prop for element in iterator  react/jsx-key
236:21  Warning: Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element  @next/next/no-img-element
info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 1
BUILD_UTILS_SPAWN_1: Command "yarn run build" exited with 1

I do not know how to fix this. One error message is I see is this:

228:13  Error: Missing "key" prop for element in iterator  react/jsx-key

However I do not know how to fix this.

Blob image size is always the same and image not displaying on the page

i want to display a blob image coming from an input file with URL.createObjectURL, it seems to work but the image not showing up :

enter image description here

i saw that blob image size is always the same “30” in the devtool console, which is very small , even if i take an other file with a different size.

enter image description here

Here is my code : i pass a Uint8Array as first parameter (fileContent) in the new blob object :

const fileContent = $('#fileContent').html();
const photoDiv = $('.photo');

const blob = new Blob([fileContent],{type: 'image/jpeg'});


console.log(blob);

const img = document.createElement('img');
const url = URL.createObjectURL(blob);
img.src = url;
img.height = 200;
img.width = 200;
img.onload = () => {
   URL.revokeObjectURL(img.src);
 };

photoDiv.html(img);



//deno run --allow-write --allow-net --allow-read --allow-env serverfu.ts

I tried different files with different sizes but blob size is always the same.

how to search in compound indexed document with partial part of the index in Mongoose

Hi i have a schema with composed index to keep a unique combinaison of mail and organisation in my MongoDB like this

let Schema = mongoose.Schema({
    _id:{
        organisation:{
            type:mongoose.ObjectId,
            required:true
            ref:'organisations'
        },
        mail:{
            type:String,
            required:true
        }
    },
    firstName:{ 
        type:String,
    },
    lastName:{
        type:String
    },
})
//some methods and statics here

const Contact = mongoose.model('contacts',Schema);

I would like to query all documents that match a specific organisation id without giving a mail ( for listing from organisation purpose )
I have read something about this

await Contact
   .find(
      {
         _id:{
            organisation:organisation,
            mail:{"$exists":true}
         }
      }
   )

but i get an empty result
so I try some regex

await Contact
   .find(
      {
         _id:{
            organisation:organisation,
            mail:{"$regex":"[^]*"}
         }
      }
   )

but i keep getting the same empty result
the only time I get result is when precising the exact mail of a document but its useless for listing all the mail of an organisation

Does anyone know what am i doing wrong ?
sorry i am kinda new at this NodeJS > Mongoose > MongoDB Stack

Best method to store my data in JS objects when I need to change the key

I am building a messaging type of application using React for the frontend and Django backend with MongoDB. I am currently having a design issue based on my lack of knowledge in JavaScript.

The flow of this is that when a user sends a message it gets added to a object that keeps track of it. When it is inserted it is given a temporary ID. At this point it is in the “pending” stage. It is then sent to the backend where it will be assigned a real ID and it will be returned in the response. The issue here is updating the temporary ID with the new ID since it is used as the key.

The way my data is structured currently allows me to access messages in O(1). Also since the messages are inserted when sent, it keeps it in a order of oldest -> newest.

A few of the ideas I had for fixing this issue are:

  1. I can loop through the messages adding them into a new message. When I find the message that has the temp ID I just insert it into the new object with the real ID. The only issue is this would have to loop through every time a new message is sent since they all start with a temp ID.

  2. I can store all the message objects in an array and add a timestamp to each message object. Then when I get the real ID I can just delete the temp ID object and insert the real ID message object. The order would not matter as I would then sort based on message object timestamp.

  3. Similar to #2 but instead of all messages in a single array each client would have its own array. This would cut down on filtering through ALL messages to filtering the messages that apply to the client.

Which would be the best option for this type of issue I have or what issues am I going to run into? Keep in mind I would like this to be flexible so that in the future if I need to add onto it I can without a full restructure. And since this is a React app I have to keep rendering in mind.

14, 15, and 18 are the client IDs. Everything under them belong to that client. Inside of each is the message ID and then the data to that message.

Here is an example of my data:

let messages = {
    '14': {
        '20': {msg: '', msg_status: '', msg_error: ''},
        '22': {msg: '', msg_status: '', msg_error: ''},
    },
    '15': {
        '21': {msg: '', msg_status: '', msg_error: ''},
        '23': {msg: '', msg_status: '', msg_error: ''},
    },
    '18': {
        '24': {msg: '', msg_status: '', msg_error: ''},
        '20': {msg: '', msg_status: '', msg_error: ''},
    }
}

For the first option something like the following would be used:

let new_list = {};

let temp_id = '20';
let real_id = '111';
let client_id = '18';

for (let key in messages) {
  if (key !== client_id) {
    new_list[key] = messages[key]
    continue;
  }

  for (let mkey in messages[key]) {
    if (mkey === temp_id) {
      new_list[key] = {};
      new_list[key][real_id] = messages[key][temp_id];
      continue;
    }
      new_list[key][mkey] = messages[key][mkey]
  }
  
}

For the second option something like the following would be used:

function createMessage(message, status, error, id) {
  return {
    msg_id: id,
    msg: message,
    msg_status: status,
    msg_error: error,
  }
}

const new_messages = [createMessage("Hey", "", "", 12), createMessage("Hey", "", "", 18), createMessage("Hey", "", "", 12)]
const userWithMessages = new_messages.filter(message => message.msg_id === 18)

How to add a new button to display when the array has more than 2 values?

I’m learning JS and I’m facing a problem, I’ve written my code below.

var AddStock = document.createElement('button'); //Button for adding the ticker to the list
var Ticker = document.createElement('input'); //Input of the tickers that the user is going to use
var TickerChosenContainer = document.createElement('div'); //Container for all the tickers that the user is going to use
var TickerChosenList = []; //This array lets me store all the generated values

//Button Add Stock
AddStock.textContent = 'Add stock';
AddStock.id = 'AddStockBtn';

//Ticker input
Ticker.setAttribute('placeholder', 'Enter stock symbol')
Ticker.id = 'Ticker';

//Print on display
document.body.appendChild(Ticker);
document.body.appendChild(AddStock);
document.body.appendChild(TickerChosenContainer);

//If 'Add Stock' gets clicked then create a new paragraph with the ticker name just added
AddStock.addEventListener('click', function (){
  var tickerChosen = document.createElement('p'); 
  tickerChosen.textContent = Ticker.value; 
  TickerChosenContainer.appendChild(tickerChosen);
  tickerChosenList.push(tickerChosen); 
});

if (tickerChosenList.length > 2) {
  var testout = document.createElement('button');
  document.body.appendChild(testout);
} else {

}


This JS script basically prints the ticker name on display.
I wanted to give the user an option where if the array TickerChosenList contained more than two values he could press another button, in this case called testout.
Both button ‘testout’ and ‘AddStock’ must be shown.

if (tickerChosenList.length > 2) {
  var testout = document.createElement('button');
  document.body.appendChild(testout);
} else {

}

That’s the IF that I’ve written, can someone show me what I’m doing wrong? Because I can’t see the new button appearing.

Unfortunately my knowledge only brought me to this results and I couldn’t figure out any different way to do this.

How could I make the navigation menu open once the user hovers over it using React?

I’m trying to build a navigation menu with React and TailWindcss, which should open only when a user hover over it. I’ve tried different approaches but never worked out and what remaining is to make the menu opens but it never did.

I’ve 3 components for this task:

MenuItem component:

'use client';

import React, { useState } from 'react';
import { FaBars } from 'react-icons/fa';
import { HiChevronDown } from 'react-icons/hi';

interface MenuItemProps {
  label: string;
  link: string;
  onMouseEnter?: () => void;
  onMouseLeave?: () => void;
  onClick?: () => void;
}

const MenuItem: React.FC<MenuItemProps> = ({
  label,
  onMouseEnter,
  onMouseLeave,
  onClick,
}) => {
  const [isOpen, setIsOpen] = useState(false);

  const handleMouseEnter = () => {
    setIsOpen(true);
    if (onMouseEnter) {
      onMouseEnter();
    }
  };

  const handleMouseLeave = () => {
    setIsOpen(false);
    if (onMouseLeave) {
      onMouseLeave();
    }
  };

  return (
    <nav>
      <div
        className="px-6 py-3 hover:bg-neutral-100 hover:rounded-xl transition font-semibold cursor-pointer"
        onMouseEnter={handleMouseEnter}
        onMouseLeave={handleMouseLeave}
        onClick={onClick}
      >
        <span className="flex items-center">
          {label}{' '}
          <HiChevronDown
            className={`ml-1 ${isOpen ? 'transform rotate-180' : ''}`}
            style={{ marginTop: '0.125rem' }}
          />
        </span>
        {isOpen && (
          <ul className="pl-6 mt-2">
            <li>Item 1</li>
            <li>Item 2</li>
            <li>Item 3</li>
            {/* Add more menu items here */}
          </ul>
        )}
      </div>
    </nav>
  );
};

export default MenuItem;

UserMenu component:

'use client';

import React, { useState } from "react";
import { AiOutlineMenu } from "react-icons/ai";
import { signOut } from "next-auth/react";
import { useRouter } from "next/router";

import MenuItem from "./menuItem";

interface UserMenuProps {
  onClick?: () => void;
  label: string;
  link: string;
}

const UserMenu: React.FC<UserMenuProps> = ({ onClick, label, link }) => {
  const [menuIsOpen, setMenuIsOpen] = useState(false);

  const handleToggle = () => {
    setMenuIsOpen((prevOpen) => !prevOpen);
  };

  return (
    <div className="relative items-center gap-7">
      <div>
        <div onClick={handleToggle}>
          <MenuItem label={label} onClick={onClick} link={""} />
        </div>
        {menuIsOpen && (
          <ul className="pl-6 mt-2">
            <li>
              <a href={link}>{label}</a>
            </li>
          </ul>
        )}
      </div>
    </div>
  );
};

export default UserMenu;

NavBar component:

'use client';

import React, { ReactElement, useState } from 'react';
import { FaArrowDown } from 'react-icons/fa';
import { useCallback } from 'react';

import Container from '../contanier';
import Logo from './logo';
import MenuItem from './menuItem';
import UserMenu from './userMenu';

interface MegaMenuItemProps{
  label: string,
  link: string,
  children: ReactElement
}

const MegaMenuItem = ({ label, link, children }) => {
  const [isHovered, setIsHovered] = useState(false);

  const handleMouseEnter = () => {
    setIsHovered(true);
  };

  const handleMouseLeave = () => {
    setIsHovered(false);
  };
  const toggleOpen = useCallback(() => {
    setIsHovered((value) => !value);
  }, []);

  return (
    <div
      className="relative"
      onMouseEnter={handleMouseEnter}
      onMouseLeave={handleMouseLeave}
    >
      <UserMenu label={label} link={link} onClick={toggleOpen} />
      {isHovered && (
        <div className="absolute left-0 top-full pl-2 mt-1 bg-white shadow-md">
          <MenuItem label={'label'} link={'/'}/>
          <MenuItem label={'label'} link={'/'}/>
          <MenuItem label={'label'} link={'/'}/>
        </div>
      )}
    </div>
  );
};

const NavBar = () => {
  return (
    <div>
      <Container>
        <div className="flex flex-auto bg-white sticky items-center justify-between gap-7 md:gap-1 p-5">
          <Logo />
          <div>
            <MegaMenuItem label="product" link="/">
            </MegaMenuItem>
          </div>
          <div className="space-x-4">
            <button className="font-semibold bg-amber-400 rounded-full p-3 justify-center text-white hover:bg-amber-600 ">
              <a href="/signup">Sign Up</a>
            </button>
            <button className="font-semibold bg-white rounded-full p-3 justify-center text-amber-600 hover:bg-amber-400 hover:text-white hover:shadow-sm">
              <a href="/login">Log In</a>
            </button>
          </div>
        </div>
      </Container>
    </div>
  );
};

export default NavBar;

The main component here is NavBar component as you can see.

This is my first week of learning React & Next so expect the code to look bad and apperciate any learning advice. Thanks in advance!

I’ve tried everything from ChatGpt, YT videos, and even copying Github reporistroes and the best I could get is having the menu open all the time and it didn’t even close so I prefered to have it closed and then try to make it open once the user hover/open it.

reactjs issue with anchor while using useState

Currently I have a problem where I really do not know what to do.

I have an element where I want to get the anchor and write it to a local state. The only problem is that this leads to an invalid anchor.

<StyledHeader
   avatar={
      <Avatar
         className="md:mx-4"
         alt="user photo"
         src={user.data.photoURL}
      />
   }
   title={row.commentUser}
   onMouseEnter={(ev) => {
      ev.preventDefault();
      handlePopup(ev, row.id);
   }}
/>

I had a Console.log output without setAnchorEl and that successfully pointed to the DOM element.

  function handlePopup(event, id) {
    const target = { ev: event.currentTarget };
    console.log(target);
  }

Browser: Linked to DOM, and worked as expected.

However, as soon as I use setAnchorEl, my console tells me that it doesn’t exist in the DOM.

  function handlePopup(event, id) {
    const target = { ev: event.currentTarget };
    console.log(target);
    setForm({ anchor: event.currentTarget, id: id });
  }

Output Browser: Node cannot be found in the current page.

Do you have any idea what the problem could be?

Have a multipage browser extension with vue

I have started my project using vite-plugin-web-extension

I have started a blank project with yarn create vite-plugin-web-extension and was able to load the extension in my chrome browser.

I would like to have a login page and another page that is accessible only if the user is logged in. I’m assuming that I would have to create a new popup – I might be completely wrong here as this is my first time I’m creating a browser extension.

I have created a page in src/pages/Login.vue:

<template>
  <div>
    <div>
      Login
    </div>
  </div>
</template>

Then I have created the src/login.ts:

import Popup from "./pages/Login.vue";
import { createApp } from "vue";

createApp(Popup).mount("body");

Then I have created my src/login.html:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Refodev - Login</title>
</head>

<body></body>

<script type="module" src="./login.ts"></script>
</html>

Then in my src/pages/Popup.vue I have added a link that when clicked will redirect to the Login.vue page:

<script lang="ts" setup>
  import browser from "webextension-polyfill";

  function onClickLogin(e: Event) {
    e.preventDefault();

    console.log(browser.action);
    browser.action.setPopup({ popup: 'login.html' })
  }
</script>

<template>
  <div>
    <a href="/login" @click.native="onClickLogin">
        login here
    </a>
  </div>
</template>

Unfortunately it’s not redirecting the user to the popup. Is this the correct way to actually do this? Should I setup vue-router? If yes, I setup just like I would do in a normal project?

Thank you very much for the effort in creating this project.

EDIT

Attaching the output for when building the extension:

$ vite build --watch --mode development
vite v4.3.9 building for development...

watching for file changes...

build started...

Build Steps
  1. Building src/popup.html indvidually
  2. Building src/background.ts indvidually

Building src/popup.html (1/2)
vite v4.3.9 building for development...
✓ 15 modules transformed.
dist/src/popup.html   0.39 kB │ gzip:  0.27 kB
dist/popup.css        0.39 kB │ gzip:  0.25 kB
dist/src/popup.js    59.83 kB │ gzip: 23.07 kB
✓ built in 351ms

Building src/background.ts (2/2)
vite v4.3.9 building for development...

watching for file changes...

build started...
✓ 4 modules transformed.
dist/src/background.js  10.01 kB │ gzip: 2.98 kB
built in 60ms.

✓ All steps completed.

✓ 1 modules transformed.
dist/manifest.json  0.27 kB │ gzip: 0.18 kB
built in 1721ms.

Opening browser...
Done!

You can see that login.html is not being exported.

Can anyone decoding this baes64 text

i want to decode baes64 text

Sjg6FkNTRUtQX18QCRQEAgEUMzkTUFJHXFUVAhlLOzs6FgQUDRhCOjg7OhZFWl5LTRILEhFQXFVSZ1pCXkFAawQUGzIwOTgQXVkXDBcaY398cHpxFxo9MTA5E0BSFg8WBhQzOTg7EVNYFA0YDBw7Ozo9F0QVAhkHBx45PTw/FV8bChEAAg0ZPD4xMBJTEAkUBAYBMjA5TB45PTwUBRoDEEo4Oj08FEdUUENFEAkUF1JeW1xvUkBcR0ZpBhoVOjg7OhZbWxUCGRJpf3JnFxo9MTA5E0BSFg8WBhQzOTg7EVNYFA0YDBw7Ozo9F0QVAhkCAQQfPjw/PhpeEgsSBwUZPD4xMBJTEAkUAQA9MTBNHTg6PRcFFQIZSzs7Oj0XRltRSkQTCBMWUV9UXWZTQ11AR2oHFRQzOTg7EVpYFA0YG2Nlc2FtFxo9MTA5E0BSFg8WBhQzOTg7EVNYFA0YDBw7Ozo9F0QVAhkECR45PTw/FV8bChEDBwQZPD4xMBJTEAkUAw49MTBNHTg6PRcCFQIZSzs7Oj0XRltRSkQTCBMWUV9UXWZTQ11AR2oHFRQzOTg7EVpYFA0YG2B4YHJgcBQbMjA5OBBBVRcMFwkVOjg7OhZSWxUCGQUdODo9PBRFGgMQAAQFGD8/PjEbVxMIEwUBABsyMDk4EFEWDxYOADM5OE8fPjw/FQ0bChFJOT08PxVIVVlCRhEOFRRTUVpVblFBW0ZFaAkbHDs7Oj0XWFoaAxATdGZgYGRyGhU6ODs6FkdXFQIZAR04Oj08FFBVGwoRBx8+PD8+GksSCxICAAUaPTEwORNVEQ4VBw8BFTo4OzoWVxQNGAsDCDg6PUgaPTEwEgcQCRROPD4xMBJBXlpHQRQNGBtUWFFWa1ZEWEtKbwAQHz48Pz4aV10TCBMWZXN5e3B8Ex45PTw/FUpYEgsSAhg/Pz4xG1dcEAkUABo9MTA5E0ARDhUHDwoVOjg7OhZSFA0YDgYdODo9PBRVGgMQAwABPjw/ShQzOTgQBBYPFkwyMDk4EENYXEVDGgMQE1ZaV1BpVEpWQ0JtAhYZPD4xMBJfXxEOFRR6bXR9aBAfPjw/PhpLURMIEwUZPD4xMBJWXxEOFQMbMjA5OBBBFg8WBQoOHDs7Oj0XURUCGQEIAB8+PD8+GlsSCxIBDD8/PkUVOjg7EQwXDBdDMzk4OxFEWV9ETBsKERBXXVZTaFtLX0JBbAUXGj0xMDkTXF4WDxYVanZzendnFhk8PjEwEkNTEQ4VBxsyMDk4EFRZFwwXDRU6ODs6FkcUDRgIBAEeOT08PxVfGwoRAwsNGTw+MTASUxAJFAcFDjIwOUweOT08FA4aAxBKODo9PBRHVFBDRRAJFBdSXltcb1JAXEdGaQYaFTo4OzoWW1sVAhkSdWd9fxcaPTEwORNAUhYPFgUUMzk4OxFTWBQNGAwAHTg6PTwURRoDEAMDCxg/Pz4xG1cTCBMFBwQbMjA5OBBRFg8WDzIwOUweOT08FAYIGwoRSTk9PD8VSFVZQkYRDhUUU1FaVW5RQVtGRWgJGxw7Ozo9F1haGgMQE2t8Zn5zZRoVOjg7OhZHVxUCGQIdODo9PBRQVRsKEQcDGD8/PjEbQhMIEwYFABsyMDk4EFQWDxYDCRU6ODs6FlcUDRgNBjs7OkkZPD4xGwEAEAkUTjW

Please help me

Is there a way to capture fingerprints using a Digital Persona 4500 reader on a website?

I am making an attendance system and I am using a Digital Persona U.are.U 4500 reader to try to capture, enroll, and verify fingerprints. Is there any way for me to do this while having an Amazon Fire HD 10 as a client with the fingerprint reader connected to it, and use Flask as the back-end while having a website running on it that does the capturing?

I have tried to use Django-MFA, but that is not friendly for me, so I wanted to stick to Flask, but could not find any guides or code snippets.

Is it possible to block only one hover message in a Chrome extension?

when i hover over this fork button i get this message ” fork your own copy of ‘xyz’ repo”. i want it disabled. I am using a extension which shows another popup about the fork data of the repo , i want that to be enabled , hence i cant put a code to stop all the hover function of that button. i just want to add a code that blocks this particular hover message . how do it?can i make that chart layer infront of the other message? or how to block that specific hover message

i tried disabling hover using pointer-events: none but it disabled all hover messages . i want one of them to stay

How to simplify an array by removing numbers that are close to each other in javascript

I have an array with some numbers
[0, 0.1, 0.2, 0.3, 0.6, 0.8, 1]

how do I remove numbers that are close to each other less than or equal to 0.2 threshold and put the average of those values instead,
so the above array becomes
[0.2, 0.8]

0.2 because [0, 0.1, 0.2, 0.3] are close to each other so they become (0 + 0.1 + 0.2 + 0.3) / 4 = 0.2

0.8 because [0.6, 0.8, 1] are close to each other so they come (0.6, 0.8, 1) / 2 = 0.8

Can you use the activeElement property to see if an element with a specific class name has focus?

Im trying to get the Boolean true if elements with a certain class name are focused on. But it seems Document.activeElement only works with either ID or Tag name, which wont help since they’re elements of the same type. Heres the situation:



   var test2 = document.getElementsByClassName('test2')
   var test3 = document.getElementsByClassName('test3')

   test3[1].focus()

   isFocused2 = (document.activeElement === test2)
   isFocused3 = (document.activeElement === test3)

   document.getElementById('test').innerHTML = isFocused3

<!-- language: lang-html -->

       <input type="text" class="test2" >
       <input type="text" class="test3" >
       <input type="text" class="test2" >
       <input type="text" class="test3" >
       
        <div  id="test"></div>

<!-- end snippet -->