Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
versx committed Apr 26, 2020
1 parent 7b20aa6 commit 88353e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
19 changes: 10 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ const timezones = require('../static/data/timezones.json');
// TODO: Delete all logs button
// TODO: Secure /api/config endpoint with token
// TODO: Accomodate for # in uuid name
// TODO: Localization
// TODO: Fix schedule end time
// TODO: Center align data in table columns
// TODO: Change require to import

const providers = [
{ name: 'GoCheats' },
{ name: 'Kevin' },
]
];

run();

Expand Down Expand Up @@ -67,20 +66,22 @@ app.use(i18n.init);
// register helper as a locals function wrapped as mustache expects
app.use(function (req, res, next) {
// mustache helper
res.locals.__ = function () {
return function (text, render) {
res.locals.__ = function() {
/* eslint-disable no-unused-vars */
return function(text, render) {
return i18n.__.apply(req, arguments);
};
};
next();
/* eslint-disable no-unused-vars */
};
next();
});

// Default mustache data shared between pages
const defaultData = require('../static/locales/' + config.locale + '.json');
defaultData.title = config.title;
defaultData.locale = config.locale,
defaultData.style = config.style == 'dark' ? 'dark' : '',
defaultData.logging = config.logging.enabled
defaultData.locale = config.locale;
defaultData.style = config.style == 'dark' ? 'dark' : '';
defaultData.logging = config.logging.enabled;

i18n.setLocale(config.locale);

Expand Down
8 changes: 4 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ function buildConfig(backendUrl, dataEndpoints, token, heartbeatMaxTime, minDela
}

function saveDataAsImage(name, imgData) {
var data = imgData.replace(/^data:image\/\w+;base64,/, "");
var data = imgData.replace(/^data:image\/\w+;base64,/, '');
var buf = new Buffer(data, 'base64');
fs.writeFileSync('../screenshots/' + name, buf);
}

function formatBytes(bytes) {
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes === 0) {
return 0;
}
const index = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
if (index == 0) {
return bytes + " " + sizes[index];
return bytes + ' ' + sizes[index];
}
return (bytes / Math.pow(1024, index)).toFixed(1) + " " + sizes[index];
return (bytes / Math.pow(1024, index)).toFixed(1) + ' ' + sizes[index];
}

module.exports = {
Expand Down

0 comments on commit 88353e5

Please sign in to comment.