Symfony twig component

I use symfony multi app directory structure by this manual – https://symfony.com/doc/current/configuration/multiple_kernels.html
I want to use Twig component for each app, but i can’t rewrite component path to component template directory (anonymous_template_directory).
Whatever I do, my new path just added to base path.

base path (in twig_component.yaml) – anonymous_template_directory: ‘components/’
i try to set anonymous_template_directory:’kernel.project_dir%/website/templates/components/’

result: The “/var/www/html/templates//var/www/html/website/templates/components/” directory does not exist.

I would be grateful for help

Debugging ‘Max File Size Limit’ in Dockerized Dolibarr [closed]

I have a Dolibarr instance running inside Docker, with Nginx as a reverse proxy on the host. Here’s my setup:

docker-compose.yml

services:
    mariadb:
        image: mariadb:latest
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
            MYSQL_DATABASE: ${MYSQL_DATABASE:-dolidb}
            MYSQL_USER: ${MYSQL_USER:-dolidbuser}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD:-dolidbpass}

        restart: always
        volumes:
            - ./dolibarr_mariadb:/var/lib/mysql

    web:
        # Choose the version of image to install
        # dolibarr/dolibarr:latest (the latest stable version)
        # dolibarr/dolibarr:develop
        # dolibarr/dolibarr:x.y.z
        image: dolibarr/dolibarr:latest
        environment:
            DOLI_INIT_DEMO: ${DOLI_INIT_DEMO:-0}
            DOLI_DB_HOST: ${DOLI_DB_HOST:-mariadb}
            DOLI_DB_NAME: ${DOLI_DB_NAME:-dolidb}
            DOLI_DB_USER: ${DOLI_DB_USER:-dolidbuser}
            DOLI_DB_PASSWORD: ${DOLI_DB_PASSWORD:-dolidbpass}
            DOLI_URL_ROOT: "${DOLI_URL_ROOT:-http://0.0.0.0}"
            DOLI_ADMIN_LOGIN: "${DOLI_ADMIN_LOGIN:-admin}"
            DOLI_ADMIN_PASSWORD: "${DOLI_ADMIN_PASSWORD:-admin}"
            DOLI_CRON: ${DOLI_CRON:-0}
            DOLI_CRON_KEY: ${DOLI_CRON_KEY:-mycronsecurekey}
            DOLI_COMPANY_NAME: ${DOLI_COMPANY_NAME:-MyBigCompany}
            WWW_USER_ID: ${WWW_USER_ID:-1000}
            WWW_GROUP_ID: ${WWW_GROUP_ID:-1000}

        ports:
          - "127.0.0.1:8000:80"
        links:
            - mariadb
        volumes:
            - ./dolibarr_documents:/var/www/documents
            - ./dolibarr_custom:/var/www/html/custom
            - ./dolibarr_php:/usr/local/etc/php

        restart: always

php.ini inside Dolibarr container:

; https://php.net/upload-max-filesize
upload_max_filesize = 20M
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20

Nginx config on the host:

server {
    listen 80;
    server_name dolibarr.local;

    location / {
            return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    server_name dolibarr.local;

    ssl_certificate /etc/nginx/certs/dolibarr.local.crt;
    ssl_certificate_key /etc/nginx/certs/dolibarr.local.key;

    client_max_body_size 20M;

    location / {
        proxy_pass http://127.0.0.1:8000;  
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

I am trying to upload files larger than the default limit, but it doesn’t work. I checked Nginx logs and the Dolibarr Docker logs, but nothing appears related to the issue.

how to create simple login system (admin & user) in Laravel 12 livewire starter kit? [closed]

i am learning laravel. as a beginner i am trying to create a simple login system in laravel 12 with livewire. system should redirect to the admin dashboard and user dashboard base on role. i have created AdminMiddleware and UserMiddleware.

AdminMiddleware

<?php

namespace AppHttpMiddleware;

use Closure; use IlluminateHttpRequest; use IlluminateSupportFacadesAuth; use SymfonyComponentHttpFoundationResponse;

class AdminMiddleware {
    /**
     * Handle an incoming request.
     *
     * @param  Closure(IlluminateHttpRequest):   (SymfonyComponentHttpFoundationResponse)  $next
     */
    public function handle(Request $request, Closure $next): Response
    {
        if (Auth::user() && Auth::user()->role != 'admin') {
            return redirect()->route('user.dashboard);
        }
        return $next($request);
    } }

UserMiddleware

<?php
    
    namespace AppHttpMiddleware;
    
    use Closure;
    use IlluminateHttpRequest;
    use IlluminateSupportFacadesAuth;
    use SymfonyComponentHttpFoundationResponse;
    
    class UserMiddleware
    {
        /**
         * Handle an incoming request.
         *
         * @param  Closure(IlluminateHttpRequest): (SymfonyComponentHttpFoundationResponse)  $next
         */
        public function handle(Request $request, Closure $next): Response
        {
            if (Auth::user() && Auth::user()->role != 'user') {
                return redirect()->route('admin.dashboard);
            }
            return $next($request);
        }
    }

web.php

<?php

use AppLivewireAdminAdminDashboard;
use AppLivewireEmployeeUserDashboard;
use AppLivewireSettingsAppearance;
use AppLivewireSettingsPassword;
use AppLivewireSettingsProfile;
use IlluminateSupportFacadesRoute;

Route::get('/', function () {
    return view('welcome');
})->name('home');

Route::view('dashboard', Dashboard::class)
    ->middleware(['auth', 'employee'])
    ->name('user.dashboard');

Route::middleware(['auth'])->group(function () {
    Route::redirect('settings', 'settings/profile');

    Route::get('settings/profile', Profile::class)->name('settings.profile');
    Route::get('settings/password', Password::class)->name('settings.password');
    Route::get('settings/appearance', Appearance::class)->name('settings.appearance');
});

Route::middleware(['auth', 'admin'])->group(function () {
    Route::view('admin/dashboard', AdminDashboard::class)->name('admin.dashboard');
    // Additional admin routes can be added here
});

require __DIR__ . '/auth.php';

i am getting error Route [dashboard] not defined.
because i have created AdminMiddleware and UserMiddleware to redirect the admin.dashboard and user.dashboard while default dashboard is there.

my question is

Should we create two separate middleware for admin and user, or is it
enough to have only one middleware for admin that redirects to
admin.dashboard, while regular users don’t need their own middleware
and instead use the default dashboard without requiring a separate
user middleware to redirect the route to user.dashboard?

PM2 error – App [index:0] exited with code [1] via signal [SIGINT]

So the error started happening after i added:

app.get('/socials', (req, res) => {
    res.sendFile(`${__dirname}/socials.html`)

into my index.js file. I added them to connect up to my other html files for a clickable navbar, so when you click “socials” it would open the socials.html file and redirect me to that page.

I had these two already:

app.get('/', (req, res) => {
    res.sendFile(`${__dirname}/index.html`)
app.get('/donate', (req, res) => {
    res.sendFile(`${__dirname}/donate.html`)

in my index.js file but as soon as i added the socials one so there was 3 it started returning that error?

It was working fine with the index and donate but now i’ve added a 3rd one (socials) my website isnt working.

index.js:

'use strict'

// Modules
const express = require('express')
const app = express()
const server = require('http').Server(app)
const io = require('socket.io')(server)
const passport = require('passport')
const session = require('express-session')
const sharedsession = require('express-socket.io-session')
const SteamStrategy = require('passport-steam').Strategy

// Site stuff
const TradeBot = require('./lib/index')
const Trade = new TradeBot({ io })
const config = require('./config')

// Web server
server.listen(config.websitePort)
console.log('[!] Website server is online.')
console.log('[!] Socket server is online.')

// Passport
passport.serializeUser((user, done) => {
    done(null, user)
})
passport.deserializeUser((obj, done) => {
    done(null, obj)
})
passport.use(new SteamStrategy({
    returnURL: `${config.website}/auth/steam/return`,
    realm: `${config.website}/`,
    apiKey: config.steamApiKey,
},
(identifier, profile, done) => {
    process.nextTick(() => {
        const user = profile
        user.identifier = identifier
        return done(null, user)
    })
}))
const sessionMiddleware = session({
    secret: 'csg0tradebot',
    name: 'csg0trade',
    resave: true,
    saveUninitialized: true,
})
app.use(sessionMiddleware)
app.use(passport.initialize())
app.use(passport.session())
app.use('/static', express.static('./static'))

// Routes
app.get('/', (req, res) => {
    res.sendFile(`${__dirname}/index.html`)
app.get('/donate', (req, res) => {
    res.sendFile(`${__dirname}/donate.html`)
app.get('/socials', (req, res) => {
    res.sendFile(`${__dirname}/socials.html`)
});
})
// Auth Routes
app.get('/auth/steam', passport.authenticate('steam'))
app.get('/auth/steam/return', passport.authenticate('steam', { failureRedirect: '/auth/steam' }), (req, res) => {
    // Successful authentication, redirect home.
    res.redirect('/')
})
app.get('/logout', (req, res) => {
    req.logout()
    res.redirect('/')
})

// Sockets
io.use(sharedsession(sessionMiddleware))
io.on('connection', (socket) => {
    let userObject = false
    if (
        typeof socket.handshake.session.passport !== 'undefined' &&
        typeof socket.handshake.session.passport.user !== 'undefined' &&
        typeof socket.handshake.session.passport.user.id !== 'undefined'
    ) {
        userObject = socket.handshake.session.passport.user
    }

    socket.emit('site', config.site)
    socket.emit('user', userObject)
    socket.on('get user inv', (steamID64) => {
        Trade.getInventory(steamID64, config.appID, config.contextID, (err, data) => {
            socket.emit('user inv', { error: err, items: data })
        })
    })
    socket.on('get bot inv', (id) => {
        Trade.getInventory(config.bots[id].steamID64, config.appID, config.contextID, (err, data) => {
            socket.emit('bot inv', { error: err, items: data })
        })
    })
    socket.on('get bots inv', () => {
        const params = []
        Object.keys(config.bots).forEach((index) => {
            const bot = config.bots[index]
            params.push({
                id: index,
                steamID64: bot.steamID64,
                appID: config.appID,
                contextID: config.contextID,
            })
        })
        Trade.getInventories(params, (data) => {
            socket.emit('bots inv', data)
            socket.emit('bots floats', Trade.getFloatValues())
        })
    })
    socket.on('get pricelist', () => {
        socket.emit('pricelist', Trade.getPriceList())
    })
    socket.on('get rates', () => {
        socket.emit('rates', {
            ignore: Trade.getIgnorePrice(),
            trash: Trade.getTrashPrice(),
            user: Trade.getUserRates(),
            bot: Trade.getBotRates(),
        })
    })
    socket.on('get offer', (data) => {
        socket.emit('offer status', {
            error: null,
            status: 4,
        })
        const link = data.tradelink
        const offerData = data
        if (
            link.indexOf('steamcommunity.com/tradeoffer/new/') === -1 ||
            link.indexOf('?partner=') === -1 ||
            link.indexOf('&token=') === -1
        ) {
            socket.emit('offer status', {
                error: 'Invalid trade link!',
                status: false,
            })
        } else {
            Trade.validateOffer(offerData, (err, success) => {
                socket.emit('offer status', {
                    error: err,
                    status: (success) ? 1 : false,
                })
                if (!err && success) {
                    if (typeof config.bots[offerData.bot_id] === 'undefined') {
                        offerData.bot_id = Object.keys(config.bots)[0]
                    }
                    const Bot = Trade.getBot(offerData.bot_id)
                    const offer = Bot.manager.createOffer(offerData.tradelink)
                    offer.addTheirItems(offerData.user.map(assetid => ({
                        assetid,
                        appid: config.appID,
                        contextid: config.contextID,
                        amount: 1,
                    })))
                    if (offerData.bot.length) {
                        offer.addMyItems(offerData.bot.map(assetid => ({
                            assetid,
                            appid: config.appID,
                            contextid: config.contextID,
                            amount: 1,
                        })))
                    }
                    offer.setMessage(config.tradeMessage)
                    offer.getUserDetails((detailsError, me, them) => {
                        if (detailsError) {
                            socket.emit('offer status', {
                                error: detailsError,
                                status: false,
                            })
                        } else if (me.escrowDays + them.escrowDays > 0) {
                            socket.emit('offer status', {
                                error: 'You must have 2FA enabled, we do not accept trades that go into Escrow.',
                                status: false,
                            })
                        } else {
                            offer.send((errSend, status) => {
                                if (errSend) {
                                    socket.emit('offer status', {
                                        error: errSend,
                                        status: false,
                                    })
                                } else {
                                    console.log('[!!!!!] Sent a trade: ', data)
                                    if (status === 'pending') {
                                        socket.emit('offer status', {
                                            error: null,
                                            status: 2,
                                        })
                                        Trade.botConfirmation(data.bot_id, offer.id, (errConfirm) => {
                                            if (!errConfirm) {
                                                socket.emit('offer status', {
                                                    error: null,
                                                    status: 3,
                                                    offer: offer.id,
                                                })
                                            } else {
                                                socket.emit('offer status', {
                                                    error: errConfirm,
                                                    status: false,
                                                })
                                            }
                                        })
                                    } else {
                                        socket.emit('offer status', {
                                            error: null,
                                            status: 3,
                                            offer: offer.id,
                                        })
                                    }
                                }
                            })
                        }
                    })
                }
            })
        }
    })
})

dont understand why after added the 3rd route its started showing this error.
Ubuntu 25.04 x64 | project running on pm2

error logs:
PM2 ERROR LOGS

Does everything need to be included in standard form?

When using standard form is it possible for some of the question or sentence be excluded?

When i was doing the homework for the week i felt that not everything from the sentence needed to be included. I also remember in the video with the example the professor changed the premise. Can we do that or does that change standard from?

Why import requests from a worker have empty headers?

Lets say im executing the following line in the Chrome’s console:

new Worker('data:text/javascript;charset=utf-8,'+encodeURIComponent("import('https://localhost/qwe.js')"))

The problem is that my import which is inside the worker forming a weird request where almost all headers are lost (and most painfully the “origin” one). In the inspector it looks like this:

empty request headers

And this weird request then result in an obvious CORS error: Access to script at 'https://localhost/qwe.js' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Just for comparison, a “healthy” import request executed from my main thread cause no problems and its headers for example looks like this:

healthy request headers

How can i fix this problem?

Href in my html file returning “Cannot Get” (PM2)

I have this coding in my index.html:

    <!-- Href Hyperlinks -->
    <a href="index.html">Trade Bot</a>
    <a href="raffles.html">Monthly Raffles</a>
    <a href="socials.html">Socials</a>
    <a href="donate.html">Donate</a>
    <a href="faq.html">FAQ</a>

I have made separate html files (raffles.html, socials.html,donate.html,faq.html) which are all located in the same directory. Im not too sure if my app.js or index.js is correct but when i click the hyperlinks it redirects me to http://gorillaskins.com/donate.html and displays:

Cannot GET /donate.html

app.js:

$(function() {
    var app = new Vue({
        el: '#app',
        data: {
            priceList: {},
            rates: {
                user: {},
                bot: {}
            },
            disableReload: true,
            disableTrade: true,
            // bot
            floats: {},
            selectedBot: 'All bots',
            botInventories: {},
            botInventory: [],
            botInventorySelected: [],
            botInventorySelectedValue: 0,
            // user
            userInventory: [],
            userInventorySelected: [],
            userInventorySelectedValue: 0,
            // auth
            user: false,
            // site
            site: {
                header: '',
                steamGroup: '#',
                copyrights: ''
            },
            // trade
            offerStatus: {},
            invalidTradelink: false
        },
        methods: {
            setInventorySort: function(who, value) {
                if(who == 'bot') {
                    this.botInventory = this.sortInventory(this.botInventory, value);
                } else {
                    this.userInventory = this.sortInventory(this.userInventory, value);
                }
            },
            sortInventory: function(inventory, desc) {
                return inventory.sort(function(a, b) {
                    if(desc) {
                        return b.price - a.price;
                    } else {
                        return a.price - b.price;
                    }
                });
            },
            addItem: function(who, id, assetid, price) {
                if(typeof price === 'undefined') {
                    price = assetid;
                    assetid = id;
                }
                if(who == 'bot') {
                    if(this.selectedBot !== id) {
                        this.activeBot(id);
                    }
                    var botInventorySelected = this.botInventorySelected;
                    botInventorySelected.push(assetid);
                    this.botInventorySelected = botInventorySelected;
                    this.botInventorySelectedValue += parseFloat(price);
                } else {
                    var userInventorySelected = this.userInventorySelected;
                    userInventorySelected.push(assetid);
                    this.userInventorySelected = userInventorySelected;
                    this.userInventorySelectedValue += parseFloat(price);
                }
                this.checkTradeable();
            },
            removeItem: function(who, id, assetid, price) {
                if(typeof price === 'undefined') {
                    price = assetid;
                    assetid = id;
                }
                if(who == 'bot') {
                    this.botInventorySelected.splice($.inArray(assetid, this.botInventorySelected),1);
                    this.botInventorySelectedValue -= price;
                } else {
                    this.userInventorySelected.splice($.inArray(assetid, this.userInventorySelected),1);
                    this.userInventorySelectedValue -= price;
                    if(this.userInventorySelectedValue <= 0) {
                        this.userInventorySelectedValue = 0;
                    }
                }
                this.checkTradeable();
            },
            checkTradeable: function() {
                var user = parseFloat(this.userInventorySelectedValue.toFixed(2));
                var bot = parseFloat(this.botInventorySelectedValue.toFixed(2));
                if(user != 0 && user >= bot) {
                    this.disableTrade = false;
                } else {
                    this.disableTrade = true;
                }
            },
            activeBot: function(id) {
                if(this.selectedBot !== id) {
                    if(id == 'All Bots') {
                        var botInventory = [];
                        for(var i in this.botInventories) {
                            var bot = this.botInventories[i];
                            for(var y in bot.items) {
                                var item = bot.items[y];
                                item.bot = i;
                                if(app.priceList[item.data.market_hash_name] <= app.rates.trash) {
                                    item.price = (app.priceList[item.data.market_hash_name] * app.rates.bot['trash']).toFixed(2);
                                } else {
                                    item.price = (app.priceList[item.data.market_hash_name] * app.rates.bot[item.item_type.name]).toFixed(2);
                                }
                                botInventory.push(item);
                            }
                        }
                        this.botInventory = sortInventory(botInventory, true);
                    } else {
                        this.botInventory = this.sortInventory(this.botInventories[id].items, true);
                    }
                    this.botInventorySelected = [];
                    this.botInventorySelectedValue = 0;
                    this.selectedBot = id;
                }
            },
            searchInventory: function(who, value) {
                var inventory = [];
                var search = [];
                if(who == 'bot') {
                    search = this.botInventory;
                } else {
                    search = this.userInventory;
                }
                for(var i in search) {
                    var item = search[i];
                    if(item.data.market_hash_name.toLowerCase().indexOf(value.toLowerCase()) === -1) {
                        item.hidden = 1;
                    } else {
                        item.hidden = 0;
                    }
                    inventory.push(item);
                }
                if(who == 'bot') {
                    this.botInventory = sortInventory(inventory, true);
                } else {
                    this.userInventory = sortInventory(inventory, true);
                }
            },
            updateTradelink: function() {
                var link = this.user.tradelink;
                if(typeof link !== 'undefined') {
                    link = link.trim();
                    if(
                        link.indexOf('steamcommunity.com/tradeoffer/new/') === -1 ||
                        link.indexOf('?partner=') === -1 ||
                        link.indexOf('&token=') === -1
                    ) {
                        this.invalidTradelink = true;
                    } else {
                        ga('send', 'updateTradelink', {
                            eventCategory: 'Trade',
                            eventAction: 'click',
                            eventLabel: this.user.tradelink
                        });
                        this.invalidTradelink = false;
                        localStorage.setItem(this.user.id, this.user.tradelink);
                        $('#tradelink').modal('hide');
                    }
                } else {
                    this.invalidTradelink = true;
                }

            },
            reloadInventories: function() {
                this.disableReload = true;
                this.botInventory = [];
                this.botInventorySelected = [];
                this.botInventorySelectedValue = 0;
                this.userInventory = [];
                this.userInventorySelected = [];
                this.userInventorySelectedValue = 0;
                socket.emit('get bots inv');
                if(this.user && typeof this.user.steamID64 !== 'undefined') {
                    socket.emit('get user inv', this.user.steamID64);
                }
                ga('send', 'reloadInventories', {
                    eventCategory: 'Trade',
                    eventAction: 'click',
                    eventLabel: this.user.steamID64 || false
                });
            },
            sendOffer: function() {
                if( ! localStorage[this.user.id]) {
                    $('#tradelink').modal('show');
                } else {
                    ga('send', 'sendOffer', {
                        eventCategory: 'Trade',
                        eventAction: 'click',
                        eventLabel: this.user.id
                    });
                    this.offerStatus = {};
                    this.checkTradeable();
                    if( ! this.disableTrade) {
                        this.disableTrade = true;
                        $('#tradeoffer').modal('show');
                        socket.emit('get offer', {
                            user: this.userInventorySelected,
                            bot: this.botInventorySelected,
                            bot_id: this.selectedBot,
                            steamID64: this.user.id,
                            tradelink: localStorage[this.user.id]
                        });
                    }
                }
            }
        }
    });


    var socket = io();
    socket.emit('get pricelist');
    socket.emit('get rates');

    socket.on('site', function(data) {
        app.site = data;
        window.document.title = data.header + ' | Web-based CS:GO Trading Bot';
    });

    socket.on('offer status', function(data) {
        app.offerStatus = data;
        if(data.status === 3 || data.status === false) {
            app.disableTrade = false;
        }
        if(data.status === 3) {
            app.botInventorySelected = [];
            app.botInventorySelectedValue = 0;
            app.userInventorySelected = [];
            app.userInventorySelectedValue = 0;
        }
    });

    socket.on('user', function(user) {
        user.steamID64 = user.id;
        app.user = user;

        if(app.user.steamID64) {
            socket.emit('get user inv', app.user.steamID64);
        }

        if(localStorage[app.user.id]) {
            app.user.tradelink = localStorage[app.user.id];
        }
        if(typeof app.user.tradelink === 'undefined' && app.user) {
            $('#tradelink').modal('show');
        }
    });

    socket.on('user inv', function(data) {
        app.disableReload = false;
        if( ! data.error) {
            var userInventory = [];
            for(var i in data.items) {
                var item = data.items[i];
                if(app.priceList[item.data.market_hash_name] <= app.rates.trash) {
                    item.price = (app.priceList[item.data.market_hash_name] * app.rates.user['trash']).toFixed(2);
                } else {
                    item.price = (app.priceList[item.data.market_hash_name] * app.rates.user[item.item_type.name]).toFixed(2);
                }
                userInventory.push(item);
            }
            if( ! userInventory.length) {
                userInventory = { error: { error: 'No tradeable items found.' } };
            } else {
                userInventory = sortInventory(userInventory, true);
            }
            app.userInventory = userInventory;
        } else {
            app.userInventory = data;
        }
    });

    socket.on('bots floats', function(floats) {
        app.floats = floats;
    })

    socket.on('bots inv', function(items) {
        app.disableReload = false;
        // Order items object by key name
        const ordered = {};
        Object.keys(items).sort().forEach((key) => {
            ordered[key] = items[key];
        });
        // Assign ordered object to botInventories
        app.botInventories = Object.assign({}, ordered);

        var botInventory = [];
        var error = false;
        for(var i in items) {
            var bot = items[i];
            if(bot.error) {
                error = bot.error;
            }
            for(var y in bot.items) {
                var item = bot.items[y];
                item.bot = i;
                if(app.priceList[item.data.market_hash_name] <= app.rates.trash) {
                    item.price = (app.priceList[item.data.market_hash_name] * app.rates.bot['trash']).toFixed(2);
                } else {
                    item.price = (app.priceList[item.data.market_hash_name] * app.rates.bot[item.item_type.name]).toFixed(2);
                }
                botInventory.push(item);
            }
        }
        if( ! botInventory.length) {
            if( ! error) {
                error = { error: { error: 'No tradeable items found. Make sure all bots have items and are not set to private.' } };
            }
            botInventory = { error: error };
        } else {
            botInventory = sortInventory(botInventory, true);
        }
        app.botInventory = botInventory;
    });
    socket.on('pricelist', function(prices) {
        app.priceList = Object.assign({}, app.priceList, prices);

        socket.emit('get bots inv');
    });
    socket.on('rates', function(rates) {
        app.rates = Object.assign({}, app.rates, rates);
    });

    function sortInventory(inventory, desc) {
        return inventory.sort(function(a, b) {
            return (desc) ? b.price - a.price : a.price - b.price;
        });
    }

});

index.js:

'use strict'

// Modules
const express = require('express')

const app = express()
const server = require('http').Server(app)
const io = require('socket.io')(server)
const passport = require('passport')

const session = require('express-session')
const sharedsession = require('express-socket.io-session')
const SteamStrategy = require('passport-steam').Strategy
// Site stuff
const TradeBot = require('./lib/index')

const Trade = new TradeBot({ io })
const config = require('./config')
// Web server
server.listen(config.websitePort)
console.log('[!] Website server is online.')
console.log('[!] Socket server is online.')
// Passport
passport.serializeUser((user, done) => {
    done(null, user)
})
passport.deserializeUser((obj, done) => {
    done(null, obj)
})
passport.use(new SteamStrategy({
    returnURL: `${config.website}/auth/steam/return`,
    realm: `${config.website}/`,
    apiKey: config.steamApiKey,
},
(identifier, profile, done) => {
    process.nextTick(() => {
        const user = profile
        user.identifier = identifier
        return done(null, user)
    })
}))
const sessionMiddleware = session({
    secret: 'csg0tradebot',
    name: 'csg0trade',
    resave: true,
    saveUninitialized: true,
})
app.use(sessionMiddleware)
app.use(passport.initialize())
app.use(passport.session())
app.use('/static', express.static('./static'))
// Routes
app.get('/', (req, res) => {
    res.sendFile(`${__dirname}/index.html`)
})
// Auth Routes
app.get('/auth/steam', passport.authenticate('steam'))
app.get('/auth/steam/return', passport.authenticate('steam', { failureRedirect: '/auth/steam' }), (req, res) => {
    // Successful authentication, redirect home.
    res.redirect('/')
})
app.get('/logout', (req, res) => {
    req.logout()
    res.redirect('/')
})
// Sockets
io.use(sharedsession(sessionMiddleware))
io.on('connection', (socket) => {
    let userObject = false
    if (
        typeof socket.handshake.session.passport !== 'undefined' &&
        typeof socket.handshake.session.passport.user !== 'undefined' &&
        typeof socket.handshake.session.passport.user.id !== 'undefined'
    ) {
        userObject = socket.handshake.session.passport.user
    }

    socket.emit('site', config.site)
    socket.emit('user', userObject)
    socket.on('get user inv', (steamID64) => {
        Trade.getInventory(steamID64, config.appID, config.contextID, (err, data) => {
            socket.emit('user inv', { error: err, items: data })
        })
    })
    socket.on('get bot inv', (id) => {
        Trade.getInventory(config.bots[id].steamID64, config.appID, config.contextID, (err, data) => {
            socket.emit('bot inv', { error: err, items: data })
        })
    })
    socket.on('get bots inv', () => {
        const params = []
        Object.keys(config.bots).forEach((index) => {
            const bot = config.bots[index]
            params.push({
                id: index,
                steamID64: bot.steamID64,
                appID: config.appID,
                contextID: config.contextID,
            })
        })
        Trade.getInventories(params, (data) => {
            socket.emit('bots inv', data)
            socket.emit('bots floats', Trade.getFloatValues())
        })
    })
    socket.on('get pricelist', () => {
        socket.emit('pricelist', Trade.getPriceList())
    })
    socket.on('get rates', () => {
        socket.emit('rates', {
            ignore: Trade.getIgnorePrice(),
            trash: Trade.getTrashPrice(),
            user: Trade.getUserRates(),
            bot: Trade.getBotRates(),
        })
    })
    socket.on('get offer', (data) => {
        socket.emit('offer status', {
            error: null,
            status: 4,
        })
        const link = data.tradelink
        const offerData = data
        if (
            link.indexOf('steamcommunity.com/tradeoffer/new/') === -1 ||
            link.indexOf('?partner=') === -1 ||
            link.indexOf('&token=') === -1
        ) {
            socket.emit('offer status', {
                error: 'Invalid trade link!',
                status: false,
            })
        } else {
            Trade.validateOffer(offerData, (err, success) => {
                socket.emit('offer status', {
                    error: err,
                    status: (success) ? 1 : false,
                })
                if (!err && success) {
                    if (typeof config.bots[offerData.bot_id] === 'undefined') {
                        offerData.bot_id = Object.keys(config.bots)[0]
                    }
                    const Bot = Trade.getBot(offerData.bot_id)
                    const offer = Bot.manager.createOffer(offerData.tradelink)
                    offer.addTheirItems(offerData.user.map(assetid => ({
                        assetid,
                        appid: config.appID,
                        contextid: config.contextID,
                        amount: 1,
                    })))
                    if (offerData.bot.length) {
                        offer.addMyItems(offerData.bot.map(assetid => ({
                            assetid,
                            appid: config.appID,
                            contextid: config.contextID,
                            amount: 1,
                        })))
                    }
                    offer.setMessage(config.tradeMessage)
                    offer.getUserDetails((detailsError, me, them) => {
                        if (detailsError) {
                            socket.emit('offer status', {
                                error: detailsError,
                                status: false,
                            })
                        } else if (me.escrowDays + them.escrowDays > 0) {
                            socket.emit('offer status', {
                                error: 'You must have 2FA enabled, we do not accept trades that go into Escrow.',
                                status: false,
                            })
                        } else {
                            offer.send((errSend, status) => {
                                if (errSend) {
                                    socket.emit('offer status', {
                                        error: errSend,
                                        status: false,
                                    })
                                } else {
                                    console.log('[!!!!!] Sent a trade: ', data)
                                    if (status === 'pending') {
                                        socket.emit('offer status', {
                                            error: null,
                                            status: 2,
                                        })
                                        Trade.botConfirmation(data.bot_id, offer.id, (errConfirm) => {
                                            if (!errConfirm) {
                                                socket.emit('offer status', {
                                                    error: null,
                                                    status: 3,
                                                    offer: offer.id,
                                                })
                                            } else {
                                                socket.emit('offer status', {
                                                    error: errConfirm,
                                                    status: false,
                                                })
                                            }
                                        })
                                    } else {
                                        socket.emit('offer status', {
                                            error: null,
                                            status: 3,
                                            offer: offer.id,
                                        })
                                    }
                                }
                            })
                        }
                    })
                }
            })
        }
    })
})

Is “:host::part()” a valid CSS selector?

I see this pattern all over Microsoft’s homepage microsoft.com.

Here’s an example –

:host::part(tab-item__content) {
    display: var(
      --ds-tab-item-content-display,
      ${t(e.contentDisplay)}
    );
    flex-direction: var(
      --ds-tab-item-content-flex-direction,
      ${t(e.contentFlexDirection)}
    );
    gap: var(--ds-tab-item-content-gap, ${t(e.contentGap)});
    align-items: var(
      --ds-tab-item-content-align-items,
      ${t(e.contentAlignItems)}
    );
    width: var(--ds-tab-item-content-width, ${t(e.contentWidth)});
    max-width: var(
      --ds-tab-item-content-max-width,
      ${t(e.contentMaxWidth)}
    );
    font-size: var(
      --ds-tab-item-content-font-size,
      ${t(e.contentFontSize)}
    );
    font-weight: var(
      --ds-tab-item-content-font-weight,
      ${t(e.contentFontWeight)}
    );
    ...
  }

Homepage url disapear

I’m on Blogger, and when I save the HTML, the home URL disappears. I’ve been searching for months, but being a near-novice, I haven’t found a solution.

The link is in the menu, the first one on the left. When I save the widget in Blogger Layout and load the page, I see the home URL, but when I edit the HTML, it disappears, and the menu link goes from 4 to 3.

Furthermore, since I’ve had this problem, I’ve also lost indexing for my home pages. Perhaps this information can be helpful. I’ve worked hard on my site’s SEO, but I get zero results, and Search Console indexing hasn’t improved after 10 months.

My sitemap hasn’t been read by Search Console since December.

I apologize again for merging multiple topics, but I’m convinced my problem isn’t SEO. It may not be the best SEO, but having zero indexed pages is impossible. Not only that, but I’ve also lost unindexed pages; they’re declining. I have over 4,000 published posts.

I tried creating a test blog with the same theme, and the home URL remains there. So I’m ruling out a theme issue.

Finally, this is my third site in five years, and this time I wanted to do things properly, using Blogger instead of wordpress.org, as I no longer have the money. Okay, Blogger isn’t the best choice for SEO, but it’s better than nothing. I’ve put all my accumulated experience into this site and tried to improve the aspects I was making wrong. Not only that, I’ve compared various competitors’ site design methods and taken inspiration from them. This way, I can avoid the mistakes of the past.

website: https://yoursupergames.blogspot.com/
images: https://imgur.com/a/nUvvksD

I expected to have a simple site to build with Blogger, despite the need for several HTML and JavaScript additions for completeness.

Unfortunately, despite my enormous efforts, the results are zero. It may not be the best site in the world, but I can’t even get the homepage indexed or AdSense validation.

Search Console sees a redirect to the homepage and confirms the error with every validation attempt. However, if I test the homepage with Search Console, it tells me the page is indexable.

I remind you that I’m not asking how to improve my SEO, but rather questions related to technical HTML errors that completely prevent Google from showing up. I would have accepted the last job and given up after all the hard work I’ve put in over five years. But no! Not even last, so I probably did something wrong, especially with Blogger, where I think I did everything right (or almost everything) on ​​the SEO front.

Why does the JavaScript mediaSession API not work in Firefox?

I’ve been programming a streaming service and have now run into the issue of displaying the media’s metadata in the OS’ media controls.

I now have this code:

if ("mediaSession" in navigator) {
    navigator.mediaSession.metadata = new window.MediaMetadata({
        title: song.title,
        artist: song.artists,
        album: "test",
        artwork: [{
            src: (song.imageName
                 ? `${location.origin}/BeatStream/images/song/large/${song.imageName}`
                 : `${location.origin}/BeatStream/images/defaultSong.webp`),
        }]
    });

    navigator.mediaSession.setActionHandler('play', () => this.audio.play());
    navigator.mediaSession.setActionHandler('pause', () => this.audio.pause());
    navigator.mediaSession.setActionHandler('previoustrack', () => this.playPrevious());
    navigator.mediaSession.setActionHandler('nexttrack', () => this.playNext());

    console.log("Image set to " + ((song.imageName)
        ? `${location.origin}/BeatStream/images/song/large/${song.imageName}`
        : `${location.origin}/BeatStream/images/defaultSong.webp`));
}

In Chrome, this all work very nice and I have no issues with it. In Firefox though, the artwork does not show up, even when trying multiple different image formats. I also did not get any errors in the browser console and the URLs that are logged to the console are the correct images. Different AI models tried to tell me that Firefox doesn’t support artwork.

When I go ahead and visit YT music, spotify or any other online streaming service with Firefox though, the artworks are shown perfectly fine. So my question is: What can they do that I can’t do, or do I have an error in my code?

writing structure related to chrome.storage.sync.set

First time I encounter the form of

chrome.storage.sync.set({ var1, var2, var3 });

Which creates in storage something like:

// inspect -> Application -> Extension storage -> sync
var1: "<value of var1 was string>"
var2: [{<value of var2 was a JSON>}]
var3: <value of var3 was int>

Basically the name of the variable becomes the key and the value is automatically being saved as it’s suppose to be.

my question is, where is this documented? (this form of writing) searching for it is a needle in a haystack

Angular Module Export Not Recognized

I am creating a new website in Angular V20. I have created a new module and added a new component to the module declarations and exports. I am exporting the component in its script. When I attempt to import the new component from the module into my app.routes.ts file, it throws the error:

No matching export in “module” for import “Component name”.

Then tells me there is an error on the import of the component in my routing file. When I hover over the import in VS code, it states, “Module ‘module location’ declares ‘component’ locally, but it is not exported.”

What is causing this error and why can’t I use my module to import my component? Thanks for any and all help!

Component Code:

import { Component } from '@angular/core';

@Component({
  selector: 'event-view',
  imports: [],
  templateUrl: './event-view.html',
  styleUrl: './event-view.css'
})
export class EventView { }

Module code:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { EventView } from './event-view/event-view';


@NgModule({
  declarations: [ EventView ],
  imports: [
    CommonModule
  ],
  exports: [ EventView ]
})
export class PagesModule { }

app.routes.ts:

import { Routes } from '@angular/router';
import { EventView } from '../Pages/pages-module';

export const routes: Routes = [
    {   
        path: '/recipient/:id',
        component: EventView
    }
];

I have tried removing the standalone from the component but then it wouldn’t go into the module without errors. I have tried checking if there is a missing attribute on my component and if there is anything missing on my module, but everything looks good.

How to extract all attachment Blobs in PouchDB (synchronous/asynchronous issue?)

Note: My problem seems to be more to do with synchronous vs asynchronous JavaScript than with PouchDB.

I have a PouchDB database containing documents that each have one attachment.

The attachments are simply UTF8 text.

The attachments blobs are created with const blob_content = new Blob([content], {type: 'text/plain'});

I can get one attachment fine with the following:

db_notes.getAttachment(id, 'content.txt').then(function(blob) {
   const reader = new FileReader();
   reader.readAsText(blob);
   reader.onload = () => { 
      processContent(reader.result);
   };
}).catch(function(err) {
   console.log(err);
});

But I need to get all of the documents with the extracted blob content.

My extraction code, so far, is:

db_notes.allDocs({
         include_docs: true
      ,  attachments: true
      ,  binary: true
   }).then(function(result) {
      allNotesIncContent = result.rows.map(({doc}) => docToDocObj(doc));
      console.log("allNotesIncContentn ", allNotesIncContent );
   }).catch(function(err) {
      console.log(err);
   });

and

function docToDocObj(doc) {
   rawBlobData = doc._attachments['content.txt'].data;
   rawBlobData.text().then(function(content) {
      objToReturn =
               {  id: doc._id
               ,  rev: doc._rev
               ,  content: content
               }
      console.log("objToReturnn ", objToReturn );
      return objToReturn;
   }).catch(function(err) {
      console.log("Blob.text error: ", err);
   });
};

At the console I see:

(9) [undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined]

followed by a succession of

objToReturn
{id: ‘1756756073636’, rev: ‘1-7bd7518103126469453c4cf04968b189’, content: ‘Some text’, …}

I’m guessing this is because rawBlobData.text() is an asynchronous function that is taking too long to return its results.

I have naively played with returning a Promise instead, but I’ve failed to construct the correct code — I end up with a .then not defined error.

SvelteKit + Superforms: Data flickers and is replaced by wrong data on page reload

I’m building a SvelteKit application where users can edit student details on a dynamic route (/student/[id]). I’m using Supabase for the database and SvelteKit Superforms to handle the form.

The editing functionality works correctly. However, I’m facing a strange issue with data consistency only on page reloads.

The Problem

When I navigate from my student list page (/students) to a specific student’s detail page (/student/[id]), the data is fetched and the form is populated correctly.

The issue occurs when I reload the page directly on a detail page (e.g., /student/123-abc-456).

Observed behavior on reload:

The correct student data is fetched from the load function and displayed on the page for a brief moment.
After a split second, the data within the form fields (managed by superForm) is replaced by the data of another student. I could confirm this with the SuperDebug Component

The non-form data on the page (like the header ) which uses data.student remains correct. This suggests the issue is specific to the Superforms store ($form).

I’ve confirmed through logging that the data.student object passed from +page.server.ts is always correct. The issue seems to be with how the $form store is being hydrated or updated on the client side after a full page load.

What could be causing the $form store to be updated with incorrect data after a page reload, and how can I ensure it stays in sync with the data loaded for the current page?

+page.server.ts

import { supabase } from '$lib/supabaseClient';

import type { PageServerLoad } from './$types';
import type { Actions } from '@sveltejs/kit';
import { zod } from 'sveltekit-superforms/adapters';
import { superValidate } from 'sveltekit-superforms';

import { fail } from '@sveltejs/kit';
import type { Student } from '$lib/types';

import z from 'zod';

const studentSchema = z.object({
    id: z.string().uuid(),
    first_name: z.string().min(2, 'Vorname ist erforderlich.'),
    last_name: z.string().min(2, 'Nachname ist erforderlich.'),
    email: z.string().email('Ungültige E-Mail-Adresse.').nullable(),
    phone_number: z.string().nullable()
});

// This is responsible for loading the data from the database
export const load: PageServerLoad = async (event) => {
    const id = event.params.id;

    const { data: student, error } = await supabase
        .from('students')
        .select('*')
        .eq('id', id)
        .single<Student>();

    if (error || !student) {
        console.error('Error loading student:', error?.message);
    }

    const form = await superValidate(student, zod(studentSchema));

    return { student, form };
};

// This is responsible for the form submission
export const actions: Actions = {
    default: async ({ request }) => {
        const form = await superValidate(request, zod(studentSchema));

        if (!form.valid) {
            return fail(400, { form });
        }

        const { error } = await supabase.from('students').update(form.data).eq('id', form.data.id);

        if (error) {
            console.error('Error updating student:', error.message);
            return fail(400, { form });
        }

        return { form };
    }
};

+page.svelte

<script lang="ts">
    import Button from '$lib/components/ui/button/button.svelte';
    import * as Tabs from '$lib/components/ui/tabs';
    import * as Card from '$lib/components/ui/card';
    import type { PageData } from './$types';

    import ChevronLeft from '@lucide/svelte/icons/chevron-left';
    import SuperDebug, { superForm } from 'sveltekit-superforms';
    import { Badge } from '$lib/components/ui/badge';
    import Mail from '@lucide/svelte/icons/mail';
    import Phone from '@lucide/svelte/icons/phone';
    import Pencil from '@lucide/svelte/icons/pencil';
    import FormButton from '$lib/components/ui/form/form-button.svelte';
    import Input from '$lib/components/ui/input/input.svelte';

    export let data: PageData;

    const { form, errors, enhance } = superForm(data.form);
    console.log($form);
</script>

{#if data.student}
    {#key data.student.id}
        <SuperDebug data={$form} />
        <header class="border-text-muted-foreground border-b">
            <h1 class="mt-4 mb-2 text-2xl font-bold">
                <Button variant="ghost" href="/students">
                    <ChevronLeft size="18" />
                </Button>
                Schülerprofil von {data.student.first_name}
                {data.student.last_name}
            </h1>
        </header>
        <div class="mt-8 flex flex-col gap-y-4 lg:flex-row lg:gap-x-4">
            {#if data.student}
                <Tabs.Root value="overview" class="w-full">
                    <Tabs.List>
                        <Tabs.Trigger value="overview">Übersicht</Tabs.Trigger>
                        <Tabs.Trigger value="password">Password</Tabs.Trigger>
                    </Tabs.List>
                    <Tabs.Content value="overview">
                        <div class="grid gap-4 xl:grid-cols-3">
                            <div class="space-y-4 xl:col-span-1">
                                <Card.Root>
                                    <Card.Header>
                                        <Card.Title class="relative flex flex-col items-center gap-2">
                                            <div class="circle-avatar">
                                                <img
                                                    alt="Student's avatar"
                                                    src="https://images.unsplash.com/photo-1517365830460-955ce3ccd263?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=384&q=80"
                                                    class="h-24 w-24 rounded-full"
                                                />
                                            </div>
                                            <h2 class="font-bold tracking-tight lg:text-xl">
                                                {data.student.first_name}
                                                {data.student.last_name}
                                            </h2>

                                            <div class="flex flex-row gap-2">
                                                <Badge variant="secondary" class="w-fit">
                                                    {data.student.driving_class}
                                                </Badge>
                                            </div>
                                        </Card.Title>
                                        <Card.Content class="mt-5 flex flex-col gap-4">
                                            <div class="flex flex-row items-center gap-2">
                                                <Mail size="18" />
                                                <a class="text-sm text-muted-foreground" href="mailto:{data.student.email}">
                                                    {data.student.email}
                                                </a>
                                            </div>
                                            <div class="flex flex-row items-center gap-2">
                                                <Phone size="18" />
                                                <span class="text-sm text-muted-foreground">
                                                    {data.student.phone_number}
                                                </span>
                                            </div>
                                        </Card.Content>
                                    </Card.Header>
                                </Card.Root>
                            </div>

                            <div class="space-y-4 xl:col-span-2">
                                <Card.Root>
                                    <Card.Header class="relative">
                                        <h2 class="mb-5">Schüler-Info</h2>
                                        <Pencil
                                            size="1.5rem"
                                            class="text-muted-foreground hover:cursor-pointer hover:text-primary"
                                            style="position: absolute; top: 0rem; right: 2rem;"
                                        />
                                        <Card.Content class="px-0">
                                            <form method="POST" use:enhance>
                                                <input type="hidden" name="id" bind:value={$form.id} />
                                                <div class="mb-4 flex flex-col gap-2">
                                                    <label for="first_name">Vorname</label>
                                                    <Input
                                                        type="text"
                                                        name="first_name"
                                                        class="input w-full"
                                                        bind:value={$form.first_name}
                                                    />
                                                    {#if $errors.first_name}
                                                        <p class="text-error">{$errors.first_name}</p>
                                                    {/if}
                                                </div>
                                                <div class="mb-4 flex flex-col gap-2">
                                                    <label for="last_name">Nachname</label>
                                                    <Input
                                                        type="text"
                                                        name="last_name"
                                                        class="input"
                                                        bind:value={$form.last_name}
                                                    />
                                                    {#if $errors.last_name}
                                                        <p class="text-error">{$errors.last_name}</p>
                                                    {/if}
                                                </div>
                                                <div class="mb-4 flex flex-col gap-2">
                                                    <label for="email">E-Mail Adresse</label>
                                                    <Input type="email" name="email" class="input" bind:value={$form.email} />
                                                    {#if $errors.email}
                                                        <p class="text-error">{$errors.email}</p>
                                                    {/if}
                                                </div>
                                                <div class="mb-4 flex flex-col gap-2">
                                                    <label for="phone_number">Telefonnummer</label>
                                                    <Input
                                                        type="tel"
                                                        name="phone_number"
                                                        class="input"
                                                        bind:value={$form.phone_number}
                                                    />
                                                    {#if $errors.phone_number}
                                                        <p class="text-error">{$errors.phone_number}</p>
                                                    {/if}
                                                </div>
                                                <FormButton type="submit" class="w-full">Speichern</FormButton>
                                            </form>
                                        </Card.Content>
                                    </Card.Header>
                                </Card.Root>
                            </div>
                        </div>
                    </Tabs.Content>
                    <Tabs.Content value="password">Change your password here.</Tabs.Content>
                </Tabs.Root>
            {:else}
                <p>Fehler beim Laden des Schülers.</p>
            {/if}
        </div>
    {/key}
{/if}

No allowing to copy the content of a website [closed]

I visited a website Tried to copy a selected part. But no selection and copy way was working .. Also I cant see the inspect ! How did they do this?

Its not like so protected info . Its a public website also it was roadmap that i wanted to copy and just search on another tab. anyway this feature seems cool to me .