Browse Source

refresh tag for demo purpose

pull/1/head
Senta Mandutz 5 years ago
parent
commit
5fc6708490
48 changed files with 9352 additions and 229 deletions
  1. 0
    0
      _not-used_archive/template-test.html
  2. 3
    3
      package.json
  3. 0
    0
      public/data-msg/1.json
  4. 0
    0
      public/data-msg/2.json
  5. 0
    0
      public/data-msg/3.json
  6. 0
    0
      public/data-msg/list.json
  7. 0
    0
      public/data-msg/messageData.json
  8. BIN
      public/font/KFOlCnqEu92Fr1MmEU9fBBc4.woff2
  9. BIN
      public/font/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2
  10. BIN
      public/font/KFOlCnqEu92Fr1MmSU5fBBc4.woff2
  11. BIN
      public/font/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2
  12. BIN
      public/font/KFOlCnqEu92Fr1MmWUlfBBc4.woff2
  13. BIN
      public/font/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2
  14. BIN
      public/font/KFOmCnqEu92Fr1Mu4mxK.woff2
  15. BIN
      public/font/KFOmCnqEu92Fr1Mu7GxKOzY.woff2
  16. BIN
      public/font/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2
  17. BIN
      public/img/ios-icon/th_ohmicon_152x152.png
  18. BIN
      public/img/ios-icon/th_ohmicon_167x167.png
  19. BIN
      public/img/ios-icon/th_ohmicon_180x180.png
  20. BIN
      public/img/ios-icon/th_ohmicon_192x192.png
  21. BIN
      public/img/launcher/android_launcher_app_icon_192.png
  22. BIN
      public/img/launcher/android_launcher_app_icon_512.png
  23. BIN
      public/img/launcher/ios_launcher_app_icon_152.png
  24. BIN
      public/img/launcher/ios_launcher_app_icon_167.png
  25. BIN
      public/img/launcher/ios_launcher_app_icon_180.png
  26. BIN
      public/img/launcher/ios_launcher_app_icon_192.png
  27. 0
    0
      public/img/launcher_app_icon.png
  28. 0
    0
      public/img/profil_icon.png
  29. 54
    30
      public/index.html
  30. 87
    0
      public/lib/bootstrap-font-and-icons.css
  31. 6537
    0
      public/lib/bootstrap-material-design.js
  32. 8
    0
      public/lib/bootstrap-material-design.min.css
  33. 2442
    0
      public/lib/popper-1.12.6.js
  34. 9
    14
      public/main.js
  35. 20
    13
      public/manifest.json
  36. 0
    0
      public/routes/bookmark.js
  37. 0
    0
      public/routes/createMessage.js
  38. 0
    0
      public/routes/files.js
  39. 0
    0
      public/routes/home.js
  40. 0
    0
      public/routes/messageData.js
  41. 0
    0
      public/routes/msgCard.js
  42. 0
    0
      public/routes/profil.js
  43. 1
    1
      public/routes/profilCard.js
  44. 0
    0
      public/routes/profilData.js
  45. 145
    155
      public/serviceWorker.js
  46. 12
    0
      public/style/style.css
  47. 18
    0
      public/style/style.less
  48. 16
    13
      server.js

public/template-test.html → _not-used_archive/template-test.html View File


+ 3
- 3
package.json View File

@@ -1,7 +1,7 @@
{
"name": "omapp",
"name": "ohmnews",
"version": "1.0.0",
"description": "ohm-management app for a alternative communication and organization",
"description": "ohm-information app for smarter and more intuitive information and organization",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
@@ -13,7 +13,7 @@
},
"keywords": [
"ohm",
"management",
"news",
"app"
],
"author": "Barbalan, Gruenzinger, Mandutz, Pham, Roemmelt",

public/1.json → public/data-msg/1.json View File


public/2.json → public/data-msg/2.json View File


public/3.json → public/data-msg/3.json View File


public/list.json → public/data-msg/list.json View File


public/messageData.json → public/data-msg/messageData.json View File


BIN
public/font/KFOlCnqEu92Fr1MmEU9fBBc4.woff2 View File


BIN
public/font/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2 View File


BIN
public/font/KFOlCnqEu92Fr1MmSU5fBBc4.woff2 View File


BIN
public/font/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2 View File


BIN
public/font/KFOlCnqEu92Fr1MmWUlfBBc4.woff2 View File


BIN
public/font/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2 View File


BIN
public/font/KFOmCnqEu92Fr1Mu4mxK.woff2 View File


BIN
public/font/KFOmCnqEu92Fr1Mu7GxKOzY.woff2 View File


BIN
public/font/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2 View File


BIN
public/img/ios-icon/th_ohmicon_152x152.png View File


BIN
public/img/ios-icon/th_ohmicon_167x167.png View File


BIN
public/img/ios-icon/th_ohmicon_180x180.png View File


BIN
public/img/ios-icon/th_ohmicon_192x192.png View File


BIN
public/img/launcher/android_launcher_app_icon_192.png View File


BIN
public/img/launcher/android_launcher_app_icon_512.png View File


BIN
public/img/launcher/ios_launcher_app_icon_152.png View File


BIN
public/img/launcher/ios_launcher_app_icon_167.png View File


BIN
public/img/launcher/ios_launcher_app_icon_180.png View File


BIN
public/img/launcher/ios_launcher_app_icon_192.png View File


public/img/th_nbg_ohmicon_amp.png → public/img/launcher_app_icon.png View File


public/img/profil_icon2.PNG → public/img/profil_icon.png View File


+ 54
- 30
public/index.html View File

@@ -8,52 +8,76 @@
<meta name="keywords" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<<<<<<< HEAD
<!--for demonstration:-->
<meta http-equiv="refresh" content="10">
=======
<!-- <meta http-equiv="refresh" content="30"> -->

<!-- NOTE: Define Theme Color -->
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#0046a0">

<!-- NOTE: Icon for tab recognition -->
<!-- highest resolution for Chrome & Opera -->
<link rel="icon" sizes="192x192" href="favicon.ico">
<!-- icons for Safari -> iOS Icons -->
<!-- icons for IE & Windows phone -->
<meta name="msapplication-square70x70logo" content="icon_smalltile.png">
<meta name="msapplication-square150x150logo" content="icon_mediumtile.png">
<meta name="msapplication-square310x310logo" content="icon_largetile.png">
<meta name="msapplication-wide310x150logo" content="icon_widetile.png">

>>>>>>> 7a6d46c85b54e576ce552e15a8938291ab2fd22f
<!-- NOTE: iOS - Add to Homescreen -->
<!-- Hide Safari UI Components -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- iOS Status bar: black or black-translucent -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- iOS App Name next to Icon -->
<meta name="apple-mobile-web-app-title" content="OHM News">
<!-- Icon: No transparency allowed -->
<link rel="apple-touch-icon" href="img/ios-icon/th_ohmicon_192x192.png"> <!-- iphone -->
<link rel="apple-touch-icon" sizes="152x152" href="img/ios-icon/th_ohmicon_152x152.png"><!-- ipad -->
<link rel="apple-touch-icon" sizes="180x180" href="img/ios-icon/th_ohmicon_180x180.png"><!-- iphone-retina -->
<link rel="apple-touch-icon" sizes="167x167" href="img/ios-icon/th_ohmicon_167x167.png"><!-- ipad-retina -->
<link rel="apple-touch-icon" href="img/launcher/ios_launcher_app_icon_192.png"> <!-- iphone -->
<link rel="apple-touch-icon" sizes="152x152" href="img/launcher/ios_launcher_app_icon_152.png"><!-- ipad -->
<link rel="apple-touch-icon" sizes="180x180" href="img/launcher/ios_launcher_app_icon_180.png"><!-- iphone-retina -->
<link rel="apple-touch-icon" sizes="167x167" href="img/launcher/ios_launcher_app_icon_167.png"><!-- ipad-retina -->
<!-- Splash screen: If not set, will be white screen -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="apple-touch-startup-image" sizes="2048x2732" href="/ios-splash/apple_splash_2048.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1668x2224"href="/ios-splash/apple_splash_1668.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1536x2048" href="/ios-splash/apple_splash_1536.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1125x2436" href="/ios-splash/apple_splash_1125.png" /><!-- Tablet ? Phone -->
<link rel="apple-touch-startup-image" sizes="1242x2208" href="/ios-splash/apple_splash_1242.png" /><!-- Tablet ? Phone -->
<link rel="apple-touch-startup-image" sizes="750x1334" href="/ios-splash/apple_splash_750.png" /><!-- Phone -->
<link rel="apple-touch-startup-image" sizes="640x1136" href="/ios-splash/apple_splash_640.png" /><!-- Phone -->
<link rel="apple-touch-startup-image" sizes="2048x2732" href="ios-splash/apple_splash_2048.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1668x2224"href="ios-splash/apple_splash_1668.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1536x2048" href="ios-splash/apple_splash_1536.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1125x2436" href="ios-splash/apple_splash_1125.png" /><!-- Tablet ? Phone -->
<link rel="apple-touch-startup-image" sizes="1242x2208" href="ios-splash/apple_splash_1242.png" /><!-- Tablet ? Phone -->
<link rel="apple-touch-startup-image" sizes="750x1334" href="ios-splash/apple_splash_750.png" /><!-- Phone -->
<link rel="apple-touch-startup-image" sizes="640x1136" href="ios-splash/apple_splash_640.png" /><!-- Phone -->

<!-- NOTE: CSS -->
<!-- CSS_Material Design for Bootstrap fonts and icons -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons">
<link rel="stylesheet" href="lib/bootstrap-font-and-icons.css">
<!-- CSS_Material Design for Bootstrap minified CSS -->
<link rel="stylesheet" href="https://unpkg.com/bootstrap-material-design@4.1.1/dist/css/bootstrap-material-design.min.css" integrity="sha384-wXznGJNEXNG1NFsbm0ugrLFMQPWswR3lds2VeinahP8N0zJw9VWSopbjv2x7WCvX" crossorigin="anonymous">
<link rel="stylesheet" href="lib/bootstrap-material-design.min.css">
<!-- CSS_Custom Design -->
<link rel="stylesheet" type="text/css" href="style/style.css">

<!-- NOTE: Call manifest.json -->
<link rel="manifest" href="manifest.json">

<!-- NOTE: VUE.js und VueRouter -->
<!-- NOTE: Load JQuery, Vue.js, VueRouter -->
<script src=lib/jquery-3.3.1.min.js></script>
<script src=lib/vue.js></script>
<script src=lib/vue-router.js></script>

<!-- NOTE: JavaScript Libs & Files -->
<script src="home.js"></script>
<script src="files.js"></script>
<script src="createMessage.js"></script>
<script src="bookmark.js"></script>
<script src="profil.js"></script>
<script src="msgCard.js"></script>
<script src="messageData.js"></script>
<script src="profilCard.js"></script>
<script src="profilData.js"></script>
<title>OMApp</title>
<script src="routes/home.js"></script>
<script src="routes/files.js"></script>
<script src="routes/createMessage.js"></script>
<script src="routes/bookmark.js"></script>
<script src="routes/profil.js"></script>
<script src="routes/msgCard.js"></script>
<script src="routes/messageData.js"></script>
<script src="routes/profilCard.js"></script>
<script src="routes/profilData.js"></script>
<title>OHM News</title>
</head>

<body>
@@ -108,10 +132,10 @@
<!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js"></script> -->
<!-- CDN_jQuery minified lib -->
<!--<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>-->
<!-- CDN_Popper.js lib -->
<script src="https://unpkg.com/popper.js@1.12.6/dist/umd/popper.js" integrity="sha384-fA23ZRQ3G/J53mElWqVJEGJzU0sTs+SvzG8fXVWP+kJQ1lwFAOkcUOysnlKJC33U" crossorigin="anonymous"></script>
<!-- CDN_Bootstrap JS lib -->
<script src="https://unpkg.com/bootstrap-material-design@4.1.1/dist/js/bootstrap-material-design.js" integrity="sha384-CauSuKpEqAFajSpkdjv3z9t8E7RlpJ1UP0lKM/+NdtSarroVKu069AlsRPKkFBz9" crossorigin="anonymous"></script>
<!-- Load Popper.js -->
<script src="lib/popper-1.12.6.js"></script>
<!-- Load Bootstrap.js -->
<script src="lib/bootstrap-material-design.js"></script>
<!-- NOTE: Call main.js -->
<script src="main.js"></script>


+ 87
- 0
public/lib/bootstrap-font-and-icons.css View File

@@ -0,0 +1,87 @@
/* fallback */
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(../font/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../font/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../font/KFOlCnqEu92Fr1MmSU5fBBc4.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../font/KFOmCnqEu92Fr1Mu7GxKOzY.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../font/KFOmCnqEu92Fr1Mu4mxK.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../font/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../font/KFOlCnqEu92Fr1MmEU9fBBc4.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../font/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../font/KFOlCnqEu92Fr1MmWUlfBBc4.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-feature-settings: 'liga';
-webkit-font-smoothing: antialiased;
}

+ 6537
- 0
public/lib/bootstrap-material-design.js
File diff suppressed because it is too large
View File


+ 8
- 0
public/lib/bootstrap-material-design.min.css
File diff suppressed because it is too large
View File


+ 2442
- 0
public/lib/popper-1.12.6.js
File diff suppressed because it is too large
View File


+ 9
- 14
public/main.js View File

@@ -2,11 +2,10 @@
* Main JavaScript file - Entry point of all JS files *
******************************************************/

// NOTE: ServiceWorker Registration
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
// Register a service worker hosted at the root of the
// site using the default scope ('/').
// Wait until page loaded
window.addEventListener('load', () => {
if ('serviceWorker' in navigator) {
// NOTE: ServiceWorker Registration
return navigator.serviceWorker.register('serviceWorker.js', {
scope: '/'
}).then(function (registration) {
@@ -14,17 +13,13 @@ if ('serviceWorker' in navigator) {
}).catch(function (error) {
return console.log('[Service worker] Registration failed: ', error);
});
});
} else {
console.log('[ServiceWorker] are not supported.');
}
} else {
console.log('[ServiceWorker] are not supported.');
return;
}
});

// NOTE: Set Bootstrap materialdesign
document.addEventListener("DOMContentLoaded", function () {
$('body').bootstrapMaterialDesign();
}, false);
/*
$(document).ready(function() {
$('body').bootstrapMaterialDesign();
});
*/

+ 20
- 13
public/manifest.json View File

@@ -1,15 +1,22 @@
{
"short_name": "OMapp",
"name": "OMapp",
"icons": [
{
"src":"img/th_nbg_ohmicon_amp.png",
"sizes": "200x200",
"type": "image/png"
}
],
"start_url": "/om/?utm_source=homescreen",
"background_color": "#FFF",
"theme_color": "#0046a0",
"display": "standalone"
"short_name": "OHM News",
"name": "OHM News",
"icons": [
{
"src":"img/launcher/android_launcher_app_icon_192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src":"img/launcher/android_launcher_app_icon_512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": "/om/?utm_source=homescreen",
"background_color": "#FFF",
"display": "standalone",
"orientation": "portrait",
"scope": "/om/",
"theme_color": "#0046a0"
}

public/bookmark.js → public/routes/bookmark.js View File


public/createMessage.js → public/routes/createMessage.js View File


public/files.js → public/routes/files.js View File


public/home.js → public/routes/home.js View File


public/messageData.js → public/routes/messageData.js View File


public/msgCard.js → public/routes/msgCard.js View File


public/profil.js → public/routes/profil.js View File


public/profilCard.js → public/routes/profilCard.js View File

@@ -1,6 +1,6 @@
Vue.component('ProfilCard', {
template: `<div>
<img class="profil-img rounded-circle" src="img/profil_icon2.png" width=120px height=120px>
<img class="profil-img rounded-circle" src="img/profil_icon.png" width=120px height=120px>
<div class="profil-card card">
<div class="edit-item"><i class="material-icons">edit</i></div>
<div class="profil-text">

public/profilData.js → public/routes/profilData.js View File


+ 145
- 155
public/serviceWorker.js View File

@@ -1,167 +1,157 @@
'use strict';

// NOTE: CacheKey & FilesToCache Lists
const cacheKey = 'omapp-';
const staticCacheKey = cacheKey + 's-v' + '1';
const dataCacheKey = casheKey + 'd-v' + '1';
const staticFilesToCache = [
'/',
'manifest.json',
'index.html',
'message.html',
'bookmark.js',
'createMessage.js',
'files.js',
'home.js',
'main.js',
'profil.js',
'favicon.ico',
'img/th_nbg_ohmicon_amp.png',
'lib/jquery-3.3.1.min.js',
'lib/vue.js',
'lib/vue-router.js',
'style/style.css',
];
const dataFilesToCache = [
'',
/* ================================== */
/* NOTE: Registration done in main.js */
/* ================================== */

/* =================================== */
/* NOTE: CacheKey & FilesToCache Lists */
/* =================================== */
const version = '1';
const appPrefix = 'ohmnews-';
const staticCacheKey = appPrefix + 'static-v' + version;
const dataCacheKey = appPrefix + 'content-data';
var allCacheKey = [
staticCacheKey,
dataCacheKey
];

// NOTE: Registration done in main.js
// NOTE: Install and activate: Populating cache
/* ================================== */
/* NOTE: Install: Save files to cache */
/* ================================== */
// Install new service worker even when old version still in use.
// Install happens only once a lifetime of a service worker.
self.addEventListener('install', function(event) {
console.log('[ServiceWorker] Install');
// don't wait
self.skipWaiting();
// cache static files
event.waitUntil(
caches.open(staticCacheKey).then(function(cache) {
console.log('[ServiceWorker] Cache static files.');
return cache.addAll(staticFilesToCache);
}),
caches.open(dataCacheKey).then(function(cache) {
console.log('[ServiceWorker] Cache data files.');
return cache.addAll(dataFilesToCache);
})
);
const cacheResources = async () => {
const staticFilesToCache = [
'./',
'favicon.ico',
'index.html',
'main.js',
'manifest.json',
'font/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2',
'font/KFOlCnqEu92Fr1MmEU9fBBc4.woff2',
'font/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2',
'font/KFOlCnqEu92Fr1MmSU5fBBc4.woff2',
'font/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2',
'font/KFOlCnqEu92Fr1MmWUlfBBc4.woff2',
'font/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2',
'font/KFOmCnqEu92Fr1Mu4mxK.woff2',
'font/KFOmCnqEu92Fr1Mu7GxKOzY.woff2',
'img/launcher/launcher_app_icon_152.png',
'img/launcher/launcher_app_icon_167.png',
'img/launcher/launcher_app_icon_180.png',
'img/launcher/launcher_app_icon_192.png',
'img/launcher/launcher_app_icon_512.png',
'img/app_icon.png',
'img/launcher_app_icon.png',
'img/profil_icon.png',
'lib/bootstrap-font-and-icons.css',
'lib/bootstrap-material-design.js',
'lib/bootstrap-material-design.min.css',
'lib/jquery-3.3.1.min.js',
'lib/popper-1.12.6.js',
'lib/vue-router.js',
'lib/vue.js',
'routes/bookmark.js',
'routes/createMessage.js',
'routes/files.js',
'routes/home.js',
'routes/messageData.js',
'routes/msgCard.js',
'routes/profil.js',
'routes/profilCard.js',
'routes/profilData.js',
'style/style.css',
];
const dataFilesToCache = [];

const cacheStatic = await caches.open(staticCacheKey);
cacheStatic.addAll(staticFilesToCache);
console.log('[ServiceWorker] Cache static files.');

const cacheData = await caches.open(dataCacheKey);
cacheData.addAll(dataFilesToCache);
console.log('[ServiceWorker] Cache data files.');
return;
}
self.addEventListener('install', event => {
// don't wait
self.skipWaiting();
// cache static files
event.waitUntil(cacheResources())
console.log('[ServiceWorker] Install');
});

// NOTE: Activate structure and delete older cache versions
// Activates new version of service worker.
/* ================================================================ */
/* NOTE: Activate: new service worker and delete old cache versions */
/* ================================================================ */
// No fetch or pull is called before succesfull activate event.
self.addEventListener('activate', function(event) {
clients.claim();
var cacheWhitelist = [staticCacheKey, dataCacheKey];
event.waitUntil(
caches.keys().then(function(cacheKeyList) {
return Promise.all(
cacheKeyList.map(function(key) {
if (cacheWhitelist.indexOf(key) === -1) {
console.log('[ServiceWorker] Removing old cache', key);
return caches.delete(key);
}
})
);
}).then(() => {
console.log('[ServiceWorker] Activate');
})
);

// Shorten activation time for initial [ServiceWorker] call.
//return self.clients.claim();
const cacheCleanUp = async () => {
const cacheKeyList = await caches.keys();
const deletions = cacheKeyList
.filter(key => key.startsWith(appPrefix) && !allCacheKey.includes(key))
.map(key => {
caches.delete(key)
console.log('[ServiceWorker] Removing old cache', key);
});
for (const success of deletions) {
await success;
}
return;
}
self.addEventListener('activate', event => {
event.waitUntil(cacheCleanUp());
clients.claim();
console.log('[ServiceWorker] Activate');
});


// NOTE: Fetch structure // TODO: Setup fetching method
self.addEventListener('fetch', function(event) {
const dataUrl = ' localhost:8013/'; // Provide HTTPS URL for query data.
// const url = new URL(event.request.url);
console.log('[ServiceWorker] Fetch', event.request.url);

//if (event.request.url.indexOf(dataUrl) > -1) {
/*
* When the request URL contains dataUrl, the app is asking for fresh
* data. In this case, the service worker always goes to the network
* and then caches the response. This is called
* the "Cache then network" strategy:
* https://jakearchibald.com/2014/offline-cookbook/#cache-then-network
*/

/*event.respondWith(
caches.open(staticCacheKey).then(function(cache) {
return fetch(event.request).then(function(response) {
cache.put(event.request.url, response.clone());
return response;
});
})
);
} else {
*/
/*
* The app is asking for app shell files. In this scenario the app uses the
* "Cache, falling back to the network" offline strategy:
* https://jakearchibald.com/2014/offline-cookbook/#cache-falling-back-to-network
*/
/*
// serve the cat SVG from the cache if the request is
// same-origin and the path is '/dog.svg'
if (url.origin == location.origin && url.pathname == '/dog.svg') {
event.respondWith(caches.match('/cat.svg'));
/* ========================================= */
/* NOTE: Fetch: Update logic for cache files */
/* ========================================= */
self.addEventListener('fetch', event => {
// Provide HTTPS URL for query data.
//const postMsgURL = 'https://me.efi.th-nuernberg.de/om/api/createMsg';
//const postMsgURL = 'http://localhost:8013/api/createMsg';

/* We should only cache GET requests, and deal with the rest of method in the
client-side, by handling failed POST,PUT,PATCH,etc. requests. */
if (event.request.method !== 'GET') { // && event.request.url !== postMsgURL
/* If we don't block the event as shown below, then the request will go to
the network as usual. */
console.log('[ServiceWorker] Fetch event ignored.', event.request.method, event.request.url);
return;
}

event.respondWith(async function update() {
try {
var requestURL = new URL(event.request.url);

/*if (requestURL.href === postMsgURL) {
console.log('New Msg created. ReqURL: ', event.request.method, event.request.url);
}*/

// Start the network request as soon as possible.
const networkPromise = fetch(requestURL);

const cachedResponse = await caches.match(event.request);

const networkResponse = await networkPromise;
// Check if response is valid, status is 200, response type is basic
// (indicates request is from origin, means that requests to third party
// assets aren't cached as well.
if (!networkResponse || networkResponse.status !== 200
|| networkResponse.type !== 'basic') return networkResponse;

const cache = await caches.open(staticCacheKey);
// We have to clone the response here because request bodies can only
// be read once. Placing a response in the cache counts as a read.
cache.put(event.request, networkResponse.clone());

if (cachedResponse) return cachedResponse;
console.log('[ServiceWorker] Fetch', event.request);
return networkResponse;
} catch (err) {
// Report a lack of connectivity to the user.
console.log('No Network connection: ',err);
}
*/

event.respondWith(
caches.match(event.request)
.then(function(response) {
if (response) {
return response;
}
return fetch(event.request).then(
function(response) {
// Check if we received a valid response
// - Ensure the response is valid.
// - Check the status is 200 on the response.
// - Make sure the response type is basic, which indicates that it's a request from our origin.
// This means that requests to third party assets aren't cached as well.
if(!response || response.status !== 200 || response.type !== 'basic') {
return response;
}

// IMPORTANT: Clone the response. A response is a stream
// and because we want the browser to consume the response
// as well as the cache consuming the response, we need
// to clone it so we have two streams.
// - Reason: response is a stream and object can only consumed once
var responseToCache = response.clone();

caches.open(staticCacheKey)
.then(function(cache) {
cache.put(event.request, responseToCache);
});

return response;
}
);
})
);
//}
/*
caches.match(event.request).then(cachedResponse => {
if (cachedResponse) {
return cachedResponse;
}

return caches.open(shellCacheKey).then(cache => {
return fetch(event.request).then(response => {
// Put a copy of the response in the runtime cache.
return cache.put(event.request, response.clone()).then(() => {
return response;
});
});
});

})*/
}());
});


+ 12
- 0
public/style/style.css View File

@@ -150,3 +150,15 @@ label.checkbox-inline input[type=checkbox]:checked + .checkbox-decorator .check
.is-focused[class^=bmd-label] {
color: #0046a0;
}
/*//Präsentation Styles
.om-card {
font-size: 140%;
}
.msg-head{
font-size:90%;
}
.empty-state{
margin: 40px;
margin-top: 30%;
font-size:140%;
}*/

+ 18
- 0
public/style/style.less View File

@@ -52,6 +52,10 @@
}
}

a.nav-item.nav-link{

}

//msg-Card
.om-card{
margin: 10px;
@@ -174,3 +178,17 @@
.is-focused [class*="bmd-label"], .is-focused[class^=bmd-label]{
color: @color;
}

/*//Präsentation Styles
.om-card {
font-size: 140%;
}
.msg-head{
font-size:90%;
}
.empty-state{
margin: 40px;
margin-top: 30%;
font-size:140%;
}*/


+ 16
- 13
server.js View File

@@ -93,7 +93,7 @@ const mongoose = require('mongoose');
mongoose.Promise = global.Promise;

// Connecting to the database
mongoose.connect(dbConfig.url)
mongoose.connect(dbConfig.url, {useNewUrlParser: true})
.then(() => {
console.log("Successfully connected to MongoDB.");
}).catch(err => {
@@ -230,20 +230,23 @@ http.createServer (app) .listen (http_port, function () {
var options;
try {
try {
// In case it's a real certificate: add CA chain cersts (TODO: use array if required)
var ca = fs.readFileSync ('keys/ca_cert.pem');
// In case it's a real certificate: add CA chain cersts (TODO: use array if required)
var ca = fs.readFileSync ('keys/ca_cert.pem');
} catch (e) {
ca = undefined;
console.log ("Note: Can't read CA bundle: "+e);
ca = undefined;
console.log ("Note: Can't read CA bundle: "+e);
}
options = {
key: fs.readFileSync ('keys/omkey.pem'),
cert: fs.readFileSync ('keys/certificate.pem'),
ca: ca
};
https.createServer (options, app) .listen (https_port, function () {
console.log ("Express https server listening on port " + https_port);
});
if (ca != null) {

options = {
key: fs.readFileSync ('keys/omkey.pem'),
cert: fs.readFileSync ('keys/certificate.pem'),
ca: ca
};
https.createServer (options, app) .listen (https_port, function () {
console.log ("Express https server listening on port " + https_port);
});
}
} catch (e) {
console.log ("Note: Can't read SSL keys/certs: "+e+"\nDisabling https server");
}

Loading…
Cancel
Save