summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-08-29 23:24:38 +0200
committersijanec <sijanecantonluka@gmail.com>2020-08-29 23:24:38 +0200
commitf9fa3aaf35b6d8a14966de204bc1ffbc3541ea46 (patch)
tree5018ee371dec39de299afa09ab286b4c8a2649da
downloadttx-app-f9fa3aaf35b6d8a14966de204bc1ffbc3541ea46.tar
ttx-app-f9fa3aaf35b6d8a14966de204bc1ffbc3541ea46.tar.gz
ttx-app-f9fa3aaf35b6d8a14966de204bc1ffbc3541ea46.tar.bz2
ttx-app-f9fa3aaf35b6d8a14966de204bc1ffbc3541ea46.tar.lz
ttx-app-f9fa3aaf35b6d8a14966de204bc1ffbc3541ea46.tar.xz
ttx-app-f9fa3aaf35b6d8a14966de204bc1ffbc3541ea46.tar.zst
ttx-app-f9fa3aaf35b6d8a14966de204bc1ffbc3541ea46.zip
-rw-r--r--192.pngbin0 -> 1877 bytes
-rw-r--r--512.pngbin0 -> 4403 bytes
-rw-r--r--apache.conf100
-rw-r--r--manifest.json27
-rw-r--r--nginx.conf58
-rw-r--r--offline.html25
-rw-r--r--original.pngbin0 -> 2556 bytes
-rw-r--r--redfox.js15
-rw-r--r--sw.js59
-rw-r--r--ž58
10 files changed, 342 insertions, 0 deletions
diff --git a/192.png b/192.png
new file mode 100644
index 0000000..d07ebb3
--- /dev/null
+++ b/192.png
Binary files differ
diff --git a/512.png b/512.png
new file mode 100644
index 0000000..7cad0ef
--- /dev/null
+++ b/512.png
Binary files differ
diff --git a/apache.conf b/apache.conf
new file mode 100644
index 0000000..fe63719
--- /dev/null
+++ b/apache.conf
@@ -0,0 +1,100 @@
+# substitute, proxy, headers, ssl, proxy_http, dump_io mods need enable: a2enmod
+<VirtualHost *:27443>
+ SSLEngine On
+ SSLCertificateFile /etc/letsencrypt/live/teletekst.xn--jha.ga/fullchain.pem
+ SSLCertificateKeyFile /etc/letsencrypt/live/teletekst.xn--jha.ga/privkey.pem
+ SSLProxyEngine On
+ SSLProxyCheckPeerCN Off
+ SSLProxyCheckPeerName Off
+ # The ServerName directive sets the request scheme, hostname and port that
+ # the server uses to identify itself. This is used when creating
+ # redirection URLs. In the context of virtual hosts, the ServerName
+ # specifies what hostname must appear in the request's Host: header to
+ # match this virtual host. For the default virtual host (this file) this
+ # value is not decisive as it is used as a last resort host regardless.
+ # However, you must set it for any further virtual host explicitly.
+ #ServerName www.example.com
+
+ #ServerAdmin webmaster@localhost
+ #DocumentRoot /var/www/apache2
+
+ # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
+ # error, crit, alert, emerg.
+ # It is also possible to configure the loglevel for particular
+ # modules, e.g.
+ #LogLevel info ssl:warn
+
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+ # For most configuration files from conf-available/, which are
+ # enabled or disabled at a global level, it is possible to
+ # include a line for only one particular virtual host. For example the
+ # following line enables the CGI configuration for this host only
+ # after it has been globally disabled with "a2disconf".
+ #Include conf-available/serve-cgi-bin.conf
+
+ RequestHeader unset Accept-Encoding
+ ProxyPreserveHost Off
+ ProxyPass "/" "https://teletext.rtvslo.si:443/"
+ ProxyPassReverse "/" "https://teletext.rtvslo.si:443/"
+ AddOutputFilterByType SUBSTITUTE text/html
+ Substitute "s|teletext.rtvslo.si|teletekst.xn--jha.ga|i"
+ Substitute "s/weird.function/console.log/i"
+ DumpIOInput Off
+ DumpIOOutput On
+ LogLevel dumpio:trace7
+ LogLevel debug
+
+</VirtualHost>
+<VirtualHost *:2780>
+# ServerName cargova.xn--pga.ga
+# SSLEngine On
+# SSLCertificateFile /etc/ssl/sslforfree/sg.crt
+# SSLCertificateKeyFile /etc/ssl/sslforfree/sg.key
+ SSLProxyEngine On
+ SSLProxyCheckPeerCN Off
+ SSLProxyCheckPeerName Off
+ # The ServerName directive sets the request scheme, hostname and port that
+ # the server uses to identify itself. This is used when creating
+ # redirection URLs. In the context of virtual hosts, the ServerName
+ # specifies what hostname must appear in the request's Host: header to
+ # match this virtual host. For the default virtual host (this file) this
+ # value is not decisive as it is used as a last resort host regardless.
+ # However, you must set it for any further virtual host explicitly.
+ #ServerName www.example.com
+
+ #ServerAdmin webmaster@localhost
+ #DocumentRoot /var/www/apache2
+
+ # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
+ # error, crit, alert, emerg.
+ # It is also possible to configure the loglevel for particular
+ # modules, e.g.
+ #LogLevel info ssl:warn
+
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+ # For most configuration files from conf-available/, which are
+ # enabled or disabled at a global level, it is possible to
+ # include a line for only one particular virtual host. For example the
+ # following line enables the CGI configuration for this host only
+ # after it has been globally disabled with "a2disconf".
+ #Include conf-available/serve-cgi-bin.conf
+
+ RequestHeader unset Accept-Encoding
+ ProxyPreserveHost Off
+ ProxyPass "/" "https://teletext.rtvslo.si:443/"
+ ProxyPassReverse "/" "https://teletext.rtvslo.si:443/"
+ AddOutputFilterByType SUBSTITUTE text/html
+ Substitute "s/teletext.rtvslo.si/teletekst.xn--jha.ga:2780/i"
+ Substitute "s/weird.function/console.log/i"
+ DumpIOInput Off
+ DumpIOOutput On
+ LogLevel dumpio:trace7
+ LogLevel debug
+
+</VirtualHost>
+
+# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 0000000..a93e9aa
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,27 @@
+{
+ "short_name": "Teletekst RTVSLO",
+ "name": "Teletekst RTV Slovenija",
+ "description": "Spletna aplikacija za branje teleteksta TV Slovenija",
+ "lang": "sl-SI",
+ "categories": [
+ "productivity",
+ "utilities"
+ ],
+ "icons": [
+ {
+ "src": "/192.png",
+ "type": "image/png",
+ "sizes": "192x192"
+ },
+ {
+ "src": "/512.png",
+ "type": "image/png",
+ "sizes": "512x512"
+ }
+ ],
+ "start_url": "/index.html",
+ "background_color": "#000000",
+ "display": "standalone",
+ "scope": "/",
+ "theme_color": "#000000"
+}
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..ff71ccc
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,58 @@
+server {
+ listen 0.0.0.0:80;
+ listen [::]:80;
+ server_name .teletekst.xn--jha.ga;
+ return 301 https://teletekst.xn--jha.ga$request_uri;
+ port_in_redirect off;
+ server_name_in_redirect off;
+}
+server {
+ listen 0.0.0.0:443 ssl http2;
+ listen [::]:443 ssl http2;
+ ssl_certificate /etc/letsencrypt/live/teletekst.xn--jha.ga/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/teletekst.xn--jha.ga/privkey.pem;
+ ssl_session_cache builtin:1000 shared:SSL:10m;
+ ssl_prefer_server_ciphers on;
+ add_header Strict-Transport-Security "max-age=604800";
+ index index.html;
+ server_name .teletekst.xn--jha.ga;
+ root /var/www/teletekst.xn--jha.ga;
+ location / {
+ set $cors '';
+ set $both_conditions "";
+ add_header "x-debug-location-gse" "triggered";
+ if ($http_origin ~ \.?xn--jha\.ga$) {
+ set $cors 'true';
+ set $both_conditions "P";
+ add_header "x-debug-http-origin-check" "passed";
+ }
+ if ($cors = 'true') {
+ add_header "Access-Control-Allow-Origin" $http_origin always;
+ add_header "Access-Control-Allow-Credentials" "true" always;
+ add_header "Access-Control-Allow-Methods" "GET, POST, PATCH, PUT, DELETE, OPTIONS" always;
+ add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always;
+ add_header 'Access-Control-Expose-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always;
+ }
+ if ($request_method = 'OPTIONS') {
+ set $both_conditions "${both_conditions}D";
+ }
+ if ($both_conditions = PD) {
+ add_header "Access-Control-Allow-Origin" $http_origin always;
+ add_header "Access-Control-Allow-Credentials" "true" always;
+ add_header "Access-Control-Allow-Methods" "GET, POST, PATCH, PUT, DELETE, OPTIONS" always;
+ add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always;
+ add_header 'Access-Control-Expose-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always;
+ add_header 'Access-Control-Max-Age' -1;
+ add_header 'Content-Type' 'text/plain charset=UTF-8';
+ add_header 'Content-Length' 0;
+ return 204;
+ }
+ try_files $uri $uri/ @backend;
+ }
+ location @backend {
+ proxy_pass https://localhost:27443;
+ proxy_set_header Host teletext.rtvslo.si;
+ proxy_set_header Referer https://teletext.rtvslo.si/;
+ proxy_set_header X-Forwarded-For $remote_addr;
+ }
+}
diff --git a/offline.html b/offline.html
new file mode 100644
index 0000000..bc1a403
--- /dev/null
+++ b/offline.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset=UTF-8 />
+ <title>
+ Ni internetne povezave :: RTVSLO Teletekst
+ </title>
+ <style>
+ body {
+ color: white;
+ background: black;
+ font-family: arial;
+ }
+ </style>
+ </head>
+ <body>
+ <h2 align=center>RTVSLO Teletekst</h2>
+ <h3 align=center>Ni internetne povetave!</h3>
+ <p>
+ Za ogled teleteksta potrebujete povezavo s spletom.
+ Omogočite prenos podatkov ali se povežite na dostopno
+ točko WiFi.
+ </p>
+ </body>
+</html>
diff --git a/original.png b/original.png
new file mode 100644
index 0000000..a7325a3
--- /dev/null
+++ b/original.png
Binary files differ
diff --git a/redfox.js b/redfox.js
new file mode 100644
index 0000000..fea1579
--- /dev/null
+++ b/redfox.js
@@ -0,0 +1,15 @@
+// *****************************************************
+// ************** nastavitev spremenljivk *************
+// *****************************************************
+var author = "Sebastjan Dobnik";
+
+// Register the service worker
+if ('serviceWorker' in navigator) {
+ navigator.serviceWorker.register('/service-worker.js')
+ .then(function(registration) {
+ console.log('sw reg succ, scope: ', registration.scope);
+ })
+ .catch(function(err) {
+ console.log('ServiceWorker registration failed: ', err);
+ });
+}
diff --git a/sw.js b/sw.js
new file mode 100644
index 0000000..756f11f
--- /dev/null
+++ b/sw.js
@@ -0,0 +1,59 @@
+// Change version to cause cache refresh, sw.js SE NE SME CACHAT aka ne ga dat v assets!
+const static_cache_name = "site-static-v0.0.0";
+const offlineUrl = "/offline.html";
+const assets = [
+ "/", // proxy | proxyjan je tudi sw.js
+ "/index.html", // proxy |
+ "/512.png", // moje | redfox.js je poklican iz
+ "/512.png", // proxy | vsake proxyjane html strani
+ "/manifest.json", // moje | in vsebuje custom skripte,
+ "/desktop2.css", // proxy | kot na primer sw inštalacijo.
+ "/phone2.css", // proxy |
+ "/pin.svg", // proxy |
+ "/redfox.js", // moje |
+ "/slike/home100.svg", // proxy |
+ "/slike/prPage.svg", // proxy |
+ "/slike/prSubPage.svg", // proxy |
+ "/slike/neSubPage.svg", // proxy |
+ "/slike/nePage.svg", // proxy |
+ "/slike/keyboard.svg", // proxy |
+ "/slike/go.svg", // proxy |
+ "/favicon.png", // proxy |
+ "/offline.html" // moje |
+];
+
+self.addEventListener("install", (evt) => {
+ evt.waitUntil(
+ caches.open(static_cache_name).then((cache) => {
+ cache.addAll(assets);
+ })
+ );
+});
+
+// Delete old caches
+self.addEventListener("activate", evt => {
+ evt.waitUntil(
+ caches.keys().then((keys) => {
+ return Promise.all(keys
+ .filter(key => key !== static_cache_name)
+ .map(key => caches.delete(key))
+ );
+ })
+ );
+});
+
+self.addEventListener("fetch", (evt) => {
+ if (event.request.mode === 'navigate' || // tole ni povsod podprto, zato
+ ( (event.request.method === 'GET' || // če je GET
+ event.request.method === 'POST') // ali POST zahteva
+ && event.request.headers.get('accept').includes('text/html'))) {
+
+ event.respondWith(fetch(event.request.url).catch(error => {
+ return cacches.match(offlineUrl);
+ }));
+ } else { // zahteva je za nek resource (css/js/img), ne za stran
+ evt.respondWith(caches.match(evt.request).then((cache_res) => {
+ return cache_res || fetch(evt.request);
+ }))
+ }
+});
diff --git a/ž b/ž
new file mode 100644
index 0000000..ff71ccc
--- /dev/null
+++ b/ž
@@ -0,0 +1,58 @@
+server {
+ listen 0.0.0.0:80;
+ listen [::]:80;
+ server_name .teletekst.xn--jha.ga;
+ return 301 https://teletekst.xn--jha.ga$request_uri;
+ port_in_redirect off;
+ server_name_in_redirect off;
+}
+server {
+ listen 0.0.0.0:443 ssl http2;
+ listen [::]:443 ssl http2;
+ ssl_certificate /etc/letsencrypt/live/teletekst.xn--jha.ga/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/teletekst.xn--jha.ga/privkey.pem;
+ ssl_session_cache builtin:1000 shared:SSL:10m;
+ ssl_prefer_server_ciphers on;
+ add_header Strict-Transport-Security "max-age=604800";
+ index index.html;
+ server_name .teletekst.xn--jha.ga;
+ root /var/www/teletekst.xn--jha.ga;
+ location / {
+ set $cors '';
+ set $both_conditions "";
+ add_header "x-debug-location-gse" "triggered";
+ if ($http_origin ~ \.?xn--jha\.ga$) {
+ set $cors 'true';
+ set $both_conditions "P";
+ add_header "x-debug-http-origin-check" "passed";
+ }
+ if ($cors = 'true') {
+ add_header "Access-Control-Allow-Origin" $http_origin always;
+ add_header "Access-Control-Allow-Credentials" "true" always;
+ add_header "Access-Control-Allow-Methods" "GET, POST, PATCH, PUT, DELETE, OPTIONS" always;
+ add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always;
+ add_header 'Access-Control-Expose-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always;
+ }
+ if ($request_method = 'OPTIONS') {
+ set $both_conditions "${both_conditions}D";
+ }
+ if ($both_conditions = PD) {
+ add_header "Access-Control-Allow-Origin" $http_origin always;
+ add_header "Access-Control-Allow-Credentials" "true" always;
+ add_header "Access-Control-Allow-Methods" "GET, POST, PATCH, PUT, DELETE, OPTIONS" always;
+ add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always;
+ add_header 'Access-Control-Expose-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always;
+ add_header 'Access-Control-Max-Age' -1;
+ add_header 'Content-Type' 'text/plain charset=UTF-8';
+ add_header 'Content-Length' 0;
+ return 204;
+ }
+ try_files $uri $uri/ @backend;
+ }
+ location @backend {
+ proxy_pass https://localhost:27443;
+ proxy_set_header Host teletext.rtvslo.si;
+ proxy_set_header Referer https://teletext.rtvslo.si/;
+ proxy_set_header X-Forwarded-For $remote_addr;
+ }
+}