-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from chourmovs/beta
Beta
- Loading branch information
Showing
3 changed files
with
124 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Déclenche le workflow à chaque push sur la branche "main" | ||
pull_request: | ||
branches: | ||
- main # Déclenche le workflow à chaque pull request vers la branche "main" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: yourdockerhubusername/blissify-webapp:latest | ||
|
||
- name: Image details | ||
run: docker images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
const express = require('express'); | ||
const { exec } = require('child_process'); | ||
const Client = require('ssh2').Client; | ||
const path = require('path'); | ||
const sftpUpload = require('sftp-upload'); | ||
|
||
const app = express(); | ||
app.use(express.static('public')); // Servir les fichiers statiques comme HTML, CSS, JS | ||
|
||
// Route pour rechercher la bibliothèque musicale | ||
app.get('/search-music', (req, res) => { | ||
// Implémentation pour rechercher la bibliothèque musicale | ||
exec('find /path/to/network -type d', (error, stdout, stderr) => { | ||
if (error) { | ||
return res.status(500).send(`Erreur: ${stderr}`); | ||
} | ||
res.send(stdout); // Retourne la liste des répertoires trouvés | ||
}); | ||
}); | ||
|
||
// Route pour lancer l'analyse | ||
app.get('/start-analysis', (req, res) => { | ||
const command = 'blissify init'; | ||
const analysis = exec(command); | ||
|
||
analysis.stdout.on('data', (data) => { | ||
res.write(data); | ||
}); | ||
|
||
analysis.stderr.on('data', (data) => { | ||
res.write(`Erreur: ${data}`); | ||
}); | ||
|
||
analysis.on('close', (code) => { | ||
res.end(`\nProcessus terminé avec le code: ${code}`); | ||
}); | ||
}); | ||
|
||
// Route pour chercher l'instance Volumio | ||
app.get('/search-volumio', (req, res) => { | ||
// Exécuter une commande pour scanner le réseau (exemple avec nmap) | ||
exec('nmap -p 22 --open -sV 192.168.1.0/24', (error, stdout, stderr) => { | ||
if (error) { | ||
return res.status(500).send(`Erreur: ${stderr}`); | ||
} | ||
// Analyser stdout pour trouver les instances Volumio | ||
const volumioInstance = stdout.match(/192\.168\.1\.\d+/); // exemple simple de regex | ||
res.send(volumioInstance ? volumioInstance[0] : 'Aucune instance Volumio trouvée'); | ||
}); | ||
}); | ||
|
||
// Route pour uploader le fichier song.db vers Volumio via SFTP | ||
app.post('/upload-songdb', (req, res) => { | ||
const conn = new Client(); | ||
const songDbPath = '/path/to/song.db'; // Remplacez par le chemin de votre song.db | ||
const remotePath = '/home/volumio/.local/share/bliss-rs/song.db'; | ||
|
||
conn.on('ready', () => { | ||
conn.sftp((err, sftp) => { | ||
if (err) throw err; | ||
sftp.fastPut(songDbPath, remotePath, (err) => { | ||
if (err) return res.status(500).send(`Erreur: ${err.message}`); | ||
res.send('Upload réussi!'); | ||
conn.end(); | ||
}); | ||
}); | ||
}).connect({ | ||
host: '192.168.1.100', // Adresse IP de l'instance Volumio trouvée | ||
port: 22, | ||
username: 'volumio', | ||
password: 'volumio' // Remplacez par le mot de passe correct | ||
}); | ||
}); | ||
|
||
const PORT = 3000; | ||
app.listen(PORT, () => { | ||
console.log(`Serveur en écoute sur le port ${PORT}`); | ||
}); |