Skip to content

Commit

Permalink
Merge pull request #24 from vincentberry/dev
Browse files Browse the repository at this point in the history
Various Improvements and Fixes
  • Loading branch information
vincentberry authored Aug 6, 2024
2 parents fcafbaa + 6e17fe4 commit 7da7b90
Show file tree
Hide file tree
Showing 64 changed files with 2,170 additions and 3,293 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/docker-image_demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: dockerhub_demo

on:
push:
branches:
- demo

jobs:

build:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- name: docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build the Docker image
run: docker build . --file Dockerfile --build-arg NODE_ENV=demo --tag vincentberry/vmix-remote:demo

- name: Docker Push
run: docker push --all-tags vincentberry/vmix-remote
5 changes: 3 additions & 2 deletions .github/workflows/docker-image_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
steps:

- uses: actions/checkout@v2

- name: docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
Expand All @@ -22,7 +23,7 @@ jobs:
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build the Docker image
run: docker build . --file Dockerfile --tag vincentberry/vmix-remote:dev
run: docker build . --file Dockerfile --build-arg NODE_ENV=dev --tag vincentberry/vmix-remote:dev

- name: Docker Push
run: docker push --all-tags vincentberry/vmix-remote
run: docker push --all-tags vincentberry/vmix-remote
31 changes: 16 additions & 15 deletions .github/workflows/docker-image_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ jobs:

steps:

- uses: actions/checkout@v2
- name: docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- uses: actions/checkout@v2

- name: docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build the Docker image
run: docker build . --file Dockerfile --build-arg NODE_ENV=prod --tag vincentberry/vmix-remote:latest

- name: Build the Docker image
run: docker build . --file Dockerfile --tag vincentberry/vmix-remote:latest

- name: Build the Docker image
run: docker build . --file Dockerfile --tag vincentberry/vmix-remote:$(date +%s)

- name: Docker Push
run: docker push --all-tags vincentberry/vmix-remote
- name: Build the Docker image
run: docker build . --file Dockerfile --build-arg NODE_ENV=prod --tag vincentberry/vmix-remote:$(date +%s)

- name: Docker Push
run: docker push --all-tags vincentberry/vmix-remote
16 changes: 15 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,18 @@
/app/file/
/app/db/
.vscode/
database.sqlite
database.sqlite

# Ignore les fichiers générés par SCSS
*.css
*.css.map

# Ignore les fichiers générés par Sass/SCSS
.sass-cache/
/app/public/assets/style
/app/public/assets/js


#npm ignore
/node_modules
package-lock.json
22 changes: 19 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
FROM node:14 AS build
ARG NODE_ENV
WORKDIR /build

COPY ./ /build

RUN npm install
RUN npm install typescript


RUN npm run build-${NODE_ENV}

FROM php:apache

ARG NODE_ENV
ENV COMPOSER_ALLOW_SUPERUSER=1

EXPOSE 80
Expand All @@ -18,9 +31,12 @@ RUN apt-get update -qq && \
RUN docker-php-ext-install -j$(nproc) opcache pdo_mysql

# Apache
COPY config/prod/apache2/conf-available/swag.conf /etc/apache2/conf-available/swag.conf
COPY /config/prod/apache2/sites-enabled /etc/apache2/sites-enabled/
COPY app/ /var/www/html/
COPY config/${NODE_ENV}/apache2/conf-available/swag.conf /etc/apache2/conf-available/swag.conf
COPY /config/${NODE_ENV}/apache2/sites-enabled /etc/apache2/sites-enabled/
COPY --from=build /build/app/ /var/www/html/
COPY app/src/inc/${NODE_ENV}/ /var/www/html/inc/

RUN rm -rf /var/www/html/src

RUN mkdir -p /var/www/html/file/
RUN mkdir -p /var/www/html/db/
Expand Down
22 changes: 19 additions & 3 deletions app/inc/header.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="fr">
<html lang="En">

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand All @@ -12,8 +13,8 @@
// <link rel="stylesheet" href="../css/fonts/Roboto-Regular.ttf">-->
<!--meta SEO-->
<meta name="description" content="">
<meta name="author" content="">
<meta name="description" content="Take full control of the vMix software remotely without the need to open ports on your network using our web application.">
<meta name="author" content="Vincent Berry">
<meta name="keyword" content="">
<title>REMOTE VMIX</title>
Expand All @@ -22,3 +23,18 @@
<link rel="stylesheet" type="text/css" href="./assets/style/index.css" />
</head>
<div class="info" id="Build_info_div" style="position: fixed; bottom: 0px; width: 100%; z-index: 111; opacity: 0.9;transition: opacity 0.5s ease; pointer-events: none; ">
<h2>No Build version</h2>
</div>
<script>
function showOverlay() {
const overlay = document.getElementById('Build_info_div');
overlay.style.opacity = '0.9'
setTimeout(function() {
overlay.style.opacity = '0'
}, 10000); // 10 secondes
}
// Appeler la fonction pour afficher l'overlay toutes les 1 minute
setInterval(showOverlay, 30000); // 30 secondes
</script>
89 changes: 43 additions & 46 deletions app/inc/vmix_script.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,56 @@
Dim u As String = "xml"
Dim p As String = "pvmix"
Do While True
Dim stateon As String = "NOTCONNECTED"
Dim state As String = "CONNECTED"
Dim xml As String = API.XML()
Dim W As New Net.WebClient
Dim NC As New System.Collections.Specialized.NameValueCollection
NC.Add("xml",xml)
Dim R As String
Dim con As String = userurl
NC.Add("connector",useraccountcode)
NC.Add("session_delay",session_delay)
NC.Add("STATE",state)
Dim RESP As Byte()
Dim conected As String = userurl & p & u
Try
RESP = W.UploadValues(con, NC)
R = System.Text.Encoding.ASCII.GetString(RESP)
Dim rawCommand As string = R
' Afficher la réponse
Dim stateon As String = "NOTCONNECTED"
Dim state As String = "CONNECTED"
Dim xml As String = API.XML()
Dim W As New Net.WebClient
Dim NC As New System.Collections.Specialized.NameValueCollection
NC.Add("xml",xml)
Dim R As String
Dim con As String = userurl
NC.Add("connector",useraccountcode)
NC.Add("session_delay",session_delay)
NC.Add("STATE",state)
Dim RESP As Byte()
Dim docXml As New XmlDocument()
Dim conected As String = userurl & p & u
Try
RESP = W.UploadValues(con, NC)
R = System.Text.Encoding.UTF8.GetString(RESP)
Dim rawCommand As string = R

' Diviser la chaîne en un tableau en utilisant |serpare| comme délimiteur
Dim commands As String() = rawCommand.Split("!"c)
Dim command
' Parcourir chaque commande dans le tableau
For Each command In commands
Dim commandParts As String() = command.Split("~"c)
If commandParts.Length = 6 Then
Dim functionType As String = commandParts(0).Trim()
Dim inputParam As String = commandParts(1).Trim()
Dim valueParam As String = commandParts(2).Trim()
Dim durationParam As String = commandParts(3).Trim()
Dim selectedNameParam As String = commandParts(4).Trim()
Dim selectedIndexParam As String = commandParts(5).Trim()
' Appeler la fonction VMix avec les paramètres appropriés
API.Function(functionType, Input:=inputParam, Value:=valueParam, Duration:=durationParam, selectedName:=selectedNameParam, selectedIndex:=selectedIndexParam)
docXml.LoadXml(R)
Dim XmlNode As XmlNode = docXml.DocumentElement

' Diviser la chaîne en un tableau en utilisant |serpare| comme délimiteur
Dim command As Object
For Each command In XmlNode.SelectNodes("/commands/command")
'Console.WriteLine(command.SelectSingleNode("functionType").InnerText)
Dim functionType As String = command.SelectSingleNode("functionType").InnerText
Dim inputParam As String = command.SelectSingleNode("inputParam").InnerText
Dim valueParam As String = command.SelectSingleNode("valueParam").InnerText
Dim durationParam As String = command.SelectSingleNode("durationParam").InnerText
Dim selectedNameParam As String = command.SelectSingleNode("selectedNameParam").InnerText
Dim selectedIndexParam As String = command.SelectSingleNode("selectedIndexParam").InnerText

API.Function(functionType, Input:=inputParam, Value:=valueParam, Duration:=durationParam, selectedName:=selectedNameParam, selectedIndex:=selectedIndexParam)

If functionType = "session_delay" Then
session_delay = valueParam
session_delay = valueParam
Console.WriteLine("Update delay: " & session_delay)
End If

'Console.WriteLine(functionType)
Elseif Not String.IsNullOrEmpty(rawCommand) Then
'Console.WriteLine(rawCommand)
Else
'Console.WriteLine("La commande VMix est mal formée.")
End If
Next
Next command

Catch ex As Exception
Console.WriteLine("Error: " & ex.Message)
End Try

catch
End Try
Dim StringValue As String = conected & userurl & R
sleep(session_delay)
Dim StringValue As String = conected & userurl & R
sleep(session_delay)
Loop
' ---------------------------------------------------
' -------------------- VMIX REMOTE ------------------
Expand Down
17 changes: 13 additions & 4 deletions app/public/api/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,25 @@
$duration = $item["duration"];
$selectedName = $item["selectedName"];
$selectedIndex = $item["selectedIndex"];
// Accéder aux valeurs individuelles
$envoi_vmix = $envoi_vmix . "$command~ $input~ $value~ $duration~ $selectedName~ $selectedIndex!";

// Build the XML command string
$envoi_vmix .= '<command> ';
$envoi_vmix .= '<functionType>' . $command . '</functionType>';
$envoi_vmix .= '<inputParam>' . $input . '</inputParam>';
$envoi_vmix .= '<durationParam>' . $duration . '</durationParam>';
$envoi_vmix .= '<selectedNameParam>' . $selectedName . '</selectedNameParam>';
$envoi_vmix .= '<selectedIndexParam>' . $selectedIndex . '</selectedIndexParam>';
$envoi_vmix .= '<valueParam>' . $value . '</valueParam>';
$envoi_vmix .= '</command>';

db_insert::delete_vmix_command($item["id"]);

}

echo $envoi_vmix;
echo '<commands>' . $envoi_vmix . '</commands>';
die();
}
echo "Pas de nouvelle command";
echo "<message>No new order</message>";
die();
}
}
Expand Down
Loading

0 comments on commit 7da7b90

Please sign in to comment.