mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Started work on fetching frontpage-lists at the same time as sending the html
This commit is contained in:
@@ -899,10 +899,6 @@ nav .zbrand{
|
|||||||
height: 120px;
|
height: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#channels{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.white-bg{
|
.white-bg{
|
||||||
background-color:white !important;
|
background-color:white !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ var Frontpage = {
|
|||||||
if(window.location.hostname == "fb.zoff.me") {
|
if(window.location.hostname == "fb.zoff.me") {
|
||||||
add = "https://zoff.me";
|
add = "https://zoff.me";
|
||||||
}
|
}
|
||||||
Helper.ajax({
|
/*Helper.ajax({
|
||||||
url: add + "/api/frontpages",
|
url: add + "/api/frontpages",
|
||||||
method: "get",
|
method: "get",
|
||||||
success: function(response){
|
success: function(response){
|
||||||
@@ -282,7 +282,7 @@ var Frontpage = {
|
|||||||
Frontpage.get_frontpage_lists();
|
Frontpage.get_frontpage_lists();
|
||||||
}, 3000);
|
}, 3000);
|
||||||
},
|
},
|
||||||
});
|
});*/
|
||||||
},
|
},
|
||||||
|
|
||||||
start_snowfall: function() {
|
start_snowfall: function() {
|
||||||
|
|||||||
@@ -1,26 +1,31 @@
|
|||||||
|
|
||||||
<li class="chan-card col s6 m4 l4">
|
<li class="chan-card col s6 m4 l4">
|
||||||
<div class="card sticky-action">
|
<div class="card sticky-action">
|
||||||
<a class="chan-link">
|
<a id="chan-link" href="{{_id}}/">
|
||||||
<div class="chan-bg card-image cardbg"></div>
|
<div class="chan-bg card-image cardbg" style="background-image:url({{thumbnail}});"></div>
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
|
{{#if pinned}}
|
||||||
<i class="material-icons pin">star_rate</i>
|
<i class="material-icons pin">star_rate</i>
|
||||||
|
{{/if}}
|
||||||
<p class="left-align">
|
<p class="left-align">
|
||||||
<span class="chan-name flow-text truncate"></span>
|
<span class="chan-name flow-text truncate">{{_id}}</span>
|
||||||
<br>
|
<br>
|
||||||
<span class="highlighted">Viewers: </span>
|
<span class="highlighted">Viewers: </span>
|
||||||
<span class="chan-views"></span>
|
<span class="chan-views">{{viewers}}</span>
|
||||||
<br>
|
<br>
|
||||||
<span class="highlighted">Songs: </span>
|
<span class="highlighted">Songs: </span>
|
||||||
<span class="chan-songs"></span>
|
<span class="chan-songs">{{count}}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-action noselect">
|
<div class="card-action noselect">
|
||||||
<span class="chan-link-element waves-effect waves-orange btn-flat">Listen</span>
|
<span class="chan-link-element waves-effect waves-orange btn-flat">Listen</span>
|
||||||
</div>
|
</div>
|
||||||
|
{{#if description}}
|
||||||
<div class="card-reveal">
|
<div class="card-reveal">
|
||||||
<span class="card-title grey-text text-darken-4 truncate"></span>
|
<span class="card-title grey-text text-darken-4 truncate">{{_id}}</span>
|
||||||
<p class="description_text"></p>
|
<p class="description_text">{{description}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<div id="channel-list-container">
|
<div id="channel-list-container">
|
||||||
<ul class="row" id="channels">
|
<ul class="row" id="channels">
|
||||||
|
{{#each channels}}
|
||||||
|
{{#if frontpage}}
|
||||||
{{> frontpage/channel}}
|
{{> frontpage/channel}}
|
||||||
|
{{/if}}
|
||||||
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,10 @@
|
|||||||
<a href="#" class="brand-logo">
|
<a href="#" class="brand-logo">
|
||||||
<img class="zicon" src="/assets/images/z.svg" alt="zoff" title="Zoff" />
|
<img class="zicon" src="/assets/images/z.svg" alt="zoff" title="Zoff" />
|
||||||
</a>
|
</a>
|
||||||
<div id="frontpage-viewer-counter" class="noselect" title="Divided among all channels. Hidden or not"></div>
|
<div id="frontpage-viewer-counter" class="noselect" title="Divided among all channels. Hidden or not">
|
||||||
|
<i class="material-icons frontpage-viewers">visibility</i>
|
||||||
|
{{viewers}}
|
||||||
|
</div>
|
||||||
<ul class="right">
|
<ul class="right">
|
||||||
{{#if client}}
|
{{#if client}}
|
||||||
<li><a class="header-buttons waves-effect waves-orange orange" id="client-mode-button" title="Client mode" href="https://zoff.me">Client</a></li>
|
<li><a class="header-buttons waves-effect waves-orange orange" id="client-mode-button" title="Client mode" href="https://zoff.me">Client</a></li>
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ var analytics = "xx";
|
|||||||
var mongojs = require('mongojs');
|
var mongojs = require('mongojs');
|
||||||
var token_db = mongojs("tokens");
|
var token_db = mongojs("tokens");
|
||||||
var Functions = require(pathThumbnails + '/handlers/functions.js');
|
var Functions = require(pathThumbnails + '/handlers/functions.js');
|
||||||
|
|
||||||
|
var db = require(pathThumbnails + '/handlers/db.js');
|
||||||
//var db = require(pathThumbnails + '/handlers/db.js');
|
//var db = require(pathThumbnails + '/handlers/db.js');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -142,14 +144,67 @@ function root(req, res, next) {
|
|||||||
embed: false,
|
embed: false,
|
||||||
client: false,
|
client: false,
|
||||||
og_image: "https://zoff.me/assets/images/small-square.jpg",
|
og_image: "https://zoff.me/assets/images/small-square.jpg",
|
||||||
|
channels: [],
|
||||||
}
|
}
|
||||||
if(subdomain[0] == "client") {
|
if(subdomain[0] == "client") {
|
||||||
data.client = true;
|
data.client = true;
|
||||||
}
|
}
|
||||||
|
var project_object = {
|
||||||
|
"_id": 1,
|
||||||
|
"count": 1,
|
||||||
|
"frontpage": 1,
|
||||||
|
"id": 1,
|
||||||
|
"title": 1,
|
||||||
|
"viewers": 1,
|
||||||
|
"pinned": 1,
|
||||||
|
"description": 1,
|
||||||
|
"thumbnail": {
|
||||||
|
$ifNull: [ {$cond: {
|
||||||
|
"if": {
|
||||||
|
"$or": [
|
||||||
|
{ "$eq": [ "$thumbnail", ""] },
|
||||||
|
{ "$eq": [ "$thumbnail", null] },
|
||||||
|
{ "$eq": [ "$thumbnail", undefined] }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
then: {
|
||||||
|
$concat : [ "https://img.youtube.com/vi/", "$id", "/mqdefault.jpg"]
|
||||||
|
},
|
||||||
|
else: "$thumbnail"
|
||||||
|
}}, { $concat : [ "https://img.youtube.com/vi/", "$id", "/mqdefault.jpg"]}]
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
db.collection("frontpage_lists").aggregate([
|
||||||
|
{
|
||||||
|
"$match": {
|
||||||
|
frontpage: true,
|
||||||
|
count: {$gt: 0},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$project": project_object
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$sort" : {
|
||||||
|
"pinned": -1,
|
||||||
|
"count": -1,
|
||||||
|
"accessed": -1,
|
||||||
|
"title": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
], function(err, docs) {
|
||||||
|
db.collection("connected_users").find({"_id": "total_users"}, function(err, tot) {
|
||||||
|
data.channels = docs.slice(0, 12);
|
||||||
|
data.channel_list = docs;
|
||||||
|
data.viewers = tot[0].total_users.length;
|
||||||
res.render('layouts/client/frontpage', data);
|
res.render('layouts/client/frontpage', data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
//console.log(e);
|
console.log(e);
|
||||||
//res.redirect("https://zoff.me");
|
//res.redirect("https://zoff.me");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user