diff --git a/.gitignore b/.gitignore index e19effa7694175b6d34c9bb29e201533fd94426e..3dae370c8639d702779ef4df556a4a0cc5503ec5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,8 @@ public/js/ .sass-cache/ #node cache -node_modules/ \ No newline at end of file +node_modules/ + +#composer +public/API/vendor +public/API/composer.lock \ No newline at end of file diff --git a/public/API/composer.json b/public/API/composer.json new file mode 100644 index 0000000000000000000000000000000000000000..77abbce4edac16b908bf7147da901dd36b34abaf --- /dev/null +++ b/public/API/composer.json @@ -0,0 +1,6 @@ +{ + "require": { + "aws/aws-sdk-php": "^3.181", + "symforge/chilkat-php": "9.5.0.66" + } +} diff --git a/public/API/getFile.php b/public/API/getFile.php new file mode 100644 index 0000000000000000000000000000000000000000..4004bfde78111af430aae4a1d289984135ca1455 --- /dev/null +++ b/public/API/getFile.php @@ -0,0 +1,27 @@ +<?php +include("./lib/config.php"); +require 'vendor/autoload.php'; + +$s3Client = new Aws\S3\S3Client([ + 'version' => 'latest', + 'region' => 'us-east-1', + 'endpoint' => $S3Server, + 'use_path_style_endpoint' => true, + 'credentials' => [ + 'key' => $S3AccessKey, + 'secret' => $S3SecretKey, + ], +]); + +// Get a command object from the client +$command = $s3Client->getCommand('GetObject', [ + 'Bucket' => $S3BucketName, + 'Key' => $_GET["filename"] +]); + +// Create a pre-signed URL for a request with duration of 10 miniutes +$presignedRequest = $s3Client->createPresignedRequest($command, '60 minutes'); + +// Get the actual presigned-url +$downloadURL = (string) $presignedRequest->getUri(); +header("Location: $downloadURL"); \ No newline at end of file diff --git a/public/API/lib/config.example.php b/public/API/lib/config.example.php index 122ba44bf0f86c332990f774b7e04b4bd51c47ae..c9ff18703beb6322b357acb6dc1f8bfcb9036bbb 100644 --- a/public/API/lib/config.example.php +++ b/public/API/lib/config.example.php @@ -14,3 +14,8 @@ $footerMaxPost = 5; $homeMaxPost = 3; $trackURL = ""; + +$S3Server = ""; +$S3AccessKey = ""; +$S3SecretKey = ""; +$S3BucketName = ""; \ No newline at end of file diff --git a/public/Projekte/URLkuerzer1.html b/public/Projekte/URLkuerzer1.html index 946ac01e1c975e5c946b96db19650dcfe28206ee..39abb2a017651ea42964dac8b8aee73cbbf92a7c 100644 --- a/public/Projekte/URLkuerzer1.html +++ b/public/Projekte/URLkuerzer1.html @@ -32,7 +32,7 @@ blieb gleich wie vorher, dass heißt die alten links bleiben weiterhin bestehen und werden auch in Zukunft noch funktionieren. Eine weitere Anpassung, welche noch gemacht werden muss ist, dass er files Ordner auf einen anderen (sub)domain ausgelagert werden muss und in der index.php angepasst werden muss.</p><br> - <a href="/files/shorter.zip"> + <a href="/API/getFile.php?filename=shorter.zip"> <button>Download</button> </a> <h2>Kommentare:</h2> diff --git a/public/Projekte/blitzortung.html b/public/Projekte/blitzortung.html index 26fb8fc6148ca8449bddb0543614fbae4d4da402..2d3ad2254f9aa062e848e9ab7f3832f812dc03e6 100644 --- a/public/Projekte/blitzortung.html +++ b/public/Projekte/blitzortung.html @@ -18,8 +18,8 @@ <p> </p> <h2>Update 1:</h2> <p>Da Google für seine Karten auf eigenen Websites seit dem 16.Juli Geld verlangt habe ich die Karte auf leaflet umgeschrieben, welche die OSM Karten von Mapbox bezieht.</p><br> - <a href="/files/blitzortung.zip"><button>Download V1</button></a> - <a href="/files/blitzortung_v2.zip"><button>Download V2</button></a> + <a href="/API/getFile.php?filename=blitzortung.zip"><button>Download V1</button></a> + <a href="/API/getFile.php?filename=blitzortung_v2.zip"><button>Download V2</button></a> <h2>Kommentare:</h2> <jl-comments_display></jl-comments_display> diff --git a/public/Projekte/insecam.html b/public/Projekte/insecam.html index cc681e91928978a35acc5da5ee6a32616d0ee29d..51da2cf64d925037a6ba445c52ee68f1197fde5c 100644 --- a/public/Projekte/insecam.html +++ b/public/Projekte/insecam.html @@ -30,9 +30,9 @@ Websites einzubinden. Man kann zwar seine Kreditkarte hinterlegen und bekommt jeden Monat 200$, dies wollte ich aber nicht. Daher habe ich die Karte umgeschrieben. Sie setzt jetzt auf die Kartenbibliothek leaflet, welche auf die OpenStreetMap Karten von Mapbox zurückgreift.</p><br> - <a href="/files/insecam.zip"> + <a href="/API/getFile.php?filename=insecam.zip"> <button>Download V1</button> - </a> <a href="/files/Insecam_v2.zip"> + </a> <a href="/API/getFile.php?filename=Insecam_v2.zip"> <button>Download V2</button> </a><br> <p>Alte Karte mit Google Maps:</p> diff --git a/public/Projekte/mqttpush.html b/public/Projekte/mqttpush.html index d1b8a1b1d84098c589d53397a4e196b16cd243bd..c0d3612cc96c89948731f944c0683a6775bd1f2b 100644 --- a/public/Projekte/mqttpush.html +++ b/public/Projekte/mqttpush.html @@ -15,7 +15,7 @@ können auch mehrere gleichzeitig betrieben werden. Der quellcode ist auf meinem Git Server unter <a href="https://gitlab.jonasled.de/jonasled/MQTT_Push">https://gitlab.jonasled.de/jonasled/MQTT_Push</a> zu finden. Desweiteren habe ich unten einen installer angehängt.</p> - <a href="/files/MQTT_Message.zip"> + <a href="/API/getFile.php?filename=MQTT_Message.zip"> <button>Download</button> </a><br> <img src="/img/MQTT-push.png"> diff --git a/public/Projekte/smartmirror.html b/public/Projekte/smartmirror.html index 3ff73882c7edf8871a38573a68c4c300963a19d5..6ef197cbf77f1660c6722174f91daab0ea934ffc 100644 --- a/public/Projekte/smartmirror.html +++ b/public/Projekte/smartmirror.html @@ -30,7 +30,7 @@ href="https://glancr.de/smart-mirror-selbst-bauen/"> https://glancr.de/smart-mirror-selbst-bauen/</a></p> <p>Den Quellcode von meiner Software findet ihr natürlich wieder auf meinem <a href="https://gitlab.jonasled.de/jonasled/SmartMirror">Git Server</a></p><br> - <a href="/files/SmartMirror.zip"> + <a href="/API/getFile.php?filename=SmartMirror.zip"> <button>Download</button> </a><br><br> <img src="/img/Spiegel.jpg"> diff --git a/public/Projekte/snowboy.html b/public/Projekte/snowboy.html index f235e1bf1dbdef8c1d3a230e855f65494b1572d2..6be63ec7e1900424fecb5366ced2289591b7b38f 100644 --- a/public/Projekte/snowboy.html +++ b/public/Projekte/snowboy.html @@ -29,7 +29,7 @@ wget http://downloads.sourceforge.net/swig/swig-3.0.12.tar.gz tar -xovzf swig-3.0.12.tar.gz cd swig-3.0.12 -wget https://sourceforge.net/projects/pcre/files/pcre/8.42/pcre-8.42.tar.gz +wget https://sourceforge.net/projects/pcre/API/getFile.php?filename=pcre/8.42/pcre-8.42.tar.gz ./Tools/pcre-build.sh ./autogen ./configure diff --git a/public/files/Insecam_v2.zip b/public/files/Insecam_v2.zip deleted file mode 100644 index 3f8fea79f35a9ae6c25b8a9592b27a9aeb6aec9a..0000000000000000000000000000000000000000 Binary files a/public/files/Insecam_v2.zip and /dev/null differ diff --git a/public/files/MQTT_Message.zip b/public/files/MQTT_Message.zip deleted file mode 100644 index 1c578c33651211fd87e8040b00b0f1cc2fc8115c..0000000000000000000000000000000000000000 Binary files a/public/files/MQTT_Message.zip and /dev/null differ diff --git a/public/files/SmartMirror.zip b/public/files/SmartMirror.zip deleted file mode 100644 index a5e9d4842c4ccdcc540ee0925eea2580ac5fb187..0000000000000000000000000000000000000000 Binary files a/public/files/SmartMirror.zip and /dev/null differ diff --git a/public/files/blitzortung.zip b/public/files/blitzortung.zip deleted file mode 100644 index c3909c9c339c7887319e1683b5743c0122097714..0000000000000000000000000000000000000000 Binary files a/public/files/blitzortung.zip and /dev/null differ diff --git a/public/files/blitzortung_v2.zip b/public/files/blitzortung_v2.zip deleted file mode 100644 index 77ce54067daf3d089ae58cb539af179ee68230e8..0000000000000000000000000000000000000000 Binary files a/public/files/blitzortung_v2.zip and /dev/null differ diff --git a/public/files/insecam.zip b/public/files/insecam.zip deleted file mode 100644 index 6057e566d2f7312eee46ab738348275830b6f9de..0000000000000000000000000000000000000000 Binary files a/public/files/insecam.zip and /dev/null differ diff --git a/public/files/shorter.zip b/public/files/shorter.zip deleted file mode 100644 index 0d267a080ef7992faf8ce779c7a1a566a118e278..0000000000000000000000000000000000000000 Binary files a/public/files/shorter.zip and /dev/null differ