]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Sun, 25 Oct 2020 16:38:14 +0000 (17:38 +0100)
committerVincent <vincent@enhydra.fr>
Sun, 25 Oct 2020 16:38:14 +0000 (17:38 +0100)
.idea/workspace.xml
js/webapp.js
scripts/lib/netflix.php [new file with mode: 0644]
scripts/lib/scenes.php
service-worker.js

index 2b6fd88b5cc66779c15105384969a8ce60101602..dfb5bbd568d63de66f73378316f1362a6a436468 100644 (file)
@@ -2,13 +2,10 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change afterPath="$PROJECT_DIR$/offline.html" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/service-worker.js.template" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/scripts/lib/netflix.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/js/home.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/home.js" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/js/jquery.min.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/jquery.min.js" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/js/webapp.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/webapp.js" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/manifest.php" beforeDir="false" afterPath="$PROJECT_DIR$/manifest.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/service-worker.js" beforeDir="false" afterPath="$PROJECT_DIR$/service-worker.js" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
       <workItem from="1602862886793" duration="1014000" />
       <workItem from="1603095373591" duration="1368000" />
       <workItem from="1603270756890" duration="3366000" />
-      <workItem from="1603558842019" duration="7205000" />
-    </task>
-    <task id="LOCAL-00304" summary=".">
-      <created>1582104447675</created>
-      <option name="number" value="00304" />
-      <option name="presentableId" value="LOCAL-00304" />
-      <option name="project" value="LOCAL" />
-      <updated>1582104447675</updated>
+      <workItem from="1603558842019" duration="12945000" />
     </task>
     <task id="LOCAL-00305" summary=".">
       <created>1582130758226</created>
       <option name="project" value="LOCAL" />
       <updated>1603560834622</updated>
     </task>
-    <option name="localTasksCounter" value="353" />
+    <task id="LOCAL-00353" summary=".">
+      <created>1603626112636</created>
+      <option name="number" value="00353" />
+      <option name="presentableId" value="LOCAL-00353" />
+      <option name="project" value="LOCAL" />
+      <updated>1603626112636</updated>
+    </task>
+    <option name="localTasksCounter" value="354" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="872" y="161" key="#Plugins/0.0.2560.1040@0.0.2560.1040" timestamp="1596008801840" />
-    <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2" timestamp="1603560831635">
+    <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2" timestamp="1603626109154">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="701" y="75" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1602171117745" />
-    <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1603560831635" />
-    <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1602146675515">
+    <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1603626109154" />
+    <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1603637447680">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
-    <state x="1114" y="443" key="NewPhpFileDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1602146675515" />
+    <state x="1114" y="443" key="NewPhpFileDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1603637447680" />
     <state x="781" y="165" key="SettingsEditor" timestamp="1596008871908">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
index b504b2e59078c7c070cc1715cbd7c0c944065780..f3d6047bbdabfe02c68ba2232f54607789ac566b 100644 (file)
@@ -34,6 +34,6 @@ function installapp() {
 if ('serviceWorker' in navigator) {
     window.addEventListener('load', function() {
         console.log('👍', 'navigator.serviceWorker is supported');
-        navigator.serviceWorker.register('/service-worker.js.template');
+        navigator.serviceWorker.register('/service-worker.js');
     });
 }
diff --git a/scripts/lib/netflix.php b/scripts/lib/netflix.php
new file mode 100644 (file)
index 0000000..4a937b2
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+function netflixWatch($id, $device = null)
+{
+    sshCommand('/usr/bin/chromium-browser --kiosk --user-agent="Mozilla/5.0 (X11; CrOS armv7l 12371.89.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36" https://www.netflix.com/fr/login?nextpage=' . rawurldecode('https://www.netflix.com/SwitchProfile?tkn=3T22ISQ4C5D35OFFDZCBRKGBSI'), $device, false, false);
+
+    sshCommand('/usr/bin/chromium-browser --kiosk --user-agent="Mozilla/5.0 (X11; CrOS armv7l 12371.89.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36" https://www.netflix.com/fr/login?nextpage=' . rawurldecode('https://www.netflix.com/SwitchProfile?tkn=3T22ISQ4C5D35OFFDZCBRKGBSI'), $device, false, false);
+}
\ No newline at end of file
index a92d4d3ec14079d4d034e80a384a7361ba58cdc4..2a046d15d01a9912a3bde004575206433b5fee60 100644 (file)
@@ -384,10 +384,10 @@ $scenes = [
         ['type' => 'function', 'function' => 'wakeupPC', 'args' => ['avion']],
     ],
     'bureau/l61/on' => [
-        ['type' => 'domoticz', 'device' => '2074', 'command' => true],
+        ['type' => 'domoticz', 'device' => '2074', 'command' => true, 'priority' => true],
     ],
     'bureau/l61/off' => [
-        ['type' => 'domoticz', 'device' => '2074', 'command' => false],
+        ['type' => 'domoticz', 'device' => '2074', 'command' => false, 'priority' => true],
     ],
     'bureau/lumineux' => [
         ['type' => 'scene', 'scene' => 'bureau/l61/on'],
@@ -738,7 +738,7 @@ function execScene($name, $fromUserAction = false, $transitionTime = null)
         }
 
         if ($action['type'] == 'hue') {
-            hueCommand($action,$transitionTime);
+            hueCommand($action, $transitionTime);
         } else if ($action['type'] == 'insteon') {
             insteonCommand($action['command']);
         } else if ($action['type'] == 'delay' || $action['type'] == 'scene') {
index bea63d7b998e359d2cb41e1373211eeefaa4e289..4ad1a6c50997054108f34fa263a85031cb955155 100644 (file)
@@ -1,67 +1,14 @@
-const CACHE_NAME = 'mpwa-cache-v1';
-const urlsToCache = ['./', 'index.php'];
-
-// Listen for the install event, which fires when the service worker is installing
-self.addEventListener('install', event => {
-    // Ensures the install event doesn't complete until after the cache promise resolves
-    // This is so we don't move on to other events until the critical initial cache is done
-    event.waitUntil(
-        // Open a named cache, then add all the specified URLs to it
-        caches.open(CACHE_NAME).then(cache => cache.addAll(urlsToCache))
-    );
+self.addEventListener('install', (event) => {
+    console.log('👷', 'install', event);
+    self.skipWaiting();
 });
 
-// Listen for the activate event, which is fired after installation
-// Activate is when the service worker actually takes over from the previous
-// version, which is a good time to clean up old caches
-self.addEventListener('activate', event => {
-    console.log('Finally active. Ready to serve!');
-    event.waitUntil(
-        // Get the keys of all the old caches
-        caches
-            .keys()
-            // Ensure we don't resolve until all the promises do (i.e. each key has been deleted)
-            .then(keys =>
-                Promise.all(
-                    keys
-                        // Remove any cache that matches the current cache name
-                        .filter(key => key !== CACHE_NAME)
-                        // Map over the array of old cache names and delete them all
-                        .map(key => caches.delete(key))
-                )
-            )
-    );
+self.addEventListener('activate', (event) => {
+    console.log('👷', 'activate', event);
+    return self.clients.claim();
 });
 
-// Listen for browser fetch events. These fire any time the browser tries to load
-// any outside resources
-self.addEventListener('fetch', function (event) {
-    // This lets us control the response
-    // We pass in a promise that resolves with a response object
-    event.respondWith(
-        // Check whether we have a matching response for this request in our cache
-        caches.match(event.request).then(response => {
-            // It's in the cache! Serve the response straight from there
-            if (response) {
-                console.log('Serving response from the cache');
-                return response;
-            }
-            // If it's not in the cache we make a fetch request for the resource
-            return (
-                fetch(event.request)
-                    // Then we open our cache
-                    .then(response => caches.open(CACHE_NAME))
-                    // Then we put the request into the cache, so we have it offline next time
-                    .then(cache => {
-                        // We have to clone the response as response streams can only be read once
-                        // This way we can put one copy in the cache and return the other to the browser
-                        cache.put(event.request, response.clone());
-                        return response;
-                    })
-                    .catch(response => {
-                        console.log('Fetch failed, sorry.');
-                    })
-            );
-        })
-    );
-});
+// self.addEventListener('fetch', function(event) {
+//     // console.log('👷', 'fetch', event);
+//     event.respondWith(fetch(event.request));
+// });
\ No newline at end of file