This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
-
-
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.
* Create draft PR for #226 * Basic Serviceworker * Kleinere Anpassungen * Serviceworker version
- Loading branch information
Showing
11 changed files
with
226 additions
and
27 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
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 |
---|---|---|
|
@@ -32,4 +32,4 @@ DATABASE_URL="mysql://db:db@db:3306/db?serverVersion=mariadb-10.3.31" | |
###< doctrine/doctrine-bundle ### | ||
MailAccess_host="{sslin.df.eu/imap/ssl}INBOX" | ||
MailAccess_username="[email protected]" | ||
MailAccess_password="Foodwars#1" | ||
MailAccess_password="" |
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 |
---|---|---|
|
@@ -91,7 +91,9 @@ jobs: | |
echo 'EMAILPASS="${{ secrets.EMAILPASS }}"' >> .env.local | ||
echo 'EMAILUSER="[email protected]"' >> .env.local | ||
echo 'POBOX="{sslin.df.eu/imap/ssl}INBOX/"' >> .env.local | ||
echo 'SWVERSION="${{ steps.get_version.outputs.VERSION }}"' >> .env.local | ||
echo 'APP_VERSION="${{ steps.get_version.outputs.VERSION }}"' >> .env.local | ||
echo 'HT_USERNAME="${{ secrets.HT_USER }}"' >> .env.local | ||
echo 'HT_PASSWORD="${{ secrets.HT_PASS }}"' >> .env.local | ||
composer dump-env prod | ||
- name: Passwortschutz erstellen | ||
run: | | ||
|
@@ -135,7 +137,7 @@ jobs: | |
run: rm artifact.tar | ||
- run: sudo apt-get install -y sshpass rsync | ||
name: 📦 Installing upload dependencies | ||
- run: sshpass -p '${{ secrets.PASSWORD }}' rsync --exclude ".git" --exclude ".github" -e "ssh -o StrictHostKeyChecking=no -p 222" -rltzvOP --del --force ./ ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/usr/home/${{ secrets.USERNAME }}/public_html/hirsch | ||
- run: sshpass -p '${{ secrets.PASSWORD }}' rsync --exclude ".git" --exclude ".ddev" --exclude ".github" -e "ssh -o StrictHostKeyChecking=no -p 222" -rltzvOP --del --force ./ ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/usr/home/${{ secrets.USERNAME }}/public_html/hirsch | ||
id: upload | ||
name: 👨💻 Uploading files | ||
- run: sshpass -p '${{ secrets.PASSWORD }}' ssh -o StrictHostKeyChecking=no ${{ secrets.USERNAME }}@${{ secrets.HOST }} -p 222 -f "cd /usr/home/${{ secrets.USERNAME }}/public_html/hirsch && bin/console --no-interaction doctrine:migrations:migrate && bin/console --no-interaction cache:clear" | ||
|
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 |
---|---|---|
|
@@ -80,7 +80,7 @@ jobs: | |
echo 'EMAILPASS="${{ secrets.EMAILPASS }}"' >> .env.local | ||
echo 'EMAILUSER="[email protected]"' >> .env.local | ||
echo 'POBOX="{sslin.df.eu/imap/ssl}INBOX/"' >> .env.local | ||
echo 'SWVERSION="${{ steps.get_version.outputs.VERSION }}"' >> .env.local | ||
echo 'APP_VERSION="${{ steps.get_version.outputs.VERSION }}"' >> .env.local | ||
composer dump-env prod | ||
- name: Passwortschutz erstellen | ||
run: | | ||
|
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
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 @@ | ||
<?php | ||
|
||
namespace App\Service; | ||
|
||
class UtilityService | ||
{ | ||
/** | ||
* Generate an MD5 hash string from the contents of a directory. | ||
* | ||
* @param string $directory | ||
* @return boolean|string | ||
*/ | ||
public function hashDirectory($directory) | ||
{ | ||
if (!is_dir($directory)) { | ||
return false; | ||
} | ||
|
||
$files = array(); | ||
$dir = dir($directory); | ||
|
||
while (false !== ($file = $dir->read())) { | ||
if ($file != '.' and $file != '..') { | ||
if (is_dir($directory . '/' . $file)) { | ||
$files[] = $this->hashDirectory($directory . '/' . $file); | ||
} else { | ||
$files[] = md5_file($directory . '/' . $file); | ||
} | ||
} | ||
} | ||
|
||
$dir->close(); | ||
|
||
return md5(implode('', $files)); | ||
} | ||
} |
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
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,59 @@ | ||
var CACHE_NAME = '{{ version }}'; | ||
var urlsToCache = {{ urlsToCache | json_encode(constant('JSON_UNESCAPED_SLASHES')) | raw }}; | ||
self.addEventListener('install', function(event) { | ||
event.waitUntil( | ||
caches.open(CACHE_NAME) | ||
.then(function(cache) { | ||
console.log('Opened cache ' + CACHE_NAME); | ||
return cache.addAll(urlsToCache); | ||
}) | ||
); | ||
}); | ||
self.addEventListener('activate', function(event) { | ||
event.waitUntil( | ||
caches.keys().then(keys => { | ||
return Promise.all(keys.filter(key => key !== CACHE_NAME).map(key => caches.delete(key))) | ||
}) | ||
) | ||
}); | ||
self.addEventListener('fetch', function(event) { | ||
if (event.request.method === "GET") { | ||
event.respondWith( | ||
caches.match(event.request) | ||
.then(function(response) { | ||
var headers = {}; | ||
if (event.request.url.startsWith("https://hirsch.hochwarth-e.com/")) { | ||
Object.assign(headers, { Authorization: 'Basic {{ credentials.string | raw }}' }); | ||
} | ||
if (event.request.url.includes("get-")) { | ||
Object.assign(headers, { Accept: 'application/json' }); | ||
} | ||
|
||
const request = new Request(event.request, { headers }); | ||
// Cache hit - return response | ||
return response || fetch(request).catch(() => { | ||
let init; | ||
if (event.request.url.includes("get-tagesessen")) { | ||
init = {"status": 200, "statusText": "Dummy"}; | ||
return new Response('{"displayData": [], "file": ""}', init); | ||
} | ||
if (event.request.url.includes("modalInformationText")) { | ||
init = { "status": 418, "statusText": "I am a Teapot" }; | ||
return new Response("Du bist aktuell offline! Die angezeigten Daten sind unter Umständen nicht aktuell!", init); | ||
} | ||
if (event.request.url.includes("order-until")) { | ||
init = { "status": 200, "statusText": "Offline" }; | ||
return new Response("Du bist aktuell offline!", init); | ||
} | ||
return caches.match("/fallback.html") | ||
}); | ||
}) | ||
); | ||
} | ||
}); | ||
|
||
self.addEventListener('message', (event) => { | ||
if (event.data === 'SKIP_WAITING') { | ||
self.skipWaiting(); | ||
} | ||
}); |