how to encrypt html video source Javaascirpt [duplicate]

Hello everyone I need a help https://i.hizliresim.com/t2vf0x1.png

I want to encrypt this video source like on youtube.

but I have no idea how to do it.

I did some research on the blob issue, but I couldn’t come up with a complete solution.3

I am sharing the vue js codes below.

      el-dialog(
    :visible="onlineMediaUrl != null",
    @close="onlineMediaUrl = null",
    center="center",
    width="60%",
    custom-class="big-dialog"
  )
    .inner(style="width: 100%; height: 95% !important")
      vue-core-video-player(:src="onlineMediaUrl")    

onlineMedia(item){
  this.onlineMediaUrl= item.full_url
},

why i’m getting “_debugSource” as “undefined” in FiberNode?

My question is why I’m getting _debugSource as undefined in FiberNode?

import * as React from "react";

export default function SimplePopper() {
  const handleClick = (event: React.MouseEvent<HTMLElement>) => {
    console.log(
      event.currentTarget[
        Object.keys(event.currentTarget).reduce((key) => {
          if (key.match(new RegExp("__reactFiber", "i"))) {
            return key;
          }
          return null;
        })
      ]
    );
  };

  return (
    <div>
      <button type="button" onClick={handleClick}>
        button
      </button>
    </div>
  );
}

In this code sample first I’m getting the DOM reference of the Button and then extracting fiberNode from that reference object

As you can see in this image, its undefined enter image description here

how to change image onclick for few seconds using javascript

i have a an image section where onclick i want to change it for few seconds and make it back to original image after few seconds, i did the following code:

<img src="contacticons.jpg" usemap="#image-map" id="imgName">
<a onclick="document.getElementById('imgName').src='../newImgSrc.jpg';"></a>

can anyone please tell me how to change it for few seconds and take it back to original image, thanks in advance

How to create an AWS Lambda function using terraform which will trigger every 24 hours to check for the files which are names as JWA

Here’s my code but I’m not able to figure out how do I code my parameter “JWA”

resource "aws_cloudwatch_event_rule" "every_one_minute" {
  name                = "every-one-minute"
  description         = "Fires every one minutes"
  schedule_expression = "rate(1 minute)"
}

resource "aws_cloudwatch_event_target" "check_foo_every_one_minute" {
  rule      = "${aws_cloudwatch_event_rule.every_one_minute.name}"
  target_id = "lambda"
  arn       = "${aws_lambda_function.lambda.arn}"
}

resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_foo" {
  statement_id  = "AllowExecutionFromCloudWatch"
  action        = "lambda:InvokeFunction"
  function_name = "${aws_lambda_function.lambda.function_name}"
  principal     = "events.amazonaws.com"
  source_arn    = "${aws_cloudwatch_event_rule.every_one_minute.arn}"
}

Is it possible to use map function and filter function in if statement in JavaScript?

I have an array object data called place. When the place array enters the solution function, if the object in the place has a TYPE called ‘BOX’, I want to extract only the placeId array with ‘BOX’ TYPE by subtracting the TYPE data of “CONTAINER”. Also, if there is no ‘BOX’ TPYE and only CONTAINER TYPE, I want to extract only the placeId array with “CONAINER” TPYE.

I tried using the map function and filter function in the if statement, but it failed to extract the data and my code doesn’t look good either. How do I fix the code?

const place = [
  {type: "CONTAINER", placeId: 252 }
]

const place = [
  {type: "CONTAINER", placeId: 252 }, {type: "BOX", placeId: 257}, {type: "BOX", placeId: 258}
]


  function solution(place) {


  if(plaecs.map((v) => v.type === 'BOX')) {
        return plaecs.filter((v) => v.type !== 'CONTAINER')
    } else if (plaecs.map((v) => v.type !== 'BOX')) {
        return plaecs.filter((v) => v.type === "CONTAINER")
    }


  }

solution(place)
</script>
</body>
</html>



solution(place)    expected answer : [252]

solution(place)    expected answer : [ 257, 258]

Unable to call sync function inside service from controller in nodejs

I am trying to call async function defined in service for fetching data from database.I am calling from controller but its not returning any data but when I am doing exactly same code inside controller its returning data.

Its showing my this inside controller on doing console.log:

“Inside controller”: [AsyncFunction: fetchReviews]

Below is my code:

constroller.js

const {fetchReviews}  = require('../services/getReviews.service');

const getReviews = async (req,res) => {
  const data = await fetchReviews;
  console.log("Inside controller:",data);
  return res.status(200).send({"reviews": data });
}

getreviews.service.js

const reviews = require('../db/reviewSchema');

const fetchReviews = async () => {
  const allReviews = await reviews.find({});
  const count = allReviews.length;
  console.log("Inside service",count);
  return allReviews;
}

module.exports = {fetchReviews};

Even the console.log() statement is not showing inside service.What could be the cause any help.

How does the client-side javascript process data (e.g. json) sent from nodejs server such as post request?

I have a very simple button html that triggers post request:

<!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" />
    <link rel="stylesheet" href="style.css" />
    <title>Document</title>
  </head>
  <body>
    <form action="/" method="POST" class="my-form">
      <button type="submit" name="inputButon" value="button" id="input">
        button
      </button>
    </form>
    <script src="main.js"></script>
  </body>
</html>

and my server-side script is as follows:

const express = require("express");
const pathPublic = require("path").join(__dirname, "public");
const app = express();

// use public folder for main entry to the website
app.use(express.static(pathPublic));

app.post("/", (req, res) => {
  console.log("post request received");
  res.json({
    id: 1,
    name: "kevin",
  });
});

// start listening to the chosen port
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => console.log(`Server started on port ${PORT}`));

This will send the json file {id: 1, name: “kevin”} to the main page that is running. But the problem is I do not want the json file displayed on my page, what I want is I want to PROCESS the json data within my client-side javascript. I searched all over and did not find any information on this regard. Any help is appreciated.

Javascript Node.js get all the specific array value

This part of code only shows the first and second person in the database “Ban” status.

console.log("Banned0",res.data.data[0].banned); //display the first person banned status
console.log("Banned1",res.data.data[1].banned);  //display the second person banned status

enter image description here

I would like to console.log all 5 person banned status without repeatedly using console.log.

convert array of letters to array of words using JavaScript

convert array of letters to array of words using JavaScript

const inputArr = [
‘b’, ‘a’, ‘k’, ‘e’, ”,
‘c’, ‘a’, ‘k’, ‘e’, ”,
‘e’, ‘a’, ‘t’
];
and my desired output is :
output = [‘bake’,’cake’,’eat’];

I used Join method but I am not getting desired output.
const inputArr = [
‘b’, ‘a’, ‘k’, ‘e’, ”,
‘c’, ‘a’, ‘k’, ‘e’, ”,
‘e’, ‘a’, ‘t’
];

    const result=inputArr.join('');
    console.log(result);

output: “bakecakeeat”

How to I fix an http error code 400? (firebase auth related)

I have a static website where I am trying to configure it to communicate with firebase particularly the authentication bit, but I have 2 errors displaying in the console Console display

now what is happening exactly is that I made a single html page to handle authentication

this page is called (auth.html)

// Import the functions you need from the SDKs you need
import { initializeApp } from 'https://www.gstatic.com/firebasejs/9.8.4/firebase-app.js';
import { getAuth, onAuthStateChanged, signInWithEmailAndPassword, createUserWithEmailAndPassword, signInWithCustomToken, signOut } from "https://www.gstatic.com/firebasejs/9.8.4/firebase-auth.js";

// Your web app's Firebase configuration

// Initialize Firebase
const app = initializeApp({
    apiKey: "API key",
    authDomain: "firebaseapp.com",
    databaseURL: "https://firebaseio.com",
    projectId: "fireauth",
    storageBucket: "appspot.com",
    messagingSenderId: "162620739",
    appId: "1:16262739:web:634d6f3357004eced9e"
  });

// Above initialization details are incorrect deliberately (they aren't the issue/ focus now)

const auth = getAuth(app);


createUserWithEmailAndPassword(auth, email, password)
  .then((userCredential) => {
    // Signed in 
    const user = userCredential.user;
    // ...
  })
  .catch((error) => {
    const errorCode = error.code;
    const errorMessage = error.message;
    // ..
  });

  
signInWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
  // Signed in 
  const user = userCredential.user;
  // ...
})
.catch((error) => {
  const errorCode = error.code;
  const errorMessage = error.message;
});

signInWithCustomToken()
  .then((userCredential) => {
    // Signed in
    var user = userCredential.user;
    // ...
  })
  .catch((error) => {
    var errorCode = error.code;
    var errorMessage = error.message;
    // ...
  });

// Detect auth state
onAuthStateChanged(auth, (user) => {
  if (user) {
    // User is signed in, see docs for a list of available properties
    // https://firebase.google.com/docs/reference/js/firebase.User
    const uid = user.uid;
    // ...
    console.log("Logged in!");
    alert("You are logged in!");
  } else {
    // User is signed out
    // ...
    console.log("Anonymous mode (signed out)");
  }
});


signOut(auth).then(() => {
  // Sign-out successful.
  console.log("logged out")
}).catch((error) => {
  // An error happened.
  alert("Network error");
});
<body>
  <!--- Login section --->
  <div id="login-div" class="container">
    <div class="div1">
    <form class="login-form"><h1>Login to continue</h1>
      <p>Avatar ID</p>
      <input type="text" id="email" placeholder="Email" required>
      <p>Secret Key</p>
      <input type="password" id="password" placeholder="Password" required>
      <button type="signInWithEmailAndPassword" disabled>Login</button><br><a onclick="thenewcallout3()" href="#">Reset my secret key</a>
    </form>
  </div>
</div>


  <!--- register section --->
    <div id="user-div" class="div2">
    <form class="login-form">
      <h2>Register to continue</h2><br>
      <p>Enter your email address</p>
      <input type="email" placeholder="Avatar ID" id="avatarId" required>
      <p>Password</p>
      <input type="text" placeholder="Secret key"><br><br>
      <input type="password" placeholder="Repeat your secret key" id="secretKey" required><br><br>
      <p id="up">I accept that my privacy & actions online are my responsibility not StarlinkBw</p><input type="checkbox" required>
      <button type="createUserWithEmailAndPassword" disabled>Register</button>
    </form></div>
    
    <!---Account reset--->
    <div class="fixAcc"><h1>Password reset</h1><input type="email" placeholder="Enter your Avatar ID"><br><br><button disabled>Request new key</button></div>


    <!--- Portal --->
    <nav class="menu">
      <header>Starlink <span>[X]</span></header>
      <ol>
        <li class="menu-item">
          <a href="../welcome.html">Go back</a></li>
          <!--- views registration form & hides login --->
        <li class="menu-item"><a onclick="thenewcallout()" href="#" >Login</a></li>
        <li class="menu-item"><a onclick="thenewcallout2()" href="#" >Register</a></li>
          <ol class="sub-menu">
            <li class="menu-item">
              <a href="">Social networking</a>
            </li>
            <li class="menu-item">
              <a href="">Self care</a>
            </li>
            <li class="menu-item">
              <a href="">Entertainment</a>
            </li>
        <li class="menu-item">
          <a href="">Productivity</a>
          </ol>
            <li class="menu-item">
              <a href="../star/standard/terms&conditions.html">Terms & Conditions</a>
            </li>
          </ol>
        </li>          
      <footer><button aria-label="Toggle Menu">Toggle</button></footer>
    </nav>


    <script src="../scripts/sl.js"></script>
    <script src="../scripts/jl.js"></script>
    <script type = 'text/javascript' src="../scripts/status-check.js"></script>

    <!--- Firebase --->
    <script src="../scripts/sync.js" type="module"></script>
</body>

which is linked to a JavaScript file called ./sync.js.

I managed to initialize firebase successfully (I think) and reports the current user (me in dev mode) is logged out in the console <Console user view> (which is great news) but I am having trouble sending the user data from the static auth.html page to firebase. what is the issue with my sync.js file?