Open frickler24 opened 7 years ago
Hello and welcome! Electron, which seems hard to install easily, is used only to keep phpCorsair running on the background. It can work in chrome/chromium browser as well. This is how I made it. So, from the folder, it can works by opening index.html with chrome/chromium, on this case node/electron isn't needed at all. It will ask for your audio input, the goal is to adjust the input of your sound card on the «main mix». daemon.php should stay on the same folder. That should be all. (if php+ckb-daemon are installed) Beside this, i keep your comment on good note, and will try to make a one click simple install, maybe without electron, a simpler way to push new features. Let me know!
The making off video, it was an early stage, there is new features since. https://www.youtube.com/watch?v=H7mKN2PASGM ;)
OK, running the gui as described in the browser is ok. It tries to open an microphone, but currently I do not have one. I'll will have a look later on it.
Today I was wandering, why my apache log file was getting bigger and bigger: It was the implementation of the html script, running in chrome for a while. You reference the daemon.php in an absolute way: /daemon.php is not present, so the apache will throw an error. I copied all files in the default directory of the apache to check, if I'm right. With this, I get some blinking in the keyboard (yeah :-)). But there are still error messages in the apache logfile:
22.01.03 17:13 6 [client 127.0.0.1:54944] PHP Notice: Undefined index: HTTP_ORIGIN in /var/www/html/daemon.php on line 2, referer: http://localhost/?
22.01.22 17:12 5 [client 127.0.0.1:54928] PHP Notice: Undefined index: HTTP_ORIGIN in /var/www/html/daemon.php on line 2, referer: http://localhost/?
22.01.25 12:57 73 [client 127.0.0.1:52144] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 225, referer: http://localhost/?
22.01.25 12:57 73 [client 127.0.0.1:52144] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 230, referer: http://localhost/?
22.01.25 17:13 6 [client 127.0.0.1:54944] PHP Notice: Undefined index: HTTP_ORIGIN in /var/www/html/daemon.php on line 2, referer: http://localhost/?
22.01.48 17:13 6 [client 127.0.0.1:54944] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 225, referer: http://localhost/?
22.01.48 17:13 6 [client 127.0.0.1:54944] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 230, referer: http://localhost/?
22.01.48 17:13 1 [client 127.0.0.1:54946] PHP Notice: Undefined index: HTTP_ORIGIN in /var/www/html/daemon.php on line 2, referer: http://localhost/?
22.01.62 17:13 6 [client 127.0.0.1:54944] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 225, referer: http://localhost/?
22.01.62 17:13 6 [client 127.0.0.1:54944] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 230, referer: http://localhost/?
22.01.63 17:12 5 [client 127.0.0.1:54928] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 225, referer: http://localhost/?
22.01.63 17:12 5 [client 127.0.0.1:54928] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 230, referer: http://localhost/?
22.01.80 17:13 1 [client 127.0.0.1:54946] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 225, referer: http://localhost/?
22.01.81 17:13 1 [client 127.0.0.1:54946] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 230, referer: http://localhost/?
22.01.05 12:57 5 [client 127.0.0.1:52136] PHP Notice: Undefined index: HTTP_ORIGIN in /var/www/html/daemon.php on line 2, referer: http://localhost/?
22.01.11 12:57 74 [client 127.0.0.1:52142] PHP Notice: Undefined index: HTTP_ORIGIN in /var/www/html/daemon.php on line 2, referer: http://localhost/?
22.01.21 12:57 74 [client 127.0.0.1:52142] PHP Notice: Undefined index: HTTP_ORIGIN in /var/www/html/daemon.php on line 2, referer: http://localhost/?
22.01.41 12:57 5 [client 127.0.0.1:52136] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 225, referer: http://localhost/?
22.01.41 12:57 5 [client 127.0.0.1:52136] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 230, referer: http://localhost/?
22.01.45 12:57 73 [client 127.0.0.1:52144] PHP Notice: Undefined index: HTTP_ORIGIN in /var/www/html/daemon.php on line 2, referer: http://localhost/?
22.01.47 12:57 74 [client 127.0.0.1:52142] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 225, referer: http://localhost/?
22.01.47 12:57 74 [client 127.0.0.1:52142] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 230, referer: http://localhost/?
22.01.67 12:57 74 [client 127.0.0.1:52142] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 225, referer: http://localhost/?
22.01.67 12:57 74 [client 127.0.0.1:52142] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 230, referer: http://localhost/?
22.01.76 17:13 6 [client 127.0.0.1:54944] PHP Notice: Undefined index: HTTP_ORIGIN in /var/www/html/daemon.php on line 2, referer: http://localhost/?
22.01.84 12:57 73 [client 127.0.0.1:52144] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 225, referer: http://localhost/?
22.01.84 12:57 73 [client 127.0.0.1:52144] PHP Notice: Undefined index: mode in /var/www/html/daemon.php on line 230, referer: http://localhost/?
22.01.95 17:13 6 [client 127.0.0.1:54944] PHP Notice: Undefined index: HTTP_ORIGIN in /var/www/html/daemon.php on line 2, referer: http://localhost/?
22.01.99 17:12 5 [client 127.0.0.1:54928] PHP Notice: Undefined index: HTTP_ORIGIN in /var/www/html/daemon.php on line 2, referer: http://localhost/?
So two questions: Is there an initialization file? Do you use shell-vars for setting a path?
You are on the way, apologizes, i know all this is confusing (but interesting=). There is no need of apache or any web server, as php himself act as a server. (This is called php cli method). Let's say you start from a blank folder from anywhere, if the file daemon.php is aside the index.html, this is fine. The html/js will send ajax commands directly to the daemon.php on the same root folder. This way there is no servers, few dependencies and isn't opened to the web. you can as well modify the path to use the localhost and apache, it will works too. If you are interested on how are constructed the ajax commands, and also see if there is maybe some errors messages, you can open the «network» tab of the inspect tools of chromium.
About your questions. 1/ No, not really. I will do, if you are stuck. 2/ Yes, see the daemon.pĥp file. All commands are finally sent to the ckb daemon, that is located in the folder /dev/input/ckb1/cmd
Thanks!
Are you sure that we have the same code base? In your branch master 0c9d506 and file phpCorsair.js beginning with line 82 you can find the absolute URL as I wrote above:
var pwnyUrl = "http://localhost/daemon.php?eqdata="+pwnyFreqbars+"&eq1="+pwnyFreq[2]+
"&eq2="+pwnyFreq[6]+"&eq3="+pwnyFreq[12]+"&eq4="+pwnyFreq[16]+"&eq5="+pwnyFreq[19]+
"&eq6="+pwnyFreq[24]+"&eq7="+pwnyFreq[28]+"&eq8="+pwnyFreq[32]+
"&eqbColor="+eqBcol+
"&eqhColor="+eqHcol+
"&eqoColor="+eqOcol+
"&eqfps="+eqfps+
// Math.floor(Math.random() * 1) + 1+
"&rainRate="+rainbowRatio+
"&matrix="+matrixSwitch+
"&pot="+Math.floor(Math.random() * 6) + 1+
"&rand="+pwnRand
xhttp.open("GET", pwnyUrl, true)
xhttp.send();
First you set pwnyUrl to an absolute value, then you make the AJAX call. That's why this won't run. Plz have a look, whether you pushed the correct code version to git.
Because I found some other specialities in the code (lot of wrong var use in daemon.php), I assume that this is not your last version.
You may be right about versions, i am pushing a simpler version. Now online.
Following some testings, i completly wipeout electron. To deploy and test:
svn checkout https://github.com/webdev23/phpCorsair/ && cd phpCorsair/trunk && chromium-browser --app=http://localhost:9040/phpcorsair! | php -S localhost:9040
I don't want to install a svn. Could you please build it for git?
@frickler24 Sure! Here you go!
> git init && git pull https://github.com/webdev23/phpCorsair.git && chromium-browser --app=http://localhost:9040/phpcorsair! | php -S localhost:9040
On this case, it avoid to init a folder, but it stay the same as if you download the archive To run from the folder:
chromium-browser --app=http://localhost:9040/phpcorsair! | php -S localhost:9040
The chromium-browser isn't mandatory, as the new coming Firefox versions works too (tested with Firefox dev edition 52) . This said, electron was useful because it was allowing background throttling, meaning the audio effects don't stop if the window is unfocused.
Note if you want to run it as a daemon (so the terminal can be closed), just add nohup &, like this, to start from the folder:
nohup chromium-browser --app=http://localhost:9040/phpcorsair! | nohup php -S localhost:9040 &
In case of trouble: gksudo killall php
Cheers!
So, here I am :-) Responding to your hint: npm was installed,
»npm« ist bereits die neuste Version (3.5.2-0ubuntu4)
. When running the rainbow demo manually, all is fine.