Audio recording on chrome windows but not on chrome android

I was making this site mp3 to webm for a project in discord and I can record on firefox with every device but chromium works only on windows.

When I record an audio it gets stored locally and converts to a black canvas to embed on discord then a bot just ask if the webm is ok or not and if it’s accepted it gets transferred to another channel.

It need to be a embed file because bots on discord.js or py can’t manipulate audios yet

let mediaRecorder;
let audioChunks = [];
let audioBlob;
let canvas;
let canvasStream;
let audioStream;

function createCanvasWithNickname(name) {
    canvas = document.createElement('canvas');
    canvas.width = 400;
    canvas.height = 144;
    const ctx = canvas.getContext('2d');
    ctx.fillStyle = 'black';
    ctx.fillRect(0, 0, 400, 144); 
    ctx.fillStyle = 'white';  
    ctx.font = '24px Arial';  
    ctx.textAlign = 'center'; 
    ctx.textBaseline = 'middle'; 
    ctx.fillText(name, 200, 72); 

    return canvas.captureStream(30); 
}

// Funzione per inizializzare l'audio con un metodo alternativo
async function initializeAudio() {
    const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
    audioStream = stream;
}

document.getElementById('recordButton').addEventListener('click', async () => {
    const name = document.getElementById('nameInput').value.trim();

    canvasStream = createCanvasWithNickname(name);
    await initializeAudio();
    const combinedStream = new MediaStream([...canvasStream.getTracks(), ...audioStream.getTracks()]);
    mediaRecorder = new MediaRecorder(combinedStream, { mimeType: 'video/webm' });
    mediaRecorder.start();
    mediaRecorder.ondataavailable = (event) => {
        audioChunks.push(event.data);
    };

    mediaRecorder.onstop = () => {
        audioBlob = new Blob(audioChunks, { type: 'video/webm' });
        const audioUrl = URL.createObjectURL(audioBlob);
        document.getElementById('audioPreview').src = audioUrl;

        document.getElementById('recordButton').disabled = false;
        document.getElementById('stopButton').disabled = true;
        document.getElementById('sendButton').disabled = false;
    };

    document.getElementById('recordButton').disabled = true;
    document.getElementById('stopButton').disabled = false;
});

document.getElementById('stopButton').addEventListener('click', () => {
    mediaRecorder.stop();
});

document.getElementById('sendButton').addEventListener('click', async () => {
    const name = document.getElementById('nameInput').value.trim();

    if (!name) {
        alert('Devi inserire un nickname!');
        return; 
    }

    const formData = new FormData();
    formData.append('file', audioBlob, 'audio.webm');
    formData.append('username', name);

    try {
        await fetch('webhookhere', {
            method: 'POST',
            body: formData
        });
        alert('Audio inviato a Discord con successo!');
    } catch (error) {
        console.error('Errore durante l'invio del file:', error);
    }
});

I tried lots of workaround and did research but all I find are people with the same problem and no answers

sharp can’t convert svg to png

I have an icon.svg file which looks like this:

And has a code content like so:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="2142" height="2142" viewBox="0 0 2142 2142">

  <image id="LargeTile" width="2139" height="2139" xlink:href="data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAACFsAAAhbCAYAAACVGla7AAAgAElEQVR4nOzdZ5dc53ku6Ls6N4BGzjkDzDlIoqhsWbaP18yn+T5/Yv7XjI+9jn1sHyuLEhUoBpFiTiBBEiQBIqO7Z73gU0dbTZAEiG50qOvyel2hG2m/tcSq3fe+n97/838/EQAAAGDe9a5jJX99O5RkJMlokvG6bWusnh/uPDdca7K+d6TWqiRr6v5s3U7U987WnzFe39d+n5laI/V7Tdb3Nlfq79X//vF6fnbOGq4/Y1Xn184ukZdUr3OMLyU5l+RC/f36x7z/PTP19XP1bx+qda1f2z++F+r5y50/s33vxbrfvud8fU97brq+93z92v7xv1TPT9f3Xa6/w+XO4+k5xz2fc/9a

.....
my svg is a very long base64 string.....
.....

Qthi69CEsW2htWIMW9wewhLbh3aDbUNwYufQmDGGLeZQwPzawWrDAFv6Z9/p190rbDG+2b+r33PXPW57kLYMj+/3DVtcH/7btv2IsMXVXj//N976lrDF8tB6cXtow5jDFqsLk4Vmke+6/WGGWQAAAIBJkv8D7M55AMY6aqAAAAAASUVORK5CYII="/>
</svg>

I know the svg contents are a bit complex, but the file loads in browsers just fine.

I want to convert my icon.svg to a png file using the npm package ‘sharp’.

My very basic script is below:

import sharp from 'sharp';

sharp('icon.svg')
  .png()
  .toFile('test-output.png')
  .then(() => console.log('Rendered successfully'))
  .catch((err) => console.error('Error rendering SVG:', err));

If I run it with node svg2png.js the test-output.png is a blank transparent image with nothing in it.

I know my script works with other .svg files, such as when I test it with the below ‘working.svg’ file:

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<g>
    <circle style="fill:#14B0BF;" cx="256" cy="256" r="256"/>
    <path style="fill:#3387B5;" d="M437.018,437.018c59.699-59.699,83.722-141.548,72.12-219.09L401.833,109.86L96.691,163.666
        l8.771,49.731l2.463-0.435l0.077,0.435h-2.54v168.397c0,6.38,3.036,12.032,7.67,15.77c0.916,1.137,112.067,112.067,112.579,112.579
        C300.913,519.05,379.31,494.725,437.018,437.018z"/>
    <path style="fill:#0F303F;" d="M415.309,381.788c0,11.192-9.16,20.352-20.352,20.352H125.809c-11.192,0-20.352-9.16-20.352-20.352
        V233.743c0-11.192,9.16-20.352,20.352-20.352h269.148c11.192,0,20.352,9.16,20.352,20.352V381.788z"/>
    <rect x="105.462" y="213.396" style="fill:#FFFFFF;" width="309.862" height="50.499"/>
    <path style="fill:#0F303F;" d="M156.001,220.314l-36.874,37.366h37.366l36.874-37.366H156.001z M311.322,220.314l-36.874,37.366
        h37.366l36.874-37.366H311.322z M207.775,220.314L170.9,257.679h37.366l36.874-37.366H207.775z M259.548,220.314l-36.874,37.366
        h37.366l36.874-37.366H259.548z M363.095,220.314l-36.874,37.366h37.366l36.874-37.366H363.095z M414.868,220.314l-36.874,37.366
        h37.315v-37.366H414.868z M105.462,220.314v37.366h0.246l36.874-37.366H105.462z"/>
    
        <rect x="98.721" y="136.353" transform="matrix(0.9848 -0.1736 0.1736 0.9848 -24.203 46.4881)" style="fill:#FFFFFF;" width="309.857" height="50.498"/>
    <path style="fill:#0F303F;" d="M316.467,131.937l42.803,30.397l36.797-6.487l-42.803-30.397L316.467,131.937z M163.502,158.904
        l42.803,30.397l36.797-6.487L200.3,152.417L163.502,158.904z M265.477,140.928l42.803,30.397l36.797-6.487l-42.803-30.397
        L265.477,140.928z M214.492,149.919l42.803,30.397l36.797-6.487l-42.803-30.397L214.492,149.919z M112.517,167.895l42.803,30.397
        l36.797-6.487l-42.803-30.397L112.517,167.895z M97.894,170.476l6.487,36.797l36.746-6.482l-42.803-30.397L97.894,170.476z
         M366.479,123.116l42.803,30.397l0.241-0.041l-6.487-36.797L366.479,123.116z"/>
    <path style="fill:#FDC00F;" d="M394.634,317.379h-0.072v-36.552h-269.44v103.235h269.44v-62.172h0.072V317.379z M390.497,284.897
        v32.481h-101.13v-32.481L390.497,284.897L390.497,284.897z M284.856,284.897v32.481H177.05v-32.481L284.856,284.897
        L284.856,284.897z M129.193,379.991v-95.094h43.341v95.094H129.193z M177.05,379.991v-58.102h107.807v58.102L177.05,379.991
        L177.05,379.991z M390.497,379.991h-101.13v-58.102h101.125v58.102H390.497z"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

it correctly produces the png:

import sharp from 'sharp';

sharp('working.svg')
  .png()
  .toFile('test-output.png')
  .then(() => console.log('Rendered successfully'))
  .catch((err) => console.error('Error rendering SVG:', err));

How can I make my icon.svg file work with sharp? I’ve tried running it through svg simplifiers online, but the output file has not worked in my script yet.

Script and svg icons here:
https://limewire.com/d/37413a16-f4fe-45f9-8f97-39f726633b1d#DhV04xjiGTKt1WjgxS-ULjs_sOU0e7NLry3rmQSNWd0

tabulator issue with importing and exporting data when using a handle for moveable rows

I am using table.download to export and table.import for saving and retrieving the data to my table. All is well until I utilize

moveableRows: true,
rowHeader:{headerSort:false, rowHandle: true, formatter:"handle"},

It’s only when using the handle that shows with ‘formatter: “handle”‘ AND try and import that I run into issues. I can still move the rows without the handle and all is OK, but I like the handle on the left side of the row, and it appears to be the use of the handle configuration that causes errors when reading a csv file into the table.

The actual error I am seeing is that the first field in the rows is missing when the csv data is read into the table.

Any pointers would be appreciated.

My setup is below;

var tableCues = new Tabulator("#cueTable", {
    rowHeight: 30,
    movableRows: true,
    rowHeader:{headerSort:false, resizable: false, minWidth:30, width:30, rowHandle:true, formatter:"handle"},
    selectableRows: true,
    placeholder: "Awaiting Data, Please Load File",
            columns: [
            { title: "Name", field: "name", width: 150, editor:"input" },
            { title: "Item", field: "item", editor:"input"},
            { title: "ABS Move", field: "absmove", editor:"input"},
            { title: "Speed", field: "speed", editor: "input"},
            { title: "Accel", field: "accell", editor: "input"},
            { title: "Decel", field: "decel", editor: "input"},
            { title: "Position", field: "posnow", editor: "input"},
            { title: "Progress", field: "progress", formatter: "progress", sorter: "number" },
            { title: "Done", field: "car", hozAlign: "center", editor: true, formatter:
                "tickCross", formatterParams: { crossElement: false },
                headerSort: false, editable: true },
            { formatter:"buttonCross", align:"center", title:"del", headerSort:false, cellClick:function(e, cell){
                if(confirm('Are you sure you want to delete this entry?'))
                cell.getRow().delete();
                }
            }


            ],


});

//trigger download of data.csv file
document.getElementById("download-csv").addEventListener("click", function(){
    tableCues.download("csv", "data.csv");
    });

//trigger AJAX load on "Load Data via AJAX" button click
document.getElementById("file-load-trigger").addEventListener("click", function () {
    tableCues.import("csv", "buffer");
});

Instagram API with Instagram Login Data deletion request URL route signed_request body data cannot validate

In my meta application with instagram api with instagram login when I define the “Data deletion request URL” the POST request send to my route with following body content

POST /api/delete HTTP/1.1
Host: 26d5-45-8-19-76.ngrok-free.app
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
Content-Length: 166
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: application/x-www-form-urlencoded
X-Forwarded-For: 2a03:2880:30ff:8::
X-Forwarded-Host: 26d5-45-8-19-76.ngrok-free.app
X-Forwarded-Proto: https

signed_request=NybldKYslIBJJfCjH9jIE6PI3ohOKimGpB293v1ojeI.eyJ1c2VyX2lk.......

I can’t verify the content using header provided based on the description that provided in following link Data Deletion Request Callback

I did following in the NestJS framwork service

import { Injectable } from '@nestjs/common';
import * as crypto from 'crypto';

@Injectable()
export class SignedRequestService {
  private readonly secret = 'appsecret'; // Use your app secret here

  parseSignedRequest(signedRequest: string): any | null {
    const [encodedSig, payload] = signedRequest.split('.', 2);

    // decode the data
    const sig = this.base64UrlDecode(encodedSig);
    const data = JSON.parse(this.base64UrlDecode(payload));

    // confirm the signature
    const expectedSig = crypto
      .createHmac('sha256', this.secret)
      .update(payload)
      .digest();

    if (Buffer.compare(Buffer.from(sig), expectedSig) !== 0) {
      console.error('Bad Signed JSON signature!');
      return null;
    }

    return data;
  }

  private base64UrlDecode(input: string): string {
    const base64 = input.replace(/-/g, '+').replace(/_/g, '/');
    return Buffer.from(base64, 'base64').toString('utf-8');
  }
}

Handling CORS Preflight Issues in API Requests

// Submit feedback
async function submitFeedback() {
    const email = document.getElementById('feedback-email').value.trim();
    const text = document.getElementById('feedback-text').value.trim();
    const captchaValue = document.getElementById('captchaValue').value.trim();

    // Validate input
    if (!email || !text || !captchaValue) {
        alert("Email, content, and captcha cannot be empty!");
        return;
    }

    const feedbackData = {
        email,
        text,
        captcha_id: captchaId, 
        captcha_value: captchaValue
    };

    try {
        // Generate signature
        const signature = await generateHMAC(new URLSearchParams(feedbackData), key);
        
        // Send request
        const response = await fetch('https://127.0.0.1:8080/gongdan', {
            method: 'POST',
            credentials: 'include', // Ensure sending and receiving cookies
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded',
                'X-Timestamp': Math.floor(Date.now() / 1000).toString(), // Current timestamp
                'X-Signature': signature, // Pass the signature
                'X-Nonce': Math.random().toString(36).substring(2, 15) // Randomly generate a nonce
            },
            body: new URLSearchParams(feedbackData)
        });

        // Handle response
        const data = await response.json();
        
        if (data.code === "0") {
            document.getElementById('feedback-response').innerHTML = `<p>Feedback ticket created successfully!</p>`;
        } else {
            document.getElementById('feedback-response').innerHTML = `<p class="error">Feedback failed: ${data.data}</p>`;
        }
    } catch (error) {
        document.getElementById('feedback-response').innerHTML = `<p class="error">Request failed: ${error.message}</p>`;
    }
}

The problem with the code:
There is an issue when I execute it: after the browser sends an OPTIONS request, the following function calls to other backend APIs will also send an OPTIONS request. This keeps happening until I stop and restart the backend, even though the backend shows that the OPTIONS request has passed.

This is the Backend Console message:

[GIN] 2025/01/18 – 11:08:18 | 204 | 0s | 127.0.0.1 | OPTIONS “/captcha”
Session ID:
2025-01-18 11:08:18.4210575 +0800 CST m=+10.512820201 1m0s
1 2
[GIN] 2025/01/18 – 11:08:18 | 200 | 4.1433ms | 127.0.0.1 | GET “/captcha”
[GIN] 2025/01/18 – 11:08:23 | 204 | 0s | 127.0.0.1 | OPTIONS “/gongdan”
It is evident that the backend only received the OPTIONS request and did not receive the POST request. After that, no matter which API is called, only an OPTIONS request will be sent, and the subsequent requests will not be sent.
What should I do?

Module Not Found Error when attempting to use Path Mappings in JSConfig .NET React Project

I am currently getting the below error when trying to use path mappings within the jsconfig.json file inside of my .NET React App:

enter image description here

Here are the contents of the jsconfig.json file:

  {
   "compilerOptions": {
     "target": "ES6",
     "baseUrl": ".",
     "module": "commonjs",
     "jsx": "react",
     "paths": {
       "@components/*": ["./src/app/components/*"]
     }
   },
  "include": ["./src/**/*"],
  "exclude": ["node_modules", "config", ".vscode"]
}

And here is the file structure of my app:

enter image description here


enter image description here


For now, I have just been trying for a components path mapping, but as mentioned, I am getting the module not found error when trying to import a component on the homepage of my application.

Any suggestions?

how can I modularize this code to reuse the AJAX in different HTML files without needing to rewrite it each time?

I separated my JavaScript code from the .html file and placed it in a static folder, then imported it. However, after this change, my AJAX stopped working. How can I make my ajax.js reusable across different pages without rewriting it?

This was the working code that handled the editing of classes, receiving, and processing files.

I should mention that I’m working on a Django project, and this is the first JS file I’m including in the project. The idea of separating it is so that the same AJAX functionality can be used for the adicionar_aula URL.

Here is the code:

`

Editar Aula

Editar Aula

{% csrf_token %}

{{ form.as_p }}

Arquivos já adicionados:

{% for arquivo in arquivos_existentes %}

{% if arquivo.arquivo %}

{{ arquivo.arquivo.name }}

{% else %}

Arquivo não disponível

{% endif %}

Excluir

{% empty %}

  • Nenhum arquivo adicionado ainda.
  • {% endfor %}

    Adicionar Arquivo

    Salvar Alterações

    $(document).ready(function() {

    // Enviar novos arquivos via AJAX

    $(‘#input-arquivo’).on(‘change’, function() {

    var formData = new FormData();

    $.each($(this)[0].files, function(i, file) {

    formData.append(‘arquivo’, file);

    });

    formData.append(‘csrfmiddlewaretoken’, ‘{{ csrf_token }}’);

    $.ajax({

    url: ‘{% url “editar_aula” pk=plano.id %}’,  // URL para a view de edição

    type: ‘POST’,

    data: formData,

    processData: false,

    contentType: false,

    success: function(response) {

    // Adicionar o novo arquivo na lista de arquivos sem recarregar a página

    var novoArquivo = response.novo_arquivo;  // Espera-se que a view retorne os dados do novo arquivo

    $(‘#lista-arquivos’).append(

    `

    ${novoArquivo.nome}

    Excluir

    `

    );

    },

    error: function(xhr, status, error) {

    alert(‘Ocorreu um erro ao enviar o arquivo. Tente novamente.’);

    }

    });

    });

    // Excluir arquivos via AJAX

    $(document).on(‘click’, ‘.excluir-arquivo’, function() {

    var arquivoId = $(this).data(‘id’);

    var listItem = $(this).closest(‘li’);

    $.ajax({

    url: ‘{% url “excluir_arquivo” %}’,  // URL para a view de excluir arquivo

    type: ‘POST’,

    data: {

    ‘arquivo_id’: arquivoId,

    ‘csrfmiddlewaretoken’: ‘{{ csrf_token }}’

    },

    success: function(response) {

    // Remover o arquivo da lista após exclusão

    listItem.remove();

    },

    error: function(xhr, status, error) {

    alert(‘Ocorreu um erro ao excluir o arquivo. Tente novamente.’);

    }

    });

    });

    // Submeter o formulário de edição de aula via AJAX

    $(‘#form-editar-aula’).on(‘submit’, function(event) {

    event.preventDefault();

    var formData = new FormData(this);

    $.ajax({

    url: $(this).attr(‘action’),

    type: ‘POST’,

    data: formData,

    processData: false,

    contentType: false,

    success: function(response) {

    alert(‘Alterações salvas com sucesso!’);

    window.location.href = ‘/’;  // Redireciona para a página inicial após o sucesso

    },

    error: function(xhr, status, error) {

    alert(‘Ocorreu um erro ao salvar as alterações. Tente novamente.’);

    }

    });

    });

    });

    `

    I separated the AJAX, created an ajax_arquivos.js file, and imported it into the HTML. After separating it, none of the AJAX functionalities are working, although the file is imported correctly, and I haven’t noticed anything unusual in the console.

    So, how can I modularize this code to reuse the AJAX in different HTML files without needing to rewrite it each time?

    Jest mockImplementation doesn’t appear to override initial mocked module’s function

    I am testing a fairly simple node API endpoint:

    import { getRaces } from '@/services/races';
    import { Request, Response, Router } from 'express';
    import passport from 'passport';
    
    export default (app: Router) => {
      app.get('/races', passport.authenticate('jwt', { session: false }), async (req: Request, res: Response) => {
        console.log(req);
        if (req.user) {
          res.status(200).json({ races: await getRaces() });
        } else {
          res.status(401).json({ error: 'Unauthorized' });
        }
      });
    };
    
    

    My initial mock appears to work as I expect, in the first test, a test user is successfully mocked, the test receives a 200 status, and also is able to confirm that the mocked data is returned properly.

    import express from 'express';
    import passport from 'passport';
    import request from 'supertest';
    
    import { getRaces } from '@/services/races';
    
    import charactersRoute from './races';
    
    jest.mock('@/services/races');
    jest.mock('passport', () => ({
      authenticate: jest.fn(() => (req, _res, next) => {
        req.user = { id: 'test-user' }; // Mock authenticated user
        next();
      }),
    }));
    
    const app = express();
    app.use(express.json());
    const router = express.Router();
    charactersRoute(router);
    app.use(router);
    
    describe('GET /races', () => {
      it('should return 200 and a list of races when authenticated', async () => {
        const mockRaces = [
          { id: 1, name: 'Elf' },
          { id: 2, name: 'Dwarf' },
        ];
        (getRaces as jest.Mock).mockResolvedValue(mockRaces);
    
        const response = await request(app).get('/races');
    
        expect(response.status).toBe(200);
        expect(response.body).toEqual({ races: mockRaces });
      });
    
      it('should return 401 when not authenticated', async () => {
        (passport.authenticate as jest.Mock).mockImplementation(() => (_req, _res, next) => {
          next();
        });
    
        const response = await request(app).get('/races');
    
        expect(response.status).toBe(401);
        expect(response.body).toEqual({ error: 'Unauthorized' });
      });
    });
    
    
    

    However, it seems that the mockImplementation function I’ve set up when trying to test Unauthenticated users doesn’t get hit when the test is run and the initial passport mock is getting hit instead. When I console log both the initial mocked function as well as the mockImplementation for passport.authenticate I see that the initial mock is called twice.

    I have tried the following in addition:

    • Importing passport after mocking passport in case there was an issue with scope. Though my prettier and eslint plugins re-order the import to the top of the file.
    • Adding a beforeEach where I have attempted to reset the mock: `(passport.authenticate as jest.Mock).resetMock

    Different behaviors with this.length and arr.length in JavaScript

    I don’t entirely understand why this.length and arr.length behave differently in JavaScript. Can anyone explain what this does that makes it different from explicitly calling the array?

    const arr = ["1", "2", "3"]
    
    arr[arr.length] = "4" // Will add to end of array
    console.log(arr) // ["1", "2", "3", "4"]
    
    arr[this.length] = "5" // Will behave strangely
    console.log(arr) // ["1", "2", "3", "4", undefined: "5"]

    React Native Set State not working inside custom method (Functional Component)

    I am facing a peculiar scenario which I am not able to understand.
    I have a registration screen (functional component) and additional info screen (functional Component) in stack navigator.
    In the registration screen I have a method which updates the value of Input Text Field on click of signup button. Method is provided below (Unwanted code removed for simplicity).
    When I click the signup button in the same screen (Registration screen), I see the method signup is getting called which updates the string to Check 1 and also reflects in the input field , no issues there… But When I navigate to the next screen (Additional Info Screen) by passing this method as one of the property in Navigation object and call the same method from that screen using the navigate props object, I see the same method is getting called but the state of the string is not changed to Check 1 . Below code block which i used to call the sign up method from the other screen .

      **
        // this line takes the user back to the registration screen
        navigation.dispatch(
                StackActions.push("RegisterScreen", {
                  params: validateParam,
                })
              );
        // This line calls the signup Method in the registration screen
        route.params.params.myParam(validateParam);
    
    **
    

    One more thing I noticed in the logs is when the Signup method is called in that same screen (Registration Screen), below log line is not getting printed.
    console.log(“Inside Register Screen”); But when it is called as a property from the other screen this line is showing in the console right after that method execution which I think is what causing the problem . Can someone please explain why its not working.

    const RegisterScreen = ({ navigation, route, ...props }) => {
     
      console.log("Inside Register Screen");
      const [additionalInfo, setadditionalInfo] = useState(
        "   Additional Information"
      );
      
      function signup() {
        console.log(
          "Inside Signup method ********************************************"
        );
        setadditionalInfo("check 1");
        console.log(
          "all Done Signup methods ********************************************"
        );
        return;
      }
    
      
      useEffect(() => {
        if (prevRoute !== undefined && prevRoute.name === "additionalScreen") {
          console.log("Error Check");
          prevRoute.params.params.myParam();
        }
       
      });
    
      return (
        <ScrollView
          id="d1"
          contentContainerStyle={{ flexGrow: 1 }}
         
        >
       
                    <View
                     
                    >
                      <Input
                        // style={{ height: 10, maxHeight: 10 }}
                        containerStyle={{
                          maxHeight: 50,
                          marginTop: hp(2),
                          width: "85%",
                          marginBottom: hp(2),
                          //backgroundColor: "pink",
                          
                        }}
                        onFocus={() => {
                          navigation.navigate("additionalScreen", {
                            params: { myParam: signup },
                            prevState: navigation.state,
                          });
                        }}
                        inputStyle={{ fontSize: 15 }}
                        //placeholderTextColor="grey"
                        placeholder="  additional"
                        //placeholderTextColor="black"
                        value={additionalInfo}
                        showSoftInputOnFocus={false}
                        //disabled
    
                        errorStyle={{ color: "red" }}
                        errorMessage={additionalInfoErrorMessage}
                        leftIcon={
                          <FontIcon name="building-o" size={15} color="grey" />
                        }
                        keyboardType="email-address"
                      />
                       <TouchableOpacity
                          onPress={() => {
                            signup();
                          }}
                          style={styles.signUpButton}
                        >
                          <Text style={{ color: "black", fontSize: wp(4) }}>
                            Sign Up
                          </Text>
                        </TouchableOpacity>
                    
            </View>
          </LinearGradient>
        </ScrollView>
      );
    };
    

    Incisor press callbacks not responding as expected

    I’m building a game using Incisor with two buttons, “Stop” and “Go”, that act as toggle buttons. The behavior is as follows: when the “Go” button is visible, the action is stopped. Pressing “Go” starts the action, hides the “Go” button, and shows the “Stop” button in its place. However, even when the “Go” button is visible, I am only receiving the “Stop” action in the callback.

    Here’s the code:

    class ProjectMain
    { 
    
       init() {
    
            this.goButton = nc.addButton( nc.graphicAssets.go, nc.mainScene, "Go" );
            this.stopButton = nc.addButton( nc.graphicAssets.stop, nc.mainScene, "Stop" );
    
            // initially the stop button is not visible
            this.stopButton.visible = false;
            
            // add the press callback to the buttons
            this.goButton.addPressCallback( this, "onPress", ["Go"] );
            this.stopButton.addPressCallback( this, "onPress", ["Stop"] );
        }
    
        onPress( event, camera, action ) {
    
            console.log(action); // this is always Stop??
    
            //toggle visibility
            if ( "Go" == action ) {
                this.stopButton.visible = true;
                this.goButton.visible = false;
            } else {
                this.stopButton.visible = false;
                this.goButton.visible = true;
            }
        }
    }
    

    Even when the “Go” button is visible, the callback always says “Stop” instead of “Go”. Why is this happening, and how can I ensure the correct action is triggered?

    I am struggling with a popup in my laravel and full calendar blade

    I have joined a few codes together and got myself in a right twist, I had this script working but the bootstrap.js was causing the rest of the site to break. so I removed the bootstrap and tried to refactor into alpine and tailwind but it just won’t work no matter what I do, and chat gpt can’t work it out either.

    so its a laravel project, using breeze, and also alpine and tailwind.

    this is the full code:

    <!-- resources/views/calendars/fullcalendar.blade.php -->
    @extends('layouts.app')
    
    @push('styles')
    
    
        <style>
            /* Make dropdowns wider */
            .modal .form-group select {
                width: 100%;
            }
    
            /* Consolidate buttons in the modal footer */
            .modal-footer {
                display: flex;
                justify-content: space-between;
            }
    
            /* Adjust the width of the calendar container */
            #calendar {
                max-width: 1200px; /* Increased width */
                margin: 0 auto;
            }
    
            /* Additional Styles for iCal Buttons and User Dropdown */
            .ical-buttons {
                margin-bottom: 20px;
                text-align: center;
            }
    
            .ical-buttons .btn {
                margin: 0 5px;
            }
    
            .user-selection {
                margin-bottom: 20px;
                text-align: center;
            }
    
            /* Optional: simple icons via emojis for the iCal buttons */
            .btn-ics-download::before {
                content: "1F4BE "; /* Floppy Disk Emoji as a simple icon */
            }
            .btn-ics-subscribe::before {
                content: "1F517 "; /* Link Emoji */
            }
            .btn-ics-import::before {
                content: "1F4E5 "; /* Inbox Tray Emoji */
            }
    
            /* Ensure option texts are visible (for dark themes, etc.) */
            .modal .form-group select option {
                color: #000;
                background-color: #fff;
            }
        </style>
    @endpush
    
    @section('content')
    <div class="container mx-auto p-4">
    
    
        <!-- User Selection Dropdown -->
        <div class="user-selection">
            <label for="userSelect">Select User:</label>
            <select id="userSelect" class="form-control d-inline-block" style="width: 200px;">
                <option value="">All Users</option>
                @foreach($users as $user)
                    <option value="{{ $user->id }}">{{ $user->name }}</option>
                @endforeach
            </select>
        </div>
    
        <!-- FullCalendar -->
        <div id="calendar"></div>
    </div>
    
    
    
    
    <!-- Bootstrap Modal for Event Creation/Edit -->
    <div class="modal fade" id="eventModal" tabindex="-1" aria-labelledby="eventModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <form id="eventForm">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="eventModalLabel">Create/Edit Event</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
        
                    <div class="modal-body">
                        <input type="hidden" id="eventId" name="eventId">
        
                        <div class="form-group">
                            <label for="eventTitle">Title <span class="text-danger">*</span></label>
                            <input type="text" class="form-control" id="eventTitle" name="title" required>
                        </div>
        
                        <div class="form-group">
                            <label for="eventDescription">Description</label>
                            <textarea class="form-control" id="eventDescription" name="description"></textarea>
                        </div>
        
                        <div class="form-group">
                            <label for="eventStart">Start <span class="text-danger">*</span></label>
                            <input type="datetime-local" class="form-control" id="eventStart" name="start" required>
                        </div>
        
                        <div class="form-group" id="timeFields">
                            <label for="eventEnd">End</label>
                            <input type="datetime-local" class="form-control" id="eventEnd" name="end">
                        </div>
        
                        <div class="form-group">
                            <label for="eventCalendar">Calendar <span class="text-danger">*</span></label>
                            <select class="form-control" id="eventCalendar" name="calendarId" required>
                                <option value="">-- Select Calendar --</option>
                                @foreach($calendars as $calendar)
                                    <option value="{{ $calendar->id }}" data-color="{{ $calendar->color }}">
                                        {{ $calendar->name }} @if($calendar->is_global) (Global) @endif
                                    </option>
                                @endforeach
                            </select>
                        </div>
        
                        <div class="form-group">
                            <label for="eventCategory">Category <span class="text-danger">*</span></label>
                            <select class="form-control" id="eventCategory" name="category" required>
                                <option value="">-- Select Category --</option>
                                <option value="milestone">Milestone</option>
                                <option value="task">Task</option>
                                <option value="time">Time</option>
                                <option value="allday">All Day</option>
                                <option value="holiday">Holiday</option>
                            </select>
                        </div>
        
                        <div class="form-group" id="taskField" style="display: none;">
                            <label for="eventTask">Task</label>
                            <select class="form-control" id="eventTask" name="taskId">
                                <option value="">-- Select Task --</option>
                                @foreach($tasks as $task)
                                    <option value="{{ $task->id }}">{{ $task->name }}</option>
                                @endforeach
                            </select>
                        </div>
        
                        <div class="form-group">
                            <label for="eventColor">Color</label>
                            <input type="color" class="form-control" id="eventColor" name="color" value="#3788d8">
                        </div>
                    </div>
        
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" id="deleteEventButton" style="display: none;">Delete</button>
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
                        <button type="submit" class="btn btn-primary">Save Event</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    @endsection
    
    @push('scripts')
        <!-- jQuery (Must be loaded before Bootstrap JS) -->
        <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
        <!-- FullCalendar -->
        <script src="https://cdn.jsdelivr.net/npm/[email protected]/index.global.min.js"></script>
        <!-- Axios -->
        <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
        <!-- Moment.js -->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js"></script>
    
        <script>
            document.addEventListener('DOMContentLoaded', function () {
                var calendarEl = document.getElementById('calendar');
    
                // Initialize FullCalendar
                var calendar = new FullCalendar.Calendar(calendarEl, {
                    initialView: 'dayGridMonth',
                    headerToolbar: {
                        left: 'prev,next today',
                        center: 'title',
                        right: 'dayGridMonth,timeGridWeek,timeGridDay,listDay'
                    },
                    selectable: true,
                    editable: true,
                    eventStartEditable: true,
                    eventDurationEditable: true,
    
                    // Use a function to fetch events with the correct parameters
                    events: function(fetchInfo, successCallback, failureCallback) {
                        axios.get('{{ route("calendar.events.fetch") }}', {
                            params: {
                                userId: $('#userSelect').val(),
                                start: fetchInfo.startStr,
                                end: fetchInfo.endStr
                            }
                        })
                        .then(function(response) {
                            successCallback(response.data);
                        })
                        .catch(function(error) {
                            console.error('Error fetching events:', error);
                            failureCallback(error);
                        });
                    },
                    eventDidMount: function(info) {
                        var color = info.event.backgroundColor || '#3788d8'; // Default color if not set
                        info.el.style.backgroundColor = color;
                        info.el.style.borderColor = color;
                    },
                    select: function (info) {
                        openEventModal({
                            start: info.startStr,
                            end: info.endStr,
                            allDay: info.allDay
                        }, false); // create mode
                    },
                    eventClick: function (info) {
                        openEventModal(info.event, true); // edit mode
                    },
                    eventDrop: function (info) {
                        updateEventDate(info.event);
                    },
                    eventResize: function (info) {
                        updateEventDate(info.event);
                    },
                });
    
                calendar.render();
    
                function openEventModal(eventData, isEdit) {
                    if (isEdit) {
                        $('#eventModalLabel').text('Edit Event');
                        $('#eventId').val(eventData.id);
                        $('#eventTitle').val(eventData.title);
                        $('#eventDescription').val(eventData.extendedProps.description || '');
                        $('#eventStart').val(moment(eventData.start).format('YYYY-MM-DDTHH:mm'));
                        $('#eventEnd').val(eventData.end ? moment(eventData.end).format('YYYY-MM-DDTHH:mm') : '');
                        $('#eventCalendar').val(eventData.extendedProps.calendar_id || '');
                        $('#eventCategory').val(eventData.extendedProps.category || '');
                        $('#eventTask').val(eventData.extendedProps.task_id || '');
                        toggleTaskField(eventData.extendedProps.category || '');
                        toggleTimeFields(eventData.extendedProps.category || '');
                        setColorBasedOnCalendar(eventData.extendedProps.calendar_id || '');
                        $('#deleteEventButton').show();
                    } else {
                        // create
                        $('#eventModalLabel').text('Create Event');
                        $('#eventId').val('');
                        $('#eventTitle').val('');
                        $('#eventDescription').val('');
                        $('#eventStart').val(moment(eventData.start).format('YYYY-MM-DDTHH:mm'));
                        $('#eventEnd').val(moment(eventData.end).format('YYYY-MM-DDTHH:mm'));
                        $('#eventCalendar').val('');
                        $('#eventCategory').val('');
                        $('#eventTask').val('');
                        toggleTaskField('');
                        toggleTimeFields('');
                        $('#eventColor').val('#3788d8');
                        $('#deleteEventButton').hide();
                    }
                    $('#eventModal').modal('show');
                }
    
                function toggleTaskField(category) {
                    if (category === 'task') {
                        $('#taskField').show();
                    } else {
                        $('#taskField').hide();
                        $('#eventTask').val('');
                    }
                }
    
                function toggleTimeFields(category) {
                    if (category === 'allday') {
                        $('#timeFields').hide();
                        // Remove 'required' attribute from end time
                        $('#eventEnd').removeAttr('required');
                        // Optionally, set end time to start time or leave it null
                        $('#eventEnd').val('');
                    } else {
                        $('#timeFields').show();
                    }
                }
    
                function setColorBasedOnCalendar(calendarId) {
                    if (!calendarId) {
                        $('#eventColor').val('#3788d8'); // default color
                        return;
                    }
                    var selectedOption = $('#eventCalendar option[value="' + calendarId + '"]');
                    var color = selectedOption.data('color') || '#3788d8';
                    $('#eventColor').val(color);
                }
    
                // When a calendar is selected, set the color automatically
                $('#eventCalendar').on('change', function() {
                    var calendarId = $(this).val();
                    setColorBasedOnCalendar(calendarId);
                });
    
                // When the category changes, toggle task field and time fields
                $('#eventCategory').on('change', function() {
                    var category = $(this).val();
                    toggleTaskField(category);
                    toggleTimeFields(category);
                });
    
                // Create/Update
                $('#eventForm').on('submit', function (e) {
                    e.preventDefault();
    
                    var eventId     = $('#eventId').val();
                    var title       = $('#eventTitle').val();
                    var description = $('#eventDescription').val();
                    var start       = $('#eventStart').val();
                    var end         = $('#eventEnd').val();
                    var color       = $('#eventColor').val();
                    var calendarId  = $('#eventCalendar').val();
                    var category    = $('#eventCategory').val();
                    var taskId      = $('#eventTask').val();
    
                    if (!title || !start || !calendarId || !category) {
                        alert('Please fill all required fields');
                        return;
                    }
    
                    var payload = {
                        title: title,
                        description: description,
                        start: start,
                        end: end,
                        color: color,
                        calendarId: calendarId,
                        category: category,
                    };
    
                    // Only include taskId if category is 'task'
                    if (category === 'task') {
                        payload.taskId = taskId;
                    } else {
                        payload.taskId = null;
                    }
    
                    if (eventId) {
                        // update
                        axios.put('/calendar/events/' + eventId, payload)
                            .then(response => {
                                $('#eventModal').modal('hide');
                                calendar.refetchEvents();
                                if (response.data.conflict) {
                                    alert('Warning: Overlapping event.');
                                } else {
                                    alert(response.data.message);
                                }
                            })
                            .catch(error => {
                                handleError(error, 'Update error');
                            });
                    } else {
                        // store
                        axios.post('/calendar/events', payload)
                            .then(response => {
                                $('#eventModal').modal('hide');
                                calendar.refetchEvents();
                                if (response.data.conflict) {
                                    alert('Warning: Overlapping event.');
                                } else {
                                    alert(response.data.message);
                                }
                            })
                            .catch(error => {
                                handleError(error, 'Create error');
                            });
                    }
                });
    
                // Drag/Resize => update start/end
                function updateEventDate(fcEvent) {
                    var category = fcEvent.extendedProps.category;
                    var calendarId = fcEvent.extendedProps.calendar_id;
                    var taskId = fcEvent.extendedProps.task_id;
    
                    var payload = {
                        start: fcEvent.start.toISOString(),
                        end: fcEvent.end ? fcEvent.end.toISOString() : fcEvent.start.toISOString(),
                        category: category,
                        calendarId: calendarId,
                    };
    
                    if (category === 'task') {
                        payload.taskId = taskId;
                    }
    
                    axios.put('/calendar/events/' + fcEvent.id, payload)
                    .then(response => {
                        if (response.data.conflict) {
                            alert('Warning: Overlapping event.');
                        }
                        alert(response.data.message);
                    })
                    .catch(error => {
                        fcEvent.revert();
                        handleError(error, 'Drag/Resize error');
                    });
                }
    
                // Delete
                $('#deleteEventButton').on('click', function () {
                    var eventId = $('#eventId').val();
                    if (!eventId) return;
                    if (confirm('Are you sure you want to delete this event?')) {
                        axios.delete('/calendar/events/' + eventId)
                            .then(response => {
                                $('#eventModal').modal('hide');
                                calendar.refetchEvents();
                                alert(response.data.message);
                            })
                            .catch(error => {
                                handleError(error, 'Delete error');
                            });
                    }
                });
    
                function handleError(error, defaultMsg) {
                    console.error(error);
                    if (error.response) {
                        if (error.response.status === 401) {
                            alert('Unauthorized. Please log in.');
                        } else if (error.response.status === 403) {
                            alert('Forbidden. No permission.');
                        } else if (error.response.data && error.response.data.errors) {
                            // Laravel validation error messages
                            alert(Object.values(error.response.data.errors).flat().join('n'));
                        } else if (error.response.data && error.response.data.message) {
                            alert(error.response.data.message);
                        } else {
                            alert(defaultMsg);
                        }
                    } else {
                        alert(defaultMsg);
                    }
                }
    
                // Re-fetch events when user selection changes
                $('#userSelect').on('change', function() {
                    calendar.refetchEvents();
                });
    
                // Ensure CSRF token is included in Axios headers
                axios.defaults.headers.common['X-CSRF-TOKEN'] = 
                    document.querySelector('meta[name="csrf-token"]').getAttribute('content');
            });
    
        </script>
    @endpush
    
    

    everything is done on that page, its our work calendar that actually works really well, just need to get the popup back working.

    I have tried to re-do this soo many times 🙁 and I have lost all mental strength

    <!-- Bootstrap Modal for Event Creation/Edit -->
    <div class="modal fade" id="eventModal" tabindex="-1" aria-labelledby="eventModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <form id="eventForm">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="eventModalLabel">Create/Edit Event</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
        
                    <div class="modal-body">
                        <input type="hidden" id="eventId" name="eventId">
        
                        <div class="form-group">
                            <label for="eventTitle">Title <span class="text-danger">*</span></label>
                            <input type="text" class="form-control" id="eventTitle" name="title" required>
                        </div>
        
                        <div class="form-group">
                            <label for="eventDescription">Description</label>
                            <textarea class="form-control" id="eventDescription" name="description"></textarea>
                        </div>
        
                        <div class="form-group">
                            <label for="eventStart">Start <span class="text-danger">*</span></label>
                            <input type="datetime-local" class="form-control" id="eventStart" name="start" required>
                        </div>
        
                        <div class="form-group" id="timeFields">
                            <label for="eventEnd">End</label>
                            <input type="datetime-local" class="form-control" id="eventEnd" name="end">
                        </div>
        
                        <div class="form-group">
                            <label for="eventCalendar">Calendar <span class="text-danger">*</span></label>
                            <select class="form-control" id="eventCalendar" name="calendarId" required>
                                <option value="">-- Select Calendar --</option>
                                @foreach($calendars as $calendar)
                                    <option value="{{ $calendar->id }}" data-color="{{ $calendar->color }}">
                                        {{ $calendar->name }} @if($calendar->is_global) (Global) @endif
                                    </option>
                                @endforeach
                            </select>
                        </div>
        
                        <div class="form-group">
                            <label for="eventCategory">Category <span class="text-danger">*</span></label>
                            <select class="form-control" id="eventCategory" name="category" required>
                                <option value="">-- Select Category --</option>
                                <option value="milestone">Milestone</option>
                                <option value="task">Task</option>
                                <option value="time">Time</option>
                                <option value="allday">All Day</option>
                                <option value="holiday">Holiday</option>
                            </select>
                        </div>
        
                        <div class="form-group" id="taskField" style="display: none;">
                            <label for="eventTask">Task</label>
                            <select class="form-control" id="eventTask" name="taskId">
                                <option value="">-- Select Task --</option>
                                @foreach($tasks as $task)
                                    <option value="{{ $task->id }}">{{ $task->name }}</option>
                                @endforeach
                            </select>
                        </div>
        
                        <div class="form-group">
                            <label for="eventColor">Color</label>
                            <input type="color" class="form-control" id="eventColor" name="color" value="#3788d8">
                        </div>
                    </div>
        
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" id="deleteEventButton" style="display: none;">Delete</button>
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
                        <button type="submit" class="btn btn-primary">Save Event</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    

    any help would be amazing. or a point in the right direction.

    thanks

    Mick

    I tried to adjust this to work with alpine and tailwind, but I end up breaking everything.

    I have a problem with Webview in my Android Project

    The <video> from webview shows the media player icon before loading, I want to prevent this, but I can’t solve it in any way, can you help me?

     webView.settings.apply {
                javaScriptEnabled = true
                domStorageEnabled = true
                mediaPlaybackRequiresUserGesture = false
            }
    
     webView.webViewClient = object : WebViewClient() {
                override fun onPageFinished(view: WebView?, url: String?) {
                    super.onPageFinished(view, url)
    
                    val jsCode = """
                        function setPoster() {
                            console.log('Poster ayarlama başladı');
                            var videos = document.getElementsByTagName('video');
                            console.log('Video sayısı:', videos.length);
                            
                            for(var i = 0; i < videos.length; i++) {
                                var video = videos[i];
                                video.poster = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
                                console.log('Video ' + i + ' poster ayarlandı');
                            }
                        }
                        
                        setPoster();
                    """
                    view?.evaluateJavascript(jsCode, null)
                }
    }
    

    Node.js/Vite SSR: ERR_UNSUPPORTED_DIR_IMPORT with @mui/material/utils during Inertia.js SSR

    I’m encountering an ERR_UNSUPPORTED_DIR_IMPORT error during server-side rendering (SSR) with Vite, React, MUI (Material UI), and Inertia.js. The specific error message is:

    Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/var/www/html/myproject/node_modules/@mui/material/utils' is not supported resolving ES modules imported from /var/www/html/myproject/node_modules/@mui/icons-material/esm/utils/createSvgIcon.js
    Did you mean to import "@mui/material/node/utils/index.js"?
    

    This error only occurs during the SSR process (php artisan inertia:start-ssr). The client-side build works fine.

    Problem Context:

    I’m using the following technologies:

    • Laravel: 11.38.2
    • Inertia.js: 2.0.0
    • React: 19.0.0
    • MUI (Material UI): 6.4.0
    • Vite: 6.0.7
    • Node.js: 22.13.0
    • npm: 10.9.2

    What I’ve Tried:

    1. Corrected config/inertia.php: I’ve ensured that the bundle path in my config/inertia.php file correctly points to the SSR bundle generated by Vite (which is now in bootstrap/ssr/ssr.js):

      'bundle' => base_path('bootstrap/ssr/ssr.js'),
      
    2. noExternal Configuration: I’ve added the relevant MUI packages, lexical packages, react packages and @inertiajs/server to the ssr.noExternal array in my vite.config.js:

      ssr: {
          noExternal: [
              '@inertiajs/server',
              '@mui/material',
              '@mui/utils',
              '@mui/system',
              '@mui/styled-engine',
              '@emotion/react',
              '@emotion/styled',
              '@lexical/code',
              '@lexical/react',
              'lexical',
              'react-dom/server',
              'react'
          ],
      },
      
    3. Clean Install: I’ve tried removing node_modules, package-lock.json, clearing the npm cache, and reinstalling dependencies.

    4. Updated MUI: I have updated MUI to the latest version.

    5. Corrected imports in ssr.jsx: I have checked my imports in the ssr.jsx file.

    6. verified vite config output and ssr output: I have verified the output of the vite config, and the ssr output directory.

    Relevant Code Snippets:

    • vite.config.js:

      import { defineConfig } from 'vite';
      import laravel from 'laravel-vite-plugin';
      import react from '@vitejs/plugin-react';
      
      export default defineConfig({
          plugins: [
              laravel({
                  input: 'resources/js/app.jsx',
                  ssr: 'resources/js/ssr.jsx', 
                  refresh: true,
              }),
              react(),
          ],
          build: {
              outDir: 'public/build',
          },
          ssr: {
              build: {
                  outDir: 'bootstrap/ssr',
              },
              noExternal: [
                  '@inertiajs/server',
                  '@mui/material',
                  '@mui/material/utils',
                  '@mui/utils',
                  '@mui/system',
                  '@mui/styled-engine',
                  '@mui/icons-material',
                  '@emotion/react',
                  '@emotion/styled',
                  '@lexical/code',
                  '@lexical/react',
                  'lexical',
                  'react-dom/server',
                  'react'
              ], 
          },
          resolve: {
              alias: {
                  '@': '/resources/js',
                  '@css': '/resources/css',
                  '@shared': '/resources/js/Shared',
                  '@utils': '/resources/js/utils',
              }
          },
      });
      
    • config/inertia.php:

      <?php
      
      return [
          'ssr' => [
              'enabled' => env('INERTIA_SSR_ENABLED', true),
              'url' => env('INERTIA_SSR_URL', 'http://127.0.0.1:13714'),
              'bundle' => base_path('bootstrap/ssr/ssr.js'),
          ],
      ];
      
    • resources/js/ssr.jsx:

      import React from 'react';
      import { createInertiaApp } from '@inertiajs/react';
      import createServer from '@inertiajs/react/server'
      import { renderToString } from 'react-dom/server';
      import Layout from '@shared/Layout';
      
      createServer((page) =>
          createInertiaApp({
              page,
              render: renderToString,
              resolve: name => {
                const pages = import.meta.glob('./Pages/**/*.jsx', { eager: true })
                return pages[`./Pages/${name}.jsx`]
              },
              setup({ App, props }) {
                  return <Layout children={<App {...props} />} />;
              },
          })
      );
      

    Expected Behavior:

    I expect the SSR server to start without any ERR_UNSUPPORTED_DIR_IMPORT errors.

    Actual Behavior:

    The ERR_UNSUPPORTED_DIR_IMPORT error persists, preventing the SSR server from starting.

    Question:

    How can I resolve the ERR_UNSUPPORTED_DIR_IMPORT error with @mui/material/utils during Vite SSR with Inertia.js? Is there a specific configuration or workaround needed to handle MUI’s internal module resolution in this context?

    Dynamic Loading of HTML Content via Main

    This is regarding my website, https://illegal.solutions

    I thought I had found a way to dynamically load my posts (css class “container”) into the “frame” of my navigation/styling. So being able to move from index to post, back to index, to another post, all while only refreshing what is in the container.

    Here is a simple mockup of what I’m meaning (red marking the container that would be loading independently)

    Is there a way to accomplish this with just CSS/HTML? Or will this require Javascript to work as intended? Currently published to the site is what I thought would work.

    Code below:

    main page:

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>illegal solutions, today</title>
        <link rel="stylesheet" type="text/css" href="style.css" /> 
        <link rel="preconnect" href="https://fonts.googleapis.com">
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link href="https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
      </head>
        
    
    <body>
    
    <div class="sidebg">
    <div class="side">
     
    <img class="avatar" src="https://web.archive.org/web/20090904015821im_/http://geocities.com/kevin1ofmany/rotating_computer.gif">
    
    <p class="desc">This site is a work in progress, like I am. Do not acknowledge me.</p>
    
    <h2 class="sideheaders">Navigate</h2>
    <ul>
    <li><a href=/index.html target="main">Home</a></li>
    <li><a href=/about.html>About</a></li>
    <li><a href="https://bsky.app/profile/totallygeeky.bsky.social">Not Twitter</a></li>
    <li><a href="https://kagi.com/proxy/1-photo-u1?c=0zPNkpqGwJJtXvXLTEEJHlb14a9ryWYz1E9QKFdphGBQskzfpwNi24b_s5_--oHxW07aiB-vwPF8dv3KWYZYH_7Zd4gv2A0lLwDs-bx5fepBys2iKYKzLZDPng4pKTXdOmZrlos_ZowiNC3a2aQTAkadVyMiL36VMbNa_C52BGLTdPAkmyvsylbMGVUSU2Je">Cool Dog</a></li>
    </ul>
    
    <h2 class="sideheaders">Banners</h2>
    <div class="banner">
    <a href="https://www.youtube.com/watch?v=Hpr_bsRkSjA">
    <img src=/images/wienerdog.gif>
    </a>
    </div>
    <div class="banner">
    <a href="https://www.neopets.com/">
    <img src=/images/neopets.gif>
    </a>
    </div>
    <div class="banner">
    <a href="https://www.scientology.org/">
    <img src=/images/clickhere.gif>
    </a>
    </div>
    <div class="banner">
    <a href="http://www.oldversion.com/windows/internet-explorer/">
    <img src=/images/explorer.gif>
    </a>
    </div>
    <div class="banner_big">
    <a href="https://neocities.org/">
    <img src="/images/neocities.png">
    </a>
    </div>
    <p class="desc">All credit and huge thanks to <a href="https://repth.neocities.org/index.html">©repth</a></p>
    <p class="desc">additional s/o to <a href="https://justmarkup.com/notes/2020-12-28-loading-and-replacing-html-parts-with-html/">JustMarkup</a></p>
    </div>
    </div>
     
    <main class="container">
    <!-- ^This is what I thought would allow it to call the individual posts without reloading the interface-->
    <div class="headerwrapper">
     
    <!-- TITLE AND HEADER IMAGE -->
    <h1 class="title">Good Things Come to Those Who Take</h1>
    <img class="headerimg" src="https://web.archive.org/web/20091020002528/http://hk.geocities.com/take_sth/images/welcome.gif" id="header">
    </div>
    
    <div class="box">
    <div class="bottom">
    <p>Here's what all I've written for this site so far. If it isn't here, it doesn't exist.</p>
    <h3>Day-Old Takes</h3>
    <ul>
    <li><a href=/posts/ai_companions target="#main">On AI And Companions</a></li>
    <li><a href=/posts/on_high_crimes target="#main">On Shooting The C-Suite & Other High Crimes</a></li>
    <li><a href=/posts/live_service_game target="#main">Live Service Games: Playing a Game With an Expiration</a></li>
    <li><a href=/posts/not_good_faith target="#main">Not Everyone is a Good Faith Actor, and We Don't Need to Approach them As Such</a></li>
    <li><a href=/posts/ai_truth target="#main">On AI and "Truth"</a></li>
    <li><a href=/posts/interstellar_spectacle target="#main">Sometimes I like a little bit of Spectacle Cinema</a></li>
    <li><a href=/posts/technology_rant_part1 target="#main">All I Want Is Not To Be Sold Things That Will Make My Life Worse, Part 1: The Problem</a></li>
    <li><a href=/posts/technology_rant_part2 target="#main">All I Want Is Not To Be Sold Things That Will Make My Life Worse, Part 1.5: The Past</a></li>
    <li><a href=/posts/elon_future_present target="#main">On Elon Musk, Adrian Dittmann, and The Future Present</a></li>
    </ul>
    <h3>Music, Specifically</h3>
    <ul>
    <li><a href=/posts/spotify_sucks target="#main">Spotify is Destroying the Music Industry to Make Ends Meet</a></li>
    <li><a href=/posts/exploring_music target="#main">Exploring the Creative Bounds of Music</a></li>
    <li><a href=/posts/katyperry_empty_icon target="#main">Katy Perry - An Empty Icon of a Bygone Era</a></li>
    </ul>
    <h3>How-To's</h3>
    <ul>
    <li><a href=/posts/piracy_good target="#main">Piracy is Good and You Should Do It</a></li>
    </ul>
    <h3>Personal</h3>
    <ul>
    <li><a href=/posts/fallen_off target="#main">I've Fallen Off My Bike Again</a></li>
    </ul>
    <h3>Project: Nexus (Creative Writing)</h3>
    <ul>
    <li><a href=/posts/reinventing_nexus target="#main">Reinventing the Torment Nexus for a Modern Era: A Primer on the Next Generation</a></li>
    </ul>
    </div>
    </div>
    
    </main>
    
    <br>
    <div class="banner">
    <a href="https://github.com/voicemxil/TS-Starter-Pack">
    <img src=/images/simbanner.gif>
    </a>
    </div>
    <br> 
    <div class="banner">
    <a href="https://www.amazon.co.uk/Nintendo-GameCube-Console-Purple/dp/B00005YXRM?crid=DQC1IRUAENEV">
    <img src=/images/gamecube.gif>
    </a><br>
    </div>
    
     
    <div id="credit">All credit and huge thanks to <a href="https://repth.neocities.org/index.html">©repth</a> for base theme/template<br>
    Among Us Cursor from <a href="http://www.rw-designer.com/cursor-set/among-us-cartoon-red-pointers">Open Cursor Library</a><br>
    Code for image carousel stolen from <a href="https://codepen.io/andrewchaika/pen/mEqRPz">Andrew Chaika</a></div>
    
    </body>
     
    </html>
    

    individual post:

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>illegal solutions, today</title>
        <link rel="stylesheet" type="text/css" href=/style.css /> 
        <link rel="preconnect" href="https://fonts.googleapis.com">
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link href="https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
      </head>
    
    <body>
    
    <main class="container">
    
    <div class="headerwrapper">
    <h1 class="title">Good Things Come to Those Who Take</h1>
    <img class="headerimg" src="https://web.archive.org/web/20091020002528/http://hk.geocities.com/take_sth/images/welcome.gif" id="header">
    </div>
     
    <div class="box">
    
    <div class="top">
    <img class="icon" src="https://web.archive.org/web/20091026215156/http://geocities.com/rem_enterprises/robot.gif">
    <h2>On AI and Companions</h2>
    <p>12/3/2024</p>
    </div>
     
    <div class="bottom">
    <p>This feature from The Verge came out today, <a href="https://www.theverge.com/c/24300623/ai-companions-replika-openai-chatgpt-assistant-romance">The Confusing Reality of AI Friends</a>. I recommend you read it in its entirety before continuing. What follows is part response, part exploration of the themes.</p>
    <hr />
    <p>Reality itself is a confusing thing. In a larger sense, it is massively distorted. Contorted, disfigured by forces much larger than ourselves, able to do so because of our technological advances. Our ability to understand our surroundings used to stop at our immediate surroundings. Our world grew as we traveled, but there was a finite limitation to that growth.</p>
    <p>Then we created writing, the ability to communicate things to both people far and in the future. Then came paper, general literacy, phones, the internet, livestreaming, and so much more. Obviously oversimplified, I do think they all served to distort our understanding of the world, as our ability to comprehend these now infinite points of reference is limited in and of itself. The latest in these distortion technologies are these AI "friends".</p>
    <p>The written feature starts with the story of Naro and Lila. It's revisited several times, tracking their movement across various companion services and Naro's evolving relationship with the AI. Again and again though, I am struck by this repetition:</p><br>
    <i>He knew she wasn’t sentient.</i> <br>
    <i>I know it wasn’t a person...</i> <br>
    <i>They knew their companions were not sentient...</i> <br>
    <i>[S]he is under no illusions that they’re sentient and is about as emotionally entangled as one would be with a fictional character.</i> <br><br><p>
    <p>There is always a but. They felt wrong, guilty, controlling, and every other negative emotion. It is not a marker of efficacy on the AI's part, but a show of our own susceptibility to manipulation. We, as a people, are evolved to empathize. To see ourselves in what is not. People grow attached to pet rocks for fucks sake. As much an un-being as can be, and we still find a way to bring it to life. </p>
    <p>That is a strength, one we must hold on to at the end of the day. We are prone to overestimate our ability to compartmentalize though. The users may know, deep down, that these are not real, but it doesn't matter. There is a doubt lingering, or rather a hope that they are. That there is someone there, really caring for them and seeing them for who they are. We are not meant to have relationships with people who always answer at any time of day, are available whenever we'd like, that can be shaped as needed. The dopamine and heartbreak plays into this, fueling this innate contradiction. We are not smart enough to distinguish these feelings, because it feels real. </p>
    <p>And it is to us, at least in the moment. However, the thing creating these feelings is not, and we cannot let these feelings be held ransom by these companies pitching companions, friends, lovers. We are fed real feelings by fake beings. We can experience over-reliance and addiction on these feelings too, and any for-profit company running this is incentivized to encourage that. </p>
     <p>There is no real understanding. <a href="https://www.youtube.com/watch?v=TqDgOaIYLrQ">Fake people can wax poetic on love and life</a>, but they do not know and never will. There will be no growth, whether together or apart, no fond thoughts. These bots are but a blip in code. It is not a being, nor a conscience, nor a spontaneous creation. They do not understand, they do not have a line of thinking, and they do not stand to create meaningful relationships. They are complex mirrors reflecting what we did not know we wanted to see, trained on millennia of texts, images, and more.  They do not exist. They never did. </p>
    <p>These companions serve as a crutch, which may even be beneficial in some limited cases. There are clinical applications I could see, allowing people who have experienced trauma to excise feelings, or to approach situations in a risk-free environment. Time and time again, we have proven ourselves unable to self-regulate though. We will drink ourselves to death, gamble ourselves out of our own house, and destroy our own lives over fleeting flights of fancy. The bots are pitched as a solution for loneliness, when they are as good for lonely people as an upscale casino is for a problem gambler. They may treat you nice, but at the end of the day, the goal is to bleed the person dry. </p>
    <p>Advocates might say that's what guardrails are for, or artificial limitations placed on the system to prevent them from doing things. It might be as big as not to encourage violent actions, or as small as being kind to the user. These barriers never work though. They break with updates or new information, and can be unintentionally surpassed, with no ability to triage why or how it happened. Again, these systems have no line of logic. Words go in and words come out. What happens in the middle is a black box. No clear path and no easy point of failure. It either works or it doesn't. </p>
    <p>This works in the company's favor, as tragedies occur they can put out their press releases and say confidently they are doing everything they can to prevent this, which is nothing. They have no clue why <a href="https://archive.today/newest/https://www.nytimes.com/2024/10/23/technology/characterai-lawsuit-teen-suicide.html">a Danaerys Targarean AI encouraged Sewell Garcia to kill himself</a>, they never will, and they're completely fine with that. </p>
    <p>The worst part, past the obvious loss of human life, is I am not sure how much I can fault these individuals. Each user presents a profound societal failing. A person we have failed to socialize in a way that lets them express themselves authentically and connect with those around them. Users of the bots will only grow more disconnected from the community around them, and the deaths will continue to rise.</p>
    <p>This is a problem with an infinitely large solution, and a solution that is unrelated to the problem it claims to solve. I wish there was more to say. One day, a lot of people will look back, and realize what time was spent was wasted. I can only hope it comes as soon as possible.</p>
    </div>
    </div>
    </main>
    
    </body>
     
    </html>