Jump to content

trylo

Member
  • Posts

    157
  • Joined

  • Last visited

Awards

This user doesn't have any awards

2 Followers

Profile Information

  • Member title
    Junior Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. The invisible icon appears for a split of a second - there is no chance to click on it or pull to the right. There was a Windows update yesterday. Today I haven't noticed the appearing icon so far...
  2. Interesting. I have 2 monitors and I use 3 desktops, so maybe it is connected, although it's not happening at the moment of switching desktops.
  3. I have a pretty constant set of apps that I keep open throughout the day, but I'll try to close some to see if it's associated with one of them. For sure it's not connected with a specific action I'm doing, it seems like it's every 15 minutes or so. It's hard to say for sure as it's just a blip in my periferal vision. I'll try to record screen with Task Manager open to see if something comes up. Thank you for your tips on how to tackle this.
  4. I have noticed that from time to time there is a weird flicker on my taskbar. Very suspicious, so I turned on the screen recording to catch what is going on. What happens is it looks like there is an app opening for just a split of a second and then it closes down. Of course, I'm afraid of some malicious software running on my computer. I don't run any pirated software on my machine, so I'm unsure where it could come from. Is there any way to find out what app does that? Thank you for your help in advance!
  5. I switched to mysql2 and logged as much as possible and found out that it was actually bcrypt that was crashing the backend. I switched to bcryptjs and it works now. Thanks.
  6. Hi! I'm a hobbyist programmer. I'm trying to write a Vue Web App just for fun, but I want to make it secure. I'm hosting it on my Unraid machine. I have separate containers for the frontend and for the backend. I have a container with Nginx Proxy Manager that is giving me reverse proxy for my other things (like Home Assistant or Nextcloud) and I want to use it to for my little Web App. Right now I'm struggling with something that probably most of you will consider silly: user registration. I have the frontend and the backend setup and it works... until I want to implement CORS. When I do that and I try to register a user - my backend container crashes and the webbrowser consol gives me an error saying: Access to XMLHttpRequest at 'https://db.domain.com/register' from origin 'https://app.domain.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. I have no idea what is wrong. It looks like maybe Nginx Proxy Manager is stripping the header? But I don't know how to fix this. Can anyone help me troubleshooti this? This is my backend code: import dotenv from 'dotenv'; import nodemailer from 'nodemailer'; import crypto from 'crypto'; import express from 'express'; import bodyParser from 'body-parser'; import cookieParser from 'cookie-parser'; import mysql from 'mysql'; import cors from 'cors'; import bcrypt from 'bcrypt'; import jwt from 'jsonwebtoken'; import { body, validationResult } from 'express-validator'; import helmet from 'helmet'; import cron from 'node-cron'; import rateLimit from 'express-rate-limit'; process.on('uncaughtException', (error) => { console.error('Uncaught Exception:', error); }); process.on('unhandledRejection', (error) => { console.error('Unhandled Promise Rejection:', error); }); dotenv.config({ path: process.env.NODE_ENV === 'production' ? '.env.production' : '.env.development' }); const app = express(); const corsOptions = { origin: ['https://app.domain.com', 'https://db.domain.com'], credentials: true, methods: 'GET,HEAD,PUT,PATCH,POST,', allowedHeaders: 'Content-Type,Authorization' }; app.use(cors(corsOptions)); app.use(helmet()); app.use(bodyParser.json()); app.use(cookieParser()); app.set('trust proxy', 1); // Configure MariaDB connection pool const pool = mysql.createPool({ connectionLimit: 10, // Optional: adjust the number of connections in the pool host: process.env.DB_HOST, port: process.env.DB_PORT, user: process.env.DB_USER, password: process.env.DB_PASSWORD, database: process.env.DB_NAME }); // Test connection to MariaDB pool.getConnection((err, connection) => { if (err) { console.error('Error getting connection from pool:', err); return; } console.log('Connected to the database.'); connection.release(); // Release the connection back to the pool }); // Rate limiting const loginLimiter = rateLimit({ windowMs: 15 * 60 * 1000, // 15 minutes window max: 5, // limit each IP to 5 login requests message: 'Zbyt wiele pr�b logowania, spr�buj ponownie za 15 minut.' }); // Configure nodemailer transporter let transporter = nodemailer.createTransport({ host: "smtpserver.com", port: 587, // Common ports are 587 (for TLS) or 465 (for SSL) secure: false, // true for 465, false for other ports auth: { user: process.env.EMAIL_USERNAME, // Your SMTP username pass: process.env.EMAIL_PASSWORD // Your SMTP password }, tls: { // Do not fail on invalid certs (if you are using self-signed certificates) rejectUnauthorized: false } }); // Registration endpoint app.post('/register', loginLimiter, [ // Validation rules body('username', 'Nieprawidlowy adres email').isEmail(), body('password', 'Haslo musi miec minimum 9 znak�w').isLength({ min: 9 }), ], async (req, res) => { // Check for validation errors const errors = validationResult(req); if (!errors.isEmpty()) { return res.status(400).json({ errors: errors.array() }); } const { username, password } = req.body; res.setHeader('Access-Control-Allow-Origin', 'https://app.domain.com'); res.setHeader('Access-Control-Allow-Methods', 'POST'); res.setHeader('Access-Control-Allow-Credentials', 'true'); // Check if the user already exists pool.query('SELECT * FROM users WHERE username = ?', [username], async (err, results) => { if (err) { console.error("Database query error:", err); res.status(500).send({ message: "Error checking user existence", error: err.message }); return; } if (results.length > 0) { // User already exists res.status(409).send({ message: "Adres email jest juz zarejestrowany" }); return; } // If user does not exist, continue with registration try { const hashedPassword = await bcrypt.hash(password, 10); const verificationToken = crypto.randomBytes(16).toString('hex'); const tokenExpiration = new Date(); tokenExpiration.setHours(tokenExpiration.getHours() + 9); // Save user with token in the database pool.query('INSERT INTO users (username, password, verificationToken, tokenExpiration) VALUES (?, ?, ?, ?)', [username, hashedPassword, verificationToken, tokenExpiration], (error, result) => { if (error) { console.error("Error in user registration:", error); res.status(500).send({ message: "Blad rejestracji nowego uzytkownika", error: error.message }); return; } // Send verification email const mailOptions = { from: process.env.EMAIL_USERNAME, to: username, subject: 'app - weryfikacja adres email', html: `<p>Potwierdz adres email klikajac ponizszy link: <a href="http://${req.headers.host}/verify-email?token=${verificationToken}">Potwierdzam adres email</a></p>` }; transporter.sendMail(mailOptions, function (emailError, info) { if (emailError) { console.log(emailError); res.status(500).send({ message: "Error sending verification email", error: emailError.message }); return; } else { console.log('Email sent: ' + info.response); res.status(201).send({ message: "User created. Please check your email to verify your account." }); } }); } ); } catch (error) { res.status(500).send({ message: "Error hashing password", error: error.message }); } }); }); // Function to query the database using the pool function queryDatabase(query, params, callback) { pool.getConnection((err, connection) => { if (err) { console.error('Error getting connection from pool:', err); callback(err, null); return; } connection.query(query, params, (error, results) => { connection.release(); // always release the connection back to the pool if (error) { console.error('Error executing query:', error); callback(error, null); return; } callback(null, results); }); }); } // Start server const port = process.env.PORT_BACKEND || 3000; app.listen(port, () => { console.log(`Server is running on port ${port}.`); }); console.log('VERSION: '+process.env.VERSION); console.log('Frontend URL: '+process.env.FRONTEND_URL); console.log('DB Host: '+process.env.DB_HOST); And here is my frontend call: async RegistrationNew() { const apiUrl = import.meta.env.VITE_APP_API_URL try { await axios.post( `${apiUrl}/register`, { username: this.username, password: this.password }, { withCredentials: true } ) alert('Registration successful! Please check your email to verify your account.') } catch (error) { if (error.response) { this.errorMessage = error.response.data.message || 'An error occurred during registration.' } else { this.errorMessage = 'Registration failed. Please try again.' } console.error('Registration error:', error) console.log("VERSION: "+import.meta.env.VERSION) console.log("API URL: "+import.meta.env.VITE_APP_API_URL) } }
  7. This is so much worse The temps went high really quickly and after I opened the side panel a heat wave hit me.
  8. All others to intake? Including the top mounted to the AIO radiator?
  9. Thank you for this image, it's helpful. I will add fans to the bottom and flip the back fan around and see if it helps.
  10. I will do some more testing. It may be just a coincidence, but so far I had no crashes in Half-Life Alyx and in Hogwarts Legacy as long as the side panel is off.
  11. I've run test for 1h with panel on and for 1h with panel off. CPU temp is actually slightly higher with Panel Off (Package 1C higher). GPU temps are a lot lower with Panel Off (9C GPU, 10C Memory, 10C Hot Spot). NVME that is directly under GPU is 5C cooler with Panel Off. Side note: +12V for some reason on this Motherboard has always reported wrong voltage, it's been like this since I got it 3-4 years ago. What do you folks think? Should I get a different case?
  12. Hi! I've just upgraded my system with RTX 4090. CPU: i9-9900K (cooled by Fractal Design Celsius S24 Black 2x120mm mounted to the top of the case) RAM: G.SKILL 64GB (2x32GB) 3200MHz CL16 Ripjaws V MB: Asus WS Z390 Pro Case: Fractal Design Define R6 Airflow: Intake: 2x140mm in the front & 1x 140mm in the back Out: 2x120 on the top through the CPU radiator. It seems like there is not enough airflow for 4090. Games sometimes crash. GPU is not overclocked. If I take the side panel off the GPU temps go down by 7 degrees celcius and I haven't encountered a crash with the side panel taken off. Did any of you have similar situations? Should I change my case?
  13. OK, I've found it. It was in a different place than I thought. But what's up with support not giving me this infomration? Weird... It's “Apple AQC113” I’ve found information that it is Marvell-Aquantia AQtion based NIC. So in prinicipal I agree with you on the sleep thing. I don't use sleep on my PC, but the Mac Studio is my wife's. She has her habbits and she just doesn't remember to turn it off, so if not for sleep the Mac Studio is going to be on almost 24h a day. Besides we are in 2022 and such simple things like having a computer in sleep mode shouldn't be a problem. I'd rather keep that dumb switch in between, than chase my wife each time to turn her computer off. Regarding the network settings - I've set up everything manually (IP, DNS, 1000baseT, full duplex, no flow control and no EEE). For the application that routes traffic - this has been ruled out, as I tested with a fresh "clean user" and also in safe mode.
  14. I had some issues with ethernet network performance. Basically each time Mac Studio (connected to 1Gbps ethernet to UDM SE) goes to sleep all other devices on the network have upload limit of 8-10Mbps. If it's on or off everything is fine, but as soon as it goes to sleep the port in UDM SE it is connected to via ethernet goes in "FE" mode and all devices on the network have a limit of upload at around 8-10Mbps. I've switched the network settings to manual and set it to full duplex 1Gbps without flow control and without EEE. That didn't help. I've tried creating a new "clean" user on that Mac and putting the computer to sleep as well as putting it to sleep in Safe boot mode - the result is the same. Regardless of the user or the safe boot mode as soon as the Mac Studio goes to sleep it's limiting the performance of the whole network. Just now I have found a workaround: instead of connecting the Mac Studio directly to the UDM SE, I've placed a "dumb" switch I had laying around. So now I have the Mac Studio connected to the switch and the switch is connected to the UDM SE and it seems like the problem is gone. I've leaft the Mac Studio asleep over the night and made a speed test go every 15 minutes to confirm it. And it is working fine. I still would like to find out a proper solution to this problem. I contacted Ubiquiti and they are asking for NIC model and driver version. I can't find it in the system information. I called Apple support and they told me that this is not a publicly accesible information (WTF?). Does any of you have an idea how to solve the problem or to find out NIC model?
  15. I have the latest firmware. I did factory reset and it made no change. I spent 2 hours setting up everything from scratch just to have it crap out after 4 days. I'm just going to sell it, maybe someone else way of using it won't trigger the problem. I've ordered UDM-SE with an AP, hopefully this will give me smooth experience.
×