WIP: neutralino

This commit is contained in:
Julien Maille 2026-02-10 13:44:20 +01:00
parent fc1bc066d2
commit 1e19b3026c
7 changed files with 30 additions and 17 deletions

View file

@ -37,27 +37,27 @@ jobs:
with:
fetch-depth: 1
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
node-version: '20'
cache: 'npm'
bun-version: latest
- name: Install dependencies
run: npm install
run: bun install
- name: Download Neutralino binaries
run: npx neu update
run: bun x neu update
- name: Build application
run: npm run build:desktop
run: bun run build
- name: Prepare Release
run: |
mkdir release
cp dist/Monochrome/resources.neu release/
cp neutralino.config.json release/
cp -r extensions release/
# Extensions are already copied to dist/Monochrome/extensions by postbuild
cp -r dist/Monochrome/extensions release/
cp dist/Monochrome/${{ matrix.binary_source }} release/${{ matrix.binary_dest }}
shell: bash

BIN
.gitignore vendored

Binary file not shown.

View file

@ -239,9 +239,21 @@ async function disablePwaForAuthGate() {
document.addEventListener('DOMContentLoaded', async () => {
// Initialize desktop environment (Neutralino)
const isDesktop = typeof window !== 'undefined' && (window.NL_MODE || window.location.port === '5050');
const urlParams = new URLSearchParams(window.location.search);
const hasNLParams = urlParams.has('NL_PORT') || urlParams.has('NL_TOKEN');
const isDesktop = typeof window !== 'undefined' && (window.NL_MODE || window.location.port === '5050' || hasNLParams);
if (typeof window !== 'undefined') {
const nlGlobals = Object.keys(window).filter(k => k.startsWith('NL_'));
console.log('[App] Environment Check:', {
isDesktop,
port: window.location.port,
hasNLParams,
nlGlobals
});
}
if (typeof window !== 'undefined' && window.Neutralino) {
console.log('[App] Neutralino object detected. Environment:', isDesktop ? 'Desktop' : 'Web');
if (isDesktop) {
console.log('[App] Initializing Neutralino desktop environment...');
try {
@ -411,7 +423,7 @@ document.addEventListener('DOMContentLoaded', async () => {
// Initialize tracker
initTracker(player);
if (typeof window !== 'undefined' && window.Neutralino && (window.NL_MODE || window.location.port === '5050')) {
if (typeof window !== 'undefined' && window.Neutralino && isDesktop) {
console.log('[App] Starting Discord RPC...');
initializeDiscordRPC(player);
}

View file

@ -6,7 +6,7 @@
"description": "Lossless music streaming",
"version": "1.0.0",
"defaultMode": "window",
"documentRoot": "www/",
"documentRoot": "dist/",
"url": "https://monochrome.tf",
"enableServer": true,
"enableNativeAPI": true,
@ -32,7 +32,7 @@
"port": 5050,
"cli": {
"binaryName": "Monochrome",
"resourcesPath": "www/",
"resourcesPath": "dist/",
"binaryVersion": "6.5.0",
"clientVersion": "6.5.0"
},

View file

@ -6,8 +6,8 @@
"main": "sw.js",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:desktop": "vite build --mode neutralino && npx neu build && node -e \"const fs = require('fs'); fs.cpSync('extensions', 'dist/Monochrome/extensions', {recursive: true}); fs.copyFileSync('neutralino.config.json', 'dist/Monochrome/neutralino.config.json')\"",
"build": "vite build --mode neutralino && bun x neu build",
"postbuild": "node -e \"const fs = require('fs'); const path = require('path'); const src = 'extensions'; const dest = path.join('dist', 'Monochrome', 'extensions'); if (fs.existsSync(src)) { fs.mkdirSync(dest, { recursive: true }); fs.cpSync(src, dest, { recursive: true }); console.log('Extensions manually copied to ' + dest); }\"",
"preview": "vite preview",
"start": "vite preview",
"lint:js": "eslint .",

1
public/neutralino.js Normal file

File diff suppressed because one or more lines are too long

View file

@ -9,8 +9,8 @@ export default defineConfig(({ mode }) => {
return {
base: './',
build: {
outDir: IS_NEUTRALINO ? 'www' : 'dist',
emptyOutDir: IS_NEUTRALINO,
outDir: 'dist',
emptyOutDir: true,
},
plugins: [
IS_NEUTRALINO && neutralino(),