mirror of
				https://github.com/KevinMidboe/zoff.git
				synced 2025-10-29 18:00:23 +00:00 
			
		
		
		
	Readded serviceworker, and fixed namechange error
This commit is contained in:
		
							
								
								
									
										73
									
								
								gulpfile.js
									
									
									
									
									
								
							
							
						
						
									
										73
									
								
								gulpfile.js
									
									
									
									
									
								
							| @@ -2,14 +2,83 @@ var gulp    = require('gulp'), | ||||
| 	gutil   = require('gulp-util'), | ||||
| 	uglify  = require('gulp-uglifyjs'), | ||||
| 	concat  = require('gulp-concat'); | ||||
| /* | ||||
| var critical = require('critical'); | ||||
|  | ||||
| gulp.task('critical-frontpage', function (cb) { | ||||
|   critical.generate({ | ||||
|     base: './server/public/', | ||||
|     src: './assets/html/frontpage.html', | ||||
|     css: ['./server/public/assets/css/style.css', './server/public/assets/css/materialize.min.css', './server/public/assets/css/jquery-ui.min.css'], | ||||
|     dimensions: [{ | ||||
|       width: 320, | ||||
|       height: 480 | ||||
|     },{ | ||||
|       width: 768, | ||||
|       height: 1024 | ||||
|     },{ | ||||
|       width: 1280, | ||||
|       height: 960 | ||||
|     }], | ||||
|     dest: './assets/css/f.c.min.css', | ||||
|     minify: true, | ||||
|     extract: false, | ||||
|     ignore: ['font-face'] | ||||
|   }); | ||||
| }); | ||||
|  | ||||
| gulp.task('critical-channel', function (cb) { | ||||
|   critical.generate({ | ||||
|     base: './server/public/', | ||||
|     src: './assets/html/embed.html', | ||||
|     css: ['./server/public/assets/css/style.css', './server/public/assets/css/materialize.min.css', './server/public/assets/css/jquery-ui.min.css'], | ||||
|     dimensions: [{ | ||||
|       width: 320, | ||||
|       height: 480 | ||||
|     },{ | ||||
|       width: 768, | ||||
|       height: 1024 | ||||
|     },{ | ||||
|       width: 1280, | ||||
|       height: 960 | ||||
|     }], | ||||
|     dest: './assets/css/c.c.min.css', | ||||
|     minify: true, | ||||
|     extract: false, | ||||
|     ignore: ['font-face'] | ||||
|   }); | ||||
| }); | ||||
|  | ||||
|  | ||||
| gulp.task('critical-embed', function (cb) { | ||||
|   critical.generate({ | ||||
|     base: './server/public/', | ||||
|     src: './assets/html/embed.html', | ||||
|     css: ['./server/public/assets/css/embed.css', './server/public/assets/css/materialize.min.css', './server/public/assets/css/jquery-ui.min.css'], | ||||
|     dimensions: [{ | ||||
|       width: 320, | ||||
|       height: 480 | ||||
|     },{ | ||||
|       width: 768, | ||||
|       height: 1024 | ||||
|     },{ | ||||
|       width: 1280, | ||||
|       height: 960 | ||||
|     }], | ||||
|     dest: './assets/css/e.c.min.css', | ||||
|     minify: true, | ||||
|     extract: false, | ||||
|     ignore: ['font-face'] | ||||
|   }); | ||||
| }); | ||||
| */ | ||||
| gulp.task('js', function () { | ||||
|     gulp.src(['server/VERSION.js', 'server/config/api_key.js', 'server/public/assets/js/*.js', '!server/public/assets/js/embed*', '!server/public/assets/js/token*', '!server/public/assets/js/remotecontroller.js', '!server/public/assets/js/callback.js']) | ||||
|         /*.pipe(uglify({ | ||||
|         .pipe(uglify({ | ||||
|         	mangle: true, | ||||
|             compress: true, | ||||
|         	enclose: true | ||||
|         }))*/ | ||||
|         })) | ||||
|         .pipe(concat('main.min.js')) | ||||
|         .pipe(gulp.dest('server/public/assets/dist')); | ||||
| }); | ||||
|   | ||||
							
								
								
									
										2413
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2413
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -35,6 +35,7 @@ | ||||
|     "cookie-parser": "^1.4.3", | ||||
|     "cookies": "^0.7.1", | ||||
|     "cors": "^2.8.4", | ||||
|     "critical": "^1.1.0", | ||||
|     "emoji-strip": "^0.0.3", | ||||
|     "express": "^4.15.2", | ||||
|     "express-handlebars": "^3.0.0", | ||||
|   | ||||
| @@ -146,6 +146,9 @@ function namechange(data, guid, socket, tried) { | ||||
|             data.name = name; | ||||
|             data.password = pass; | ||||
|             new_password = false; | ||||
|             if(name == "" || pass == "") { | ||||
|                 return; | ||||
|             } | ||||
|         } else { | ||||
|             var name = data.name; | ||||
|             if(data.hasOwnProperty("first")) { | ||||
|   | ||||
							
								
								
									
										7
									
								
								server/public/assets/css/jquery-ui.min.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								server/public/assets/css/jquery-ui.min.css
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -2355,6 +2355,69 @@ nav ul li:hover, nav ul li.active { | ||||
|     line-height: 31px; | ||||
| } | ||||
|  | ||||
| .ui-slider-vertical { | ||||
|     width: .8em; | ||||
|     height: 100px; | ||||
| } | ||||
| .ui-slider { | ||||
|     position: relative; | ||||
|     text-align: left; | ||||
| } | ||||
|  | ||||
| .ui-slider-vertical .ui-slider-range-min { | ||||
|     bottom: 0; | ||||
| } | ||||
| .ui-slider-vertical .ui-slider-range { | ||||
|     left: 0; | ||||
|     width: 100%; | ||||
|     border-radius: 0px !important; | ||||
| } | ||||
| .ui-slider .ui-slider-range { | ||||
|     position: absolute; | ||||
|     z-index: 1; | ||||
|     font-size: .7em; | ||||
|     display: block; | ||||
|     border: 0; | ||||
|     background-position: 0 0; | ||||
| } | ||||
|  | ||||
| .ui-slider-vertical .ui-slider-handle { | ||||
|     left: -.3em; | ||||
|     margin-left: 0; | ||||
|     margin-bottom: -.6em; | ||||
| } | ||||
| .ui-slider .ui-slider-handle { | ||||
|     position: absolute; | ||||
|     z-index: 2; | ||||
|     width: 1.2em; | ||||
|     height: 1.2em; | ||||
|     cursor: default; | ||||
|     -ms-touch-action: none; | ||||
|     touch-action: none; | ||||
| } | ||||
|  | ||||
| .ui-slider-horizontal .ui-slider-range-min { | ||||
|     left: 0; | ||||
| } | ||||
| .ui-slider-horizontal .ui-slider-range { | ||||
|     top: 0; | ||||
|     height: 100%; | ||||
| } | ||||
|  | ||||
| .ui-slider .ui-slider-range { | ||||
|     position: absolute; | ||||
|     z-index: 1; | ||||
|     font-size: .7em; | ||||
|     display: block; | ||||
|     border: 0; | ||||
|     background-position: 0 0; | ||||
| } | ||||
|  | ||||
| .ui-slider-horizontal .ui-slider-handle { | ||||
|     top: -.3em; | ||||
|     margin-left: -.6em; | ||||
| } | ||||
|  | ||||
| #volume { | ||||
|     cursor:pointer; | ||||
|     float:left; | ||||
| @@ -2377,7 +2440,7 @@ nav ul li:hover, nav ul li.active { | ||||
|     background-color:rgba(255, 255, 255, 0.8); | ||||
|     border: none; | ||||
|     outline: none; | ||||
|     /*border-radius: 2px;*/ | ||||
|     border-radius: 2px; | ||||
| } | ||||
|  | ||||
| #volume .ui-slider-handle { | ||||
|   | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -15,7 +15,6 @@ | ||||
|         <meta property="og:description" content="The Shared (free) YouTube radio. Being built around the YouTube search and video API it enables the creation of collaborative and shared live playlists, with billions of videos and songs to choose from, all for free and without registration. Enjoy!"/> | ||||
|         <meta property="og:type" content="website"/> | ||||
|         <link rel="manifest" href="/assets/manifest.json"> | ||||
|     	<script>if(window.location.hostname == "zoff.no") window.location.href="https://zoff.me";</script> | ||||
|     </head> | ||||
|     <body> | ||||
|         <div id="center-text" style="cursor:default;-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;color: #2d2d2d;font-family:Helvetica;width: 60%;text-align: left;margin: auto;position: absolute;left: 0;right: 0;top: 50%;transform: translateY(-50%);"> | ||||
|   | ||||
| @@ -117,24 +117,24 @@ var connection_options = { | ||||
| var fromFront = false; | ||||
| var fromChannel = false; | ||||
|  | ||||
| try{/* | ||||
| try{ | ||||
|     if (navigator.serviceWorker && window.location.host != "zoff.dev") { | ||||
|     navigator.serviceWorker.register('/service-worker.js', {scope: '/'}) | ||||
|     .then(function (registration) { | ||||
|     Helper.log(registration); | ||||
| }) | ||||
| .catch(function (e) { | ||||
| console.error(e); | ||||
| }); | ||||
| } else { | ||||
| Helper.log('Service Worker is not supported in this browser.'); | ||||
| }*/ | ||||
|  | ||||
| navigator.serviceWorker.getRegistration('/').then(function(registration) { | ||||
|     if(registration) { | ||||
|         registration.unregister(); | ||||
|         navigator.serviceWorker.register('/service-worker.js', {scope: '/'}) | ||||
|         .then(function (registration) { | ||||
|             Helper.log(registration); | ||||
|         }) | ||||
|         .catch(function (e) { | ||||
|             console.error(e); | ||||
|         }); | ||||
|     } else { | ||||
|         Helper.log('Service Worker is not supported in this browser.'); | ||||
|     } | ||||
| }); | ||||
|  | ||||
|     /*navigator.serviceWorker.getRegistration('/').then(function(registration) { | ||||
|         if(registration) { | ||||
|             registration.unregister(); | ||||
|         } | ||||
|     });*/ | ||||
|  | ||||
| } catch(e) {} | ||||
|  | ||||
|   | ||||
| @@ -23,26 +23,22 @@ | ||||
|         <meta property="og:type" content="website"/> | ||||
|         <meta property="fb:app_id" content="1581693815380949" /> | ||||
|         <link rel="manifest" href="/assets/manifest.json"> | ||||
|         <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | ||||
|         <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" media="none" onload="if(media!='all')media='all'"> | ||||
|         {{#if embed}} | ||||
|         {{else}} | ||||
|             <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.min.css"> | ||||
|             <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.min.css" media="none" onload="if(media!='all')media='all'"> | ||||
|             <link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png"> | ||||
|             <link rel="icon" type="image/png" sizes="32x32" href="/assets/images/favicon-32x32.png"> | ||||
|             <link rel="icon" id="favicon" type="image/png" sizes="16x16" href="/assets/images/favicon-16x16.png"> | ||||
|             <link rel="mask-icon" href="/assets/images/safari-pinned-tab.svg" color="#2d2d2d"> | ||||
|         {{/if}} | ||||
|         <link rel="stylesheet" href="/assets/css/jquery-ui.min.css"> | ||||
|         <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css"> | ||||
|         <link rel="stylesheet" type="text/css" href="/assets/css/{{stylesheet}}" title="Default" /> | ||||
|         <link rel="stylesheet" type="text/css" href="/assets/css/{{stylesheet}}" title="Default"> | ||||
|         <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> | ||||
|         <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script> | ||||
|         <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.slim.js"></script> | ||||
|         <script type="text/javascript" src="/assets/dist/lib/jquery-ui.min.js"></script> | ||||
|         {{#if embed}} | ||||
|         {{else}} | ||||
|             <script src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.min.js"></script> | ||||
|             <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"></script> | ||||
|             <script async type="text/javascript"> | ||||
|                 if(window.location.hostname != "localhost") { | ||||
|                     (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | ||||
| @@ -79,6 +75,9 @@ | ||||
|             {{> footer}} | ||||
|             <textarea class="copy_video_id" style="display:none;"></textarea> | ||||
|         {{/if}} | ||||
|         <script type="text/javascript" src="/assets/dist/lib/jquery-ui.min.js"></script> | ||||
|         <script src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.min.js"></script> | ||||
|         <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"></script> | ||||
|         <script async type="text/javascript" src="/assets/dist/{{javascript_file}}"></script> | ||||
|     </body> | ||||
| </html> | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| <div id="wrapper" class="tabs_height"> | ||||
|     <div id="list-song-html"> | ||||
|     <div id="list-song-html" style="display: none;"> | ||||
|         <div id="list-song" class="card left-align list-song playlist-element waves-effect waves-light"> | ||||
|             <div class="clickable vote-container" title="Vote!"> | ||||
|                 <a class="clickable center-align votebg"> | ||||
|   | ||||
| @@ -62,6 +62,8 @@ router.route('/api/apply/:id').get(function(req,res) { | ||||
|                         correct: true, | ||||
|                         stylesheet: "style.css", | ||||
|                         embed: false, | ||||
|                         critical: "f", | ||||
|                         critical_enabled: true | ||||
|                     } | ||||
|                     res.render('layouts/client/token', data); | ||||
|                 }); | ||||
| @@ -77,6 +79,8 @@ router.route('/api/apply/:id').get(function(req,res) { | ||||
|                 correct: false, | ||||
|                 stylesheet: "style.css", | ||||
|                 embed: false, | ||||
|                 critical: "f", | ||||
|                 critical_enabled: true | ||||
|             } | ||||
|             res.render('layouts/client/token', data); | ||||
|         } | ||||
| @@ -95,6 +99,8 @@ router.route('/api/apply').get(function(req, res, next) { | ||||
|         correct: false, | ||||
|         stylesheet: "style.css", | ||||
|         embed: false, | ||||
|         critical: "f", | ||||
|         critical_enabled: true | ||||
|     } | ||||
|     res.render('layouts/client/token', data); | ||||
| }); | ||||
| @@ -115,7 +121,9 @@ function root(req, res, next) { | ||||
|                 analytics: analytics, | ||||
|                 stylesheet: "style.css", | ||||
|                 embed: false, | ||||
|                 client: false | ||||
|                 client: false, | ||||
|                 critical: "f", | ||||
|                 critical_enabled: true | ||||
|             } | ||||
|             res.render('layouts/client/remote', data); | ||||
|         } else if(subdomain[0] == "www") { | ||||
| @@ -128,7 +136,9 @@ function root(req, res, next) { | ||||
|                 analytics: analytics, | ||||
|                 stylesheet: "style.css", | ||||
|                 embed: false, | ||||
|                 client: false | ||||
|                 client: false, | ||||
|                 critical: "f", | ||||
|                 critical_enabled: true | ||||
|             } | ||||
|             if(subdomain[0] == "client") { | ||||
|                 data.client = true; | ||||
| @@ -157,7 +167,9 @@ function channel(req, res, next) { | ||||
|                 analytics: analytics, | ||||
|                 stylesheet: "style.css", | ||||
|                 embed: false, | ||||
|                 client: false | ||||
|                 client: false, | ||||
|                 critical: "f", | ||||
|                 critical_enabled: true | ||||
|             } | ||||
|             res.render('layouts/client/remote', data); | ||||
|         } else if(subdomain.length >= 2 && subdomain[0] == "www") { | ||||
| @@ -172,6 +184,8 @@ function channel(req, res, next) { | ||||
|                     analytics: analytics, | ||||
|                     stylesheet: "embed.css", | ||||
|                     embed: true, | ||||
|                     critical: "e", | ||||
|                     critical_enabled: false | ||||
|                 } | ||||
|                 res.render('layouts/client/embed', data); | ||||
|             } else if(req.params.channel_name == "o_callback") { | ||||
| @@ -186,7 +200,9 @@ function channel(req, res, next) { | ||||
|                     analytics: analytics, | ||||
|                     stylesheet: "style.css", | ||||
|                     embed: false, | ||||
|                     client:false | ||||
|                     client:false, | ||||
|                     critical: "c", | ||||
|                     critical_enabled: false | ||||
|                 } | ||||
|                 if(subdomain == "client") { | ||||
|                     data.client = true; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user