You've already forked hastebin-ansi
mirror of
https://github.com/armbian/hastebin-ansi.git
synced 2026-01-06 12:30:55 -08:00
Fix eslint
This commit is contained in:
2
.eslintignore
Normal file
2
.eslintignore
Normal file
@@ -0,0 +1,2 @@
|
||||
**/*.min.js
|
||||
config.js
|
||||
511
package-lock.json
generated
Normal file
511
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
24
server.js
24
server.js
@@ -1,5 +1,4 @@
|
||||
var http = require('http');
|
||||
var url = require('url');
|
||||
var fs = require('fs');
|
||||
|
||||
var winston = require('winston');
|
||||
@@ -19,7 +18,10 @@ config.host = process.env.HOST || config.host || 'localhost';
|
||||
if (config.logging) {
|
||||
try {
|
||||
winston.remove(winston.transports.Console);
|
||||
} catch(er) { }
|
||||
} catch(e) {
|
||||
/* was not present */
|
||||
}
|
||||
|
||||
var detail, type;
|
||||
for (var i = 0; i < config.logging.length; i++) {
|
||||
detail = config.logging[i];
|
||||
@@ -52,16 +54,14 @@ else {
|
||||
|
||||
// Compress the static javascript assets
|
||||
if (config.recompressStaticAssets) {
|
||||
var jsp = require("uglify-js").parser;
|
||||
var pro = require("uglify-js").uglify;
|
||||
var jsp = require('uglify-js').parser;
|
||||
var pro = require('uglify-js').uglify;
|
||||
var list = fs.readdirSync('./static');
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
for (var j = 0; j < list.length; j++) {
|
||||
var item = list[i];
|
||||
var orig_code, ast;
|
||||
if ((item.indexOf('.js') === item.length - 3) &&
|
||||
(item.indexOf('.min.js') === -1)) {
|
||||
dest = item.substring(0, item.length - 3) + '.min' +
|
||||
item.substring(item.length - 3);
|
||||
if ((item.indexOf('.js') === item.length - 3) && (item.indexOf('.min.js') === -1)) {
|
||||
var dest = item.substring(0, item.length - 3) + '.min' + item.substring(item.length - 3);
|
||||
orig_code = fs.readFileSync('./static/' + item, 'utf8');
|
||||
ast = jsp.parse(orig_code);
|
||||
ast = pro.ast_mangle(ast);
|
||||
@@ -113,17 +113,17 @@ if (config.rateLimits) {
|
||||
// first look at API calls
|
||||
app.use(route(function(router) {
|
||||
// get raw documents - support getting with extension
|
||||
router.get('/raw/:id', function(request, response, next) {
|
||||
router.get('/raw/:id', function(request, response) {
|
||||
var key = request.params.id.split('.')[0];
|
||||
var skipExpire = !!config.documents[key];
|
||||
return documentHandler.handleRawGet(key, response, skipExpire);
|
||||
});
|
||||
// add documents
|
||||
router.post('/documents', function(request, response, next) {
|
||||
router.post('/documents', function(request, response) {
|
||||
return documentHandler.handlePost(request, response);
|
||||
});
|
||||
// get documents
|
||||
router.get('/documents/:id', function(request, response, next) {
|
||||
router.get('/documents/:id', function(request, response) {
|
||||
var key = request.params.id.split('.')[0];
|
||||
var skipExpire = !!config.documents[key];
|
||||
return documentHandler.handleGet(key, response, skipExpire);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* global describe, it */
|
||||
|
||||
var DocumentHandler = require('../lib/document_handler');
|
||||
var Generator = require('../lib/key_generators/random');
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* global it, describe, afterEach */
|
||||
|
||||
var RedisDocumentStore = require('../lib/document_stores/redis');
|
||||
|
||||
var winston = require('winston');
|
||||
@@ -12,7 +14,7 @@ describe('redis_document_store', function() {
|
||||
RedisDocumentStore.client = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
describe('set', function() {
|
||||
|
||||
it('should be able to set a key and have an expiration set', function(done) {
|
||||
@@ -37,7 +39,7 @@ describe('redis_document_store', function() {
|
||||
|
||||
it('should not set an expiration when expiration is off', function(done) {
|
||||
var store = new RedisDocumentStore({ expire: false });
|
||||
store.set('hello3', 'world', function(worked) {
|
||||
store.set('hello3', 'world', function() {
|
||||
RedisDocumentStore.client.ttl('hello3', function(err, res) {
|
||||
res.should.equal(-1);
|
||||
done();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* global $, hljs, window, document */
|
||||
|
||||
///// represents a single document
|
||||
|
||||
var haste_document = function() {
|
||||
@@ -42,10 +44,10 @@ haste_document.prototype.load = function(key, callback, lang) {
|
||||
value: high.value,
|
||||
key: key,
|
||||
language: high.language || lang,
|
||||
lineCount: res.data.split("\n").length
|
||||
lineCount: res.data.split('\n').length
|
||||
});
|
||||
},
|
||||
error: function(err) {
|
||||
error: function() {
|
||||
callback(false);
|
||||
}
|
||||
});
|
||||
@@ -71,7 +73,7 @@ haste_document.prototype.save = function(data, callback) {
|
||||
value: high.value,
|
||||
key: res.key,
|
||||
language: high.language,
|
||||
lineCount: data.split("\n").length
|
||||
lineCount: data.split('\n').length
|
||||
});
|
||||
},
|
||||
error: function(res) {
|
||||
@@ -276,7 +278,7 @@ haste.prototype.configureButtons = function() {
|
||||
$where: $('#box2 .new'),
|
||||
label: 'New',
|
||||
shortcut: function(evt) {
|
||||
return evt.ctrlKey && evt.keyCode === 78
|
||||
return evt.ctrlKey && evt.keyCode === 78;
|
||||
},
|
||||
shortcutDescription: 'control + n',
|
||||
action: function() {
|
||||
@@ -331,14 +333,14 @@ haste.prototype.configureButton = function(options) {
|
||||
}
|
||||
});
|
||||
// Show the label
|
||||
options.$where.mouseenter(function(evt) {
|
||||
options.$where.mouseenter(function() {
|
||||
$('#box3 .label').text(options.label);
|
||||
$('#box3 .shortcut').text(options.shortcutDescription || '');
|
||||
$('#box3').show();
|
||||
$(this).append($('#pointer').remove().show());
|
||||
});
|
||||
// Hide the label
|
||||
options.$where.mouseleave(function(evt) {
|
||||
options.$where.mouseleave(function() {
|
||||
$('#box3').hide();
|
||||
$('#pointer').hide();
|
||||
});
|
||||
@@ -371,7 +373,7 @@ $(function() {
|
||||
// For browsers like Internet Explorer
|
||||
if (document.selection) {
|
||||
this.focus();
|
||||
sel = document.selection.createRange();
|
||||
var sel = document.selection.createRange();
|
||||
sel.text = myValue;
|
||||
this.focus();
|
||||
}
|
||||
|
||||
2
static/application.min.js
vendored
2
static/application.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user