Google is merging content from two pages Gatsby JS

I’m experiencing a very weird issue with Google indexing and this is reflected in the Google Search Console. The crawled content of the page seems to be a “merge” or a Frenkstein of two different pages. It is like is taking framgemnts of two pages and blend them together in what it crawled. This is finally reflected in the SERP where content is wrong.

Because originally this was messing the canonical too, a lot of focus went on the metatags but there are no issue with canonical, sitempas or any other obvious configuration. On the page there is no reference of the URL or the content the search console is confusing the merging with and of course this issue cannot be replicated on the live version of the page, it is ONLY in Google.

I’m using Gatsby 5 without Helmet but apparently the issue happen regardless Gatsby version (I tried, 2,3,4,5) or Helmet or the new native Head Api. I even completely remove any manipulation of the and hardcoded the in the metatags required head but I got hte same result.
EVen if the metatags in the head are fine, content from the body can be mismatched

What can be causing Google to “store” a version of teh page which merge two pages without any obvious relationship al all or reference on the page?

regex to search complete word and ignore partial match

I am trying to create a regex string to match a term if its complete word, but all of the patetrns i tried return partial matches:

Expectation:
Search for hell(o)-hi and it should return only the first of the following strings as the positive match and ignore the rest:

hell(o)-hi
hell(o)-hi-1
hhell(o)-hi
hello hi
hello--hi

Tried the following strings:

bhell(o)-hi
bhell(o)-hib
(?<!w)(hell(o)-hi)(?!w)
b(?!.*-)(hell(o)-hi)(?!-.*)b

I am testing the strings on https://regex101.com/.

Decrypting an AES encrypted JSON file in Python, with no IV

Trying to mod a game for personal use (Turn on mouse control, remove menu/dialogue restrictions)
To mod the files I need to decrypt a JSON file.
It’s contents should be generic game info but instead shows these Japanese characters when accessed.
マママママアコイウコカマママママ
Notepads guesses this is Shift JIS encoding, I pursued that line of thought and came up empty handed.
VSCode and Visual Studio can’t make heads or tails of the JSON, and** keep adding filler bytes** with rhombused question marks in UTF-8.
VSCode Preview

With Shift Jis encoding enabled, the original string appears and more Japanese(?) characters show up, still with question marks.
VSCode Preview

Selecting all of the text, thousands of characters, and copy-pasting it into Notepads, shows the original 16 character string again: マママママアコイウコカマママママ

Rummaging in the game folder I found a “Decryption.js” that looks like this:

// Encrypted source for asset decryption functions.
let decryptionAESKey = "02f3ffa287f78ba68c60f24f79c6fb18ce32b4ebaadac11af5ace8c67a50ae9f";
let decryptionSource = "40b6b8e3d1f7b7128ecc16eae4702ff707e619c027744b8c55717e265516356dcbc3029ee1748978c8b13100f5c57352bb1e641a9104f037df0d65765d97e1997200d0fc41437c054bd6551b0b65ee0d53ac344f02ed6eaea3c4d24b0b667270c4c11593e4877c4dfd78ded0b8f35d6ceafec6d80ddec24f1653bf74d0b441f98e07529100845f4bff00bf96efa5307913a3fe5c87636ff1039a153a2ecb7ddf34500210292421715e4e063bf185afc22b21693260b638a4a395c1a87c3cc047e9acc5f59a1ca3144064cb6617f07bb6b357c4fe7c6ccbf9afee97efabf19397f7251702a6258a7aa42b704b238d27260930ec02f9451601360341018d4e2c34eb52cade8cb9b46738c369a6324f2e9603961bf81fb14a34f1db1e6f0b550024fd82eb0cfe556578f7b4e8d110b4bb2071f221d9bb024016afb1e7b09751ace8332a739570ef159b865da5a4a599052c7a31bcdbe7c728fc78fdec634baa68fec24bc26cd306bb32b42d9e78b69eed8ff011e86730436027ec3a60fca7bdc363192a10c46353ba45dc1bd476c2d004746a506e4539fac1b456a4aa36063ada89f682e3cb20076130d4c7041e2fa8bf1867f4c257f453332a39efc2a4463b8da5a1509e9016623d047226e2e6fb90b53b11c28e24938a41e0c88441b687e372de74939f10f16b4c892ab99f390b827efa70bed165619e8be33c29211c1f0bc8122e0addde18bff2afa2b54409c33f36bb480552bb5d9d293eb1cc10b8cd1029fc08464b31c7ffe85a3bd0334782b2561e21d8df4208ea0390ab5d3ea5913bbdd822ca1d9e3d291e8953c3e7742d414616e3e49058a6fb984059f14346de6d13a138b710ad03c9a85f353142e1b9f731ea8f0b7df601d949339a7b917362177e03f89610f757c1564b6a8a4450ccbc8f0e7a1f1b33e6c5817724e2a8e0187e00a8b28cc0ad9a789ae38bba0104919806813cfbbdba5afe880fc074e7f57e9518c9a5293dee4dc69c402a652a660eb40f2c19ea5cdfc947a78205fc792423c40e20565c98f8b0e86a5c4928c018ffa269d99398a92d8259d4a29f98841caa1f7f38afd7973c98572411b7136b4b46c0071814e951c712acebff3dc65dd3d51be7714c6e2b687cf1d5d3bd6af32e53b90ebd7c5d189fd7e08790b20f1c9483ea296b4997c90396736c8d3f4f49f39e948bc083b1a17977a6996d53f0b2ea5b8afa591b13487903762d8ea90f334d0e3c6ae6c9fe6be1a0e820ff9185fc10d469c7945d2f67f24e87fe0efa81e3eab7e35df5a17f4fd29a1a0803d77f0d381f8ef169c75a59133ab9b527bff464d999c5cf2ee3e26588c19577ff8b118e507886c575d7bf34a8d55f79772a2aa64987ebc43dfa3b6790d20fa54a4c2344c9647d987f9da268573a1f7ecad3df5013eff514d3142a63b6636cfeb0f3731a2770c053f77fa839bff6cdc4a8d1da5ccc6457f23c6d1db958086b029170c54c4f2d8658589dad998860f8bcaa06a59345f754943fb78384253c077e91959ef6c7f0e1862ea4e67dad3fd5de4ccf99c215837619c9173ee9645c59100fc718ee8b95782af73d1f952898cedb653c9090f5941f5f440968a0dcf26fa3a5b73715f7f379b7d793a22559bb00107b5f346175f4aaf27e2eac1a6a35b21ab246fb68b1d48eb949aa71932cab58eaaffcd29965d9dd6e068f13d23cbde334ccb0aa0a0724a7dba6162b4487066605ae3148575cdc13523f06713aa2642e121ccea6c28c750428bc170e7486b6c255f50064dac1080d591b26289138705837188abb240a2c34e1a4293dd8f294c31d763d83ec0833cea4633e23a863cd3a700af99e1dd7781d8cb2088857ab9620af005aa267e75422e65a55a377b9af96008adab10ae73c7c1020e2d2d4406e54eb2f4270013537138c19c3b6795f8785eb66ef3b0dcdce56ed17a1022d0362a6c9e9be6c3b23667a51ae1fa8b8988602f56860cb90b00f38b82f3c1e1d101449c430ff77d9e38f30ed2704e8620419b28ced8d7933f0447c0e4e86a0678072c7dc3bf43adabd18bc5226bd7e1ec55bf1b779f227e54517252d919eee1ec6494fe3088235f8ac46b77888b6ebbf633da74371f0b9e014df6d4d993da3df5cf278205a43e468f48dca0faf1cc864ef8024aece48f36ded739b56deefd3380e2c851020f2ad80b6cef180fb2a24bbdf070e4d170c1a7a0eb4fdab1309cb2a4d3952ec58efc0c23696aa173de2ae878cd9fc1d6907f5542acea57786207c43859aecf1ca5715d78b3d92198434d83694960c1c4d7d8a23ca01af35fd6a5c98c38c0367b40cbb17559cc753d636ba94fe8ba6fc2635d27767dcef5f9b667cd94f843ec022e8195e9234e0c43801480d6f1be263572a5444cef4ac4c9f80a41e76c0012727e195776fa4b56834f447a11ff05f4092beb6ad234054b7164299b2e1e670407a280812794f2d1fbf7ad6342225f5be2537e13f5902b54d5bdaf19fa4ff535d44e03a9be57d91135119de28966320f449e97cc6fb807a6ed5d9f4bcc22d546af71d253b3cf00d4dd56393d68b25aff86c0893502c200257f3418a7e1247629a3a9464b415ffd1d7d6862b4f00fcb2669e943b9e157862bf71f2d5156a40bc91e26dbe6482090a03a324220c79c1f9c3b7c7f932c6d6407cb8fce7b5a67221a2c93aedf78d7eb69ba88862e31e92b2d5c7e8eee17bffd108bc46b94997590d94248d5440648baefebc37564facaa01047ebeeab15f90eff18111e8fc890231d3ba3d1214b0b797f9cf688f06a2b9e006de65846a01fd4bbaa290091d0b41b11179f31063a947a1778ed0f80931d66281e42a43f8a57ce31983c71d11e1c8cffd9a55c6987b3ca1c2cafafa0d3e0d21668477de5d4bac263c2d3828c5c55888033efedceb68885cc3e87a2a437875e8852d1445b660abe43555465713b57f694fe412183a0a809ad57e1805a11cc68a7f07b77c2e58581de2eb97741a3e34682437584f129894abd914effcb01d694e71046e3efa453386f08a283743adcfdcbf07ebb96e5a43c3c930f20ae977e0493ed28016085f99d9c6e9164dc4ba1cba17a7cdf121c885fa8cea686a7c4160df73185fb9067079fcd865a40c39c43c690e1b2c39a51aa18fc4ef4b269edc01fc1654b96e065de53fccf9ca933aa3134bb627511068e1caf24454a47ed92dd56122ce25786e8a38f31a42d766c6bd241410e36172b4722c84065c1bf3261aa587d1d5374f4bf6a96791cddc74ab97f32533ea487710dabcd17ce6160380eef91918e70dac3268301461013a255e8aa593d005db3b893db20c5cca8feb5af813f07ec603dd02f3414ed2a4";

Supposedly this decrypts all of the game files, PNGs, OGGs, and JSONs. I’m only interested in the System JSON since that’s where my settings are.

I pursued AES Decryption but this file does not mention an IV which I understand is needed.
I wrote this code in Python using the cryprography library, but without understanding what “decryptionSource” is, it doesn’t do anything.
decryprionSource is 4703 characters, isn’t it too big to be an IV?

from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
import json

def decrypt_aes_cbc(file_path, key):
    with open(file_path, 'rb') as file:
        encrypted_data = file.read()

    # There is no IV
    iv = encrypted_data[:16]
    ciphertext = encrypted_data[16:]

    cipher = Cipher(algorithms.AES(key), modes.CBC(iv), backend=default_backend())
    decryptor = cipher.decryptor()
    decrypted_data = decryptor.update(ciphertext) + decryptor.finalize()

    try:
        decrypted_json = json.loads(decrypted_data.decode('utf-8'))
        return decrypted_json
    except json.JSONDecodeError as e:
        print(f"Error decoding JSON: {e}")
        return None

def main():
    key = bytes.fromhex("02f3ffa287f78ba68c60f24f79c6fb18ce32b4ebaadac11af5ace8c67a50ae9f")

    file_path = input("Enter the path to the AES encrypted JSON file: ")

    decrypted_data = decrypt_aes_cbc(file_path, key)

    if decrypted_data is not None:
        print("nDecrypted JSON data:")
        print(json.dumps(decrypted_data, indent=2))

if __name__ == "__main__":
    main()

it prints :
ValueError: The length of the provided data is not a multiple of the block length.

All files are provided in this link if you want to review them:
https://drive.google.com/file/d/1BUzACflcfEtQk5Nf6V14h8S5gZRsof9N/view

What am I missing?

I tried converting from Shift JIS encoding to UTF-8 but it did not produce relevant data.
I tried to pursue AES decryption as hinted by the js file, but I do not know what to do with decryptionSource which is a key piece of information.
I’m new to all of this and just learned about AES encryption.
The key is a 64 hex so it must be 256-bit, I don’t know which AES mode to use so I’ll try all 6.

How to get profile pic from Firebase Facebook login in JavaScript?

I am developing a website where user is logging to Facebook using Firebase. However, when I try to retrieve profile picture, I am not getting it.

onAuthStateChanged(auth, (user) => {
  if (user) {

     const uid = user.uid;
     document.querySelector('.user-info > h3').textContent = user.displayName;
     document.querySelector('.user-info > img').src = user.photoURL;

    } else {
    // User is signed out
      }
    });

Getting this, instead of profile picture

How to filter two columns into a filter property’s string in supabase db?

I’m using the Supabase real-time feature. I subscribed to a table to get the updates, but I also want to filter the updates.

In the “connections” table, I have two columns called user1_id and user2_id

Now, I need to filter the updates in a way that, in the updates, if either of the columns contains my user ID, then I should receive that update. My user ID could be in either of the columns.

I saw in the documentation that I should use the filter property in JavaScript to use any filters, but I can’t figure out how to make these two filtered strings.

I tried many ways but couldn’t make it work 🙁

I was recently asked this question in an interview:

Given an object and a filter function, write a function that will go through and filter the object, then return a filtered object.

Function:
deepFilter(obj, filter)

Input Object: 
const obj = {
  a: 1,
  b: {
   c: 2,
    d: -3,
    e: {
      f: {
        g: -4,
      },
    },
    h: {
      i: 5,
      j: 6,
    },
  }
}

Callback Function:
const filter = (n) => n >= 0

Output:
{ a: 1, b: { c: 2, h: { i: 5, j: 6 } } }

My implementation:

function deepFilter(obj, filter, resultObj){
    if(typeof(obj)!=="object"){
        return obj
    }
  for(let key in obj){
    if(obj.hasOwnProperty(key)){
        const filteredValue = deepFilter(obj[key], filter, resultObj)
        if(filter(filteredValue)){
            resultObj[key] = filteredValue;
        }
    }
  }
   return resultObj
}

The output isn’t what is expected.

My output:
{ a: 1, c: 2, i: 5, j: 6 }

Is there a different approach to this problem or is it something that I’m missing in the function implementation?

Rocket Chat Hubot is not showing green dot and replying back

I am new to rocket chat, i deployed rocket.chat version 6.4.8 using docker-compose to ec2 instance and working fine and create one bot user in rocket chat

i am running hubot script to connect with rocket chat it showing logs as successfully connected but when i go and checked it in rocket.chat its not showing green dot(light) and not getting reply back

Below are my environment variables

enter image description here

enter image description here

Node JS: evaluate value inside array of objects

I have data that looks like this

[
  [ '@test','1.2.6' ],
  [ '@test2','4.0.1' ],
  [ '@test3','2.2.0-unstable' ],
...
]

and I would like to retrieve all the values that have appended -unstable and list both the name @test3 and the value 2.2.0-unstable and perform actions on that

I’ve tried this but I’m nowhere near

  axios.request(config)
  .then((response) => {
    const myArray = response.data.value.reduce((acc, next) => { acc.push(...next.versions.map(v => [next.normalizedName, v.normalizedVersion])); return acc }, [])

  myArray.forEach(function(value){
        if ((value === '-unstable')) {
          // do some stuff
    } 
  });

Add classes in Apex from css file

I have created a static application file with the extension of a .css file and it contains classes and i uploaded the file in my Apex23 application, but when i use the link of the file to access the classes from the file, they don’t appear.

I inserted my link in a page of the app in the field CSS-> File URLs, but the classes still don’t appear in the CSS Classes field.

How to reassign variable inside if-else statement in JS? [duplicate]

I have JS function in my Cypress test that should work in 2 modes: create new item or edit existing item if it already exists. Something like this:

let editMode = true
cy.get('body').then(($body) => { 
  if ($body.find("tr:contains('No data to display')").is(':visible')) {
    editMode = false // Here is the point where re-assining should happen if the item was not found
    // Do something in Create mode
  } else {
    // do something in Edit mode
  }
})

... // Some code common for the both modes is here

// Specific create/edit code
if (editMode === false) {
  // do something in Create mode // Expect to have this code executed
} else {
  // do something in Edit mode // But this code is actually executed
}

As you can see from the comments above, in my code reassigning doesn’t work. Could you, please point me the reason?

What happens if you call a URL of your react app with a POST method?

I am trying to to da a payment integration (Eazebuzz) . I gave surl and furl as a page in my react app (something.com/success or localhost:3000/success) . I am getting Cannot POST message as response.

I did solve this my having a backend api called in both success and failure cases and redirect from there using res.redirect() and it did solve my problem and was actually the requirement. but this got me thinking.

How would you have a frontend url called in case there was no api. How would you get react to render a page on a POST call?

How to set nonce attribute dynamically in React app , that uses Material UI, for the Content-Security-Policy?

We would like to set nonce attribute for dynamically generate style attributes from material UI . We are using makeStyles function from material UI to inject css in individual components.

Is there a workaround for the same ?

Our react app is hosted inside a dotnet wrapper . And we are setting the CSP policy in startup.cs file.

**NOTE : We are not relaxing the CSP ploicy by removing the ‘unsafe-inline’ atrribute.
**
If anyone has come across this issue before I would really appreciate hearing.

We tried to add the nonce attribute in the starup.cs.

error – “JSON.parse: unexpected character at line 1 column 1 of the JSON data”

Description:

I keep getting the error in the title and I suspect that maybe I’m using the api_url wrong.

There’s probably something obvious I’m missing here.

I’ve been trying stuff and that is why the code is commented out and has some weird test stuff.

My intention:

Pass query and max_lead_amount through the URL and then call a function with it.

The Error:

I’m 80% sure the problem is in the first code block (inside script tag) as console.log("api_url is " + api_url); is the last console.log called.

You can see this in the browser console output:

console output

google-maps-results.html

<script>
    async function fetchGoogleMapsResults() {
        //try {
            console.log("fetchGoogleMapsResults ran");

            const query = "{{ query }}"; // passed through the render_template method
            const max_lead_amount = "{{ max_lead_amount }}"; // passed through the render_template method

            document.getElementById('scrapeDisplay').innerText = `Loading...`;

            const api_url = `/api-v1/scrape/google-maps/?q=${query}&max=${max_lead_amount}`;

            console.log("api_url is " + api_url);

            const response = await fetch(api_url, {
                headers: {
                  "Content-Type": "application/json",
                },
              });
            const data = await response.json();

            console.log("done. awaited response.");

            /*// Update the content of the element with the fetched leads
            document.getElementById('scrapeDisplay').innerText = `Leads = ${data.place || data.test || 'N/A'}`;

            if (data.error) {
                // If there's an error, append it to the displayed content
                document.getElementById('scrapeDisplay').innerText += ` (ERROR: ${data.error})`;
            }
        } catch (error) {
            // Handle fetch or JSON parsing errors
            console.error('Error fetching data from API:', error);*/
        //}
    }
    fetchGoogleMapsResults();
</script>

api_views.py

@app.route('/api-v1/scrape/google-maps', methods=['GET']) # NEED UPDATE AFTER
def scrapeGoogle():
    print("scrapeGoogle() ran")
    
    query = request.args.get("q")
    max_lead_amount = request.args.get("max")
    
    print("query is a" + query)
    print("max_lead_amount is a" + max_lead_amount)
    
    # scrapeGoogleMaps(driver, query, max_lead_amount)
    
    a = {"test":"teste"}
    print(a)
    
    return jsonify(a)

Javascript if statement showing falsy when truthy on Safari (Works on chrome)

I am designing a quiz app. The code snip below from the .js file for a .html file detects when the user has selected the correct answer. However is Safari, when the code is truthy, the falsy result is shown.

// Gets the correct answer for the question
const correct = quiz.correct[x]

for(check of checkboxes){ // all checkbox inputs user can choose from
    if(check.checked === true){ // can only choosea signle checkbox
        const ans = check.nextElementSibling.innerText.substring(3) // The answer from the selected checkbox
        console.log(ans + ' ' + typeof ans) // Confirming the selected answer is right
        console.log(correct + ' ' + typeof correct) // Confirming the correct answer for the question is right
        if(correct === ans){ // Does not work on Safari...
            console.log('true')
        }else{
            console.log('false')
        }
    }
}

The:

if(correct === ans){

gives the incorrect result is Safari. it works as expected in Chrome.

This is the screen shot from the running code in safari with the console.logs:

enter image description here

This is the same code running in Chrome:

enter image description here

I have tried some very basic test code with an if formula that works as expected. But for some reason the code above does not work.

I have also done multiple apps with just as complex code and never had an issue.

Does anybody know how to make this work? The end users will more than likely be using Safari.

PWA Notifications without push

Is there a way to reliably get a PWA to send push notifications using the FE’s state alone?

Right now I have quite a simple usecase, where I want some PWAs I have to send push notifications on timers set by the user.

This doesn’t require any server-side logic, the service worker can always know the time.

However, I’ve seen no way to do this. The intuitive way is to use a setInterval that executes every minute and checks the time, but browsers seem to throttle the worker after a while.

The alternative is to use the push API but this seems to actually be more expensive in terms of resources and much less elegant to setup.

Is there a way to get push notifications to fire in a FE-only way when the PWA is foregrounded?