updated logo
This commit is contained in:
parent
00878cd665
commit
331b0c9764
10 changed files with 17 additions and 104 deletions
|
@ -69,79 +69,6 @@ module.exports = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getStatsSummary (startDate) {
|
|
||||||
logger.debug('retrieving request records');
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
// get the raw Requests data
|
|
||||||
db.Request
|
|
||||||
.findAll({
|
|
||||||
where: {
|
|
||||||
createdAt: {
|
|
||||||
gt: startDate,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
let resultHashTable = {};
|
|
||||||
let totalServe = 0;
|
|
||||||
let totalPublish = 0;
|
|
||||||
let totalShow = 0;
|
|
||||||
let totalCount = 0;
|
|
||||||
let totalSuccess = 0;
|
|
||||||
let totalFailure = 0;
|
|
||||||
let percentSuccess;
|
|
||||||
// summarise the data
|
|
||||||
for (let i = 0; i < data.length; i++) {
|
|
||||||
let key = data[i].action + data[i].url;
|
|
||||||
totalCount += 1;
|
|
||||||
switch (data[i].action) {
|
|
||||||
case 'SERVE':
|
|
||||||
totalServe += 1;
|
|
||||||
break;
|
|
||||||
case 'PUBLISH':
|
|
||||||
totalPublish += 1;
|
|
||||||
break;
|
|
||||||
case 'SHOW':
|
|
||||||
totalShow += 1;
|
|
||||||
break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
if (resultHashTable[key]) {
|
|
||||||
resultHashTable[key]['count'] += 1;
|
|
||||||
if (data[i].result === 'success') {
|
|
||||||
resultHashTable[key]['success'] += 1;
|
|
||||||
totalSuccess += 1;
|
|
||||||
} else {
|
|
||||||
resultHashTable[key]['failure'] += 1;
|
|
||||||
totalFailure += 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resultHashTable[key] = {
|
|
||||||
action : data[i].action,
|
|
||||||
url : data[i].url,
|
|
||||||
count : 1,
|
|
||||||
success: 0,
|
|
||||||
failure: 0,
|
|
||||||
};
|
|
||||||
if (data[i].result === 'success') {
|
|
||||||
resultHashTable[key]['success'] += 1;
|
|
||||||
totalSuccess += 1;
|
|
||||||
} else {
|
|
||||||
resultHashTable[key]['failure'] += 1;
|
|
||||||
totalFailure += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
percentSuccess = Math.round(totalSuccess / totalCount * 100);
|
|
||||||
// return results
|
|
||||||
resolve({ records: resultHashTable, totals: { totalServe, totalPublish, totalShow, totalCount, totalSuccess, totalFailure }, percentSuccess });
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
logger.error('sequelize error >>', error);
|
|
||||||
reject(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getTrendingClaims (startDate) {
|
getTrendingClaims (startDate) {
|
||||||
logger.debug('retrieving trending requests');
|
logger.debug('retrieving trending requests');
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
|
@ -77,7 +77,7 @@ h2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
.h2--secondary {
|
.h2--secondary {
|
||||||
color: #9b9b9b;
|
color: lightgrey;
|
||||||
}
|
}
|
||||||
|
|
||||||
.h2--top {
|
.h2--top {
|
||||||
|
@ -304,7 +304,6 @@ align-content-left {
|
||||||
/* ERROR MESSAGES */
|
/* ERROR MESSAGES */
|
||||||
|
|
||||||
.info-message {
|
.info-message {
|
||||||
font-weight: bold;
|
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0.3em;
|
padding: 0.3em;
|
||||||
|
|
|
@ -130,7 +130,6 @@ module.exports = (app) => {
|
||||||
return publish(publishParams, fileName, fileType);
|
return publish(publishParams, fileName, fileType);
|
||||||
})
|
})
|
||||||
.then(result => {
|
.then(result => {
|
||||||
// postToStats('publish', originalUrl, ip, null, null, 'success');
|
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
message: {
|
message: {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const errorHandlers = require('../helpers/errorHandlers.js');
|
const errorHandlers = require('../helpers/errorHandlers.js');
|
||||||
const { postToStats, getStatsSummary, getTrendingClaims, getRecentClaims } = require('../controllers/statsController.js');
|
const { getTrendingClaims, getRecentClaims } = require('../controllers/statsController.js');
|
||||||
|
|
||||||
module.exports = (app) => {
|
module.exports = (app) => {
|
||||||
// route to log out
|
// route to log out
|
||||||
|
@ -52,23 +52,6 @@ module.exports = (app) => {
|
||||||
errorHandlers.handleRequestError(null, null, null, error, res);
|
errorHandlers.handleRequestError(null, null, null, error, res);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// route to show statistics for spee.ch
|
|
||||||
app.get('/stats', ({ ip, originalUrl, user }, res) => {
|
|
||||||
// get and render the content
|
|
||||||
const startDate = new Date();
|
|
||||||
startDate.setDate(startDate.getDate() - 1);
|
|
||||||
getStatsSummary(startDate)
|
|
||||||
.then(result => {
|
|
||||||
postToStats('show', originalUrl, ip, null, null, 'success');
|
|
||||||
res.status(200).render('statistics', {
|
|
||||||
user,
|
|
||||||
result,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
errorHandlers.handleRequestError(null, null, null, error, res);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// route to send embedable video player (for twitter)
|
// route to send embedable video player (for twitter)
|
||||||
app.get('/embed/:claimId/:name', ({ params }, res) => {
|
app.get('/embed/:claimId/:name', ({ params }, res) => {
|
||||||
const claimId = params.claimId;
|
const claimId = params.claimId;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="row row--padded">
|
<div class="row row--padded">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h2>{{this.channelName}}<span class="h2--secondary">:{{this.longChannelId}}</span></h2>
|
<p>Below are the contents for {{this.channelName}}:{{this.longChannelId}}</p>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
{{#each this.claims}}
|
{{#each this.claims}}
|
||||||
{{> gridItem}}
|
{{> gridItem}}
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
{{#if this.previousPage}}
|
{{#if this.previousPage}}
|
||||||
<a class="link--primary" href="/{{this.channelName}}:{{this.longChannelId}}?p={{this.previousPage}}">Previous</a>
|
<a class="link--primary" href="/{{this.channelName}}:{{this.longChannelId}}?p={{this.previousPage}}">Previous</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
<a disabled>Previous </a>
|
<a disabled>Previous</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
|
||||||
{{#if this.nextPage}}
|
{{#if this.nextPage}}
|
||||||
|
@ -43,4 +43,5 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
|
@ -16,6 +16,8 @@
|
||||||
<meta property="og:image" content="https://spee.ch/assets/img/content-freedom-64px.png">
|
<meta property="og:image" content="https://spee.ch/assets/img/content-freedom-64px.png">
|
||||||
<meta property="og:url" content="http://spee.ch/">
|
<meta property="og:url" content="http://spee.ch/">
|
||||||
<meta property="og:description" content="Open-source, decentralized image and video hosting.">
|
<meta property="og:description" content="Open-source, decentralized image and video hosting.">
|
||||||
|
<!--google font-->
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300" rel="stylesheet">
|
||||||
<!-- google analytics -->
|
<!-- google analytics -->
|
||||||
{{ googleAnalytics }}
|
{{ googleAnalytics }}
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
{{{addTwitterCard fileInfo.fileType openGraphInfo.source openGraphInfo.embedUrl openGraphInfo.directFileUrl}}}
|
{{{addTwitterCard fileInfo.fileType openGraphInfo.source openGraphInfo.embedUrl openGraphInfo.directFileUrl}}}
|
||||||
{{{addOpenGraph fileInfo.title fileInfo.fileType openGraphInfo.showUrl openGraphInfo.source fileInfo.description fileInfo.thumbnail}}}
|
{{{addOpenGraph fileInfo.title fileInfo.fileType openGraphInfo.showUrl openGraphInfo.source fileInfo.description fileInfo.thumbnail}}}
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
<!--google font-->
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300" rel="stylesheet">
|
||||||
<!-- google analytics -->
|
<!-- google analytics -->
|
||||||
{{ googleAnalytics }}
|
{{ googleAnalytics }}
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
<g id="About">
|
<g id="About">
|
||||||
<g id="Publish-Form-V2-_x28_filled_x29_" transform="translate(-42.000000, -23.000000)">
|
<g id="Publish-Form-V2-_x28_filled_x29_" transform="translate(-42.000000, -23.000000)">
|
||||||
<g id="Group-17" transform="translate(42.000000, 22.000000)">
|
<g id="Group-17" transform="translate(42.000000, 22.000000)">
|
||||||
<text transform="matrix(1 0 0 1 0 20)" font-size="27">Spee<h</text>
|
<text transform="matrix(1 0 0 1 0 20)" font-size="25" font-family="Roboto">Spee<h</text>
|
||||||
<g id="Group-16" transform="translate(0.000000, 30.000000)">
|
<g id="Group-16" transform="translate(0.000000, 30.000000)">
|
||||||
<path id="Line-8" fill="none" stroke="#09F911" stroke-linecap="square" d="M0.5,1.5h15"/>
|
<path id="Line-8" fill="none" stroke="#09F911" stroke-width="1" stroke-linecap="square" d="M0.5,1.5h15"/>
|
||||||
<path id="Line-8-Copy" fill="none" stroke="#029D74" stroke-linecap="square" d="M16.5,1.5h15"/>
|
<path id="Line-8-Copy" fill="none" stroke="#029D74" stroke-width="1" stroke-linecap="square" d="M16.5,1.5h15"/>
|
||||||
<path id="Line-8-Copy-2" fill="none" stroke="#E35BD8" stroke-linecap="square" d="M32.5,1.5h15"/>
|
<path id="Line-8-Copy-2" fill="none" stroke="#E35BD8" stroke-width="1" stroke-linecap="square" d="M32.5,1.5h15"/>
|
||||||
<path id="Line-8-Copy-3" fill="none" stroke="#4156C5" stroke-linecap="square" d="M48.5,1.5h15"/>
|
<path id="Line-8-Copy-3" fill="none" stroke="#4156C5" stroke-width="1" stroke-linecap="square" d="M48.5,1.5h15"/>
|
||||||
<path id="Line-8-Copy-4" fill="none" stroke="#635688" stroke-linecap="square" d="M64.5,1.5h15"/>
|
<path id="Line-8-Copy-4" fill="none" stroke="#635688" stroke-width="1" stroke-linecap="square" d="M64.5,1.5h15"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="row" id="publish-thumbnail" hidden="true">
|
<div class="row row--padded row--wide row--no-top" id="publish-thumbnail" hidden="true">
|
||||||
<div class="column column--3 column--sml-10">
|
<div class="column column--3 column--sml-10">
|
||||||
<label class="label">Thumbnail:</label>
|
<label class="label">Thumbnail:</label>
|
||||||
</div><div class="column column--6 column--sml-10">
|
</div><div class="column column--6 column--sml-10">
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<div id="new-release-banner" class="row row--short row--wide">
|
<div id="new-release-banner" class="row row--short row--wide">
|
||||||
Hi there! You've stumbled upon the new version of spee<h, launching soon! Send us your feedback in <a style="color:white; text-decoration: underline" target="_blank" href="https://discord.gg/YjYbwhS">our discord</a>
|
Hi there! You've stumbled upon the new version of Spee<h, launching soon! Send us your feedback in <a style="color:white; text-decoration: underline" target="_blank" href="https://discord.gg/YjYbwhS">our discord</a>
|
||||||
</div>
|
</div>
|
Loading…
Reference in a new issue