79302384

Date: 2024-12-23 07:02:11
Score: 0.5
Natty:
Report link

To make this work, I need these three steps:

Ports

npm run dev must not only open port 5173 on localhost, but on all addresses. This is done with a change in vite.config.ts:

import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
  plugins: [sveltekit()],
  server: { host: '0.0.0.0', port: 5173 }
});

Browser settings

On the (Chrome) browser of the phone or tablet open

chrome://flags/#unsafely-treat-insecure-origin-as-secure 

and set it to the IP address of svkitdev in your network

http://192.168.179.41:5173

Cookies

This requires a hack in the Sveltekit code. In node_modules@sveltejs\kit\src\runtime\server\cookie.js change

/** @type {import('cookie').CookieSerializeOptions} */
const defaults = {
    httpOnly: true,
    sameSite: 'lax',
    secure: false // MUH url.hostname === 'localhost' && url.protocol === 'http:' ? false : true
};
Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Michael Uhlenberg