Commit 43156a6e authored by yPhil's avatar yPhil

Sys: Tests: npm update

parent 4c181a73
This diff is collapsed.
......@@ -14,22 +14,14 @@
"scripts": {
"start": "pm2 start pm2.config.json",
"stop": "pm2 stop petrolette",
"build:pre": "uglifyjs public/js/PTL.main.js public/js/PTL.prefs.js public/js/PTL.i18n.js -m -o dist/js/PTL.pre.min.js",
"build:post": "uglifyjs public/js/PTL.util.js public/js/PTL.tab.js public/js/PTL.src.js public/js/PTL.dialog.js public/js/PTL.sync.js -m -o dist/js/PTL.post.min.js",
"build:js": "mkdir -p dist/js cache-favicons && npm run build:pre && npm run build:post",
"watch:js": "onchange 'public/js/*.js' -- npm run build:js",
"postinstall": "bower install"
},
"devDependencies": {
"onchange": "3.3.0",
"uglify-es": "3.3.9"
},
"dependencies": {
"bower": "1.8.2",
"ejs": "2.5.7",
"express": "4.16.2",
"favrat": "0.0.7",
"feedparser": "2.2.9",
"favrat": "0.0.1",
"feedrat": "latest",
"pm2": "2.8.0"
}
......
......@@ -39,6 +39,8 @@ PTL.dialog = {
$(this).find('.help-button').button();
$(this).find('.help-bookmarklet').attr('href', 'javascript:void(window.open("' + document.URL + '?source=" + window.location.href))');
$('.help-tour').on('click', function() {
PTL.sideMenu('close');
PTL.dialog.kill($dialog);
......
......@@ -120,20 +120,19 @@ PTL.src = {
$(this).data('img', iconImg);
},
function() {
}, function() {
$feedIcon.removeClass('icon-down-big');
$feedIcon.removeClass('icon-down-big');
// $feedIcon.css('background-image', iconImg);
// $feedIcon.css('background-image', iconImg);
if ($(this).data('img') !== 'none') {
$feedToggle.css('background-image', $(this).data('img'));
} else {
$feedIcon.addClass('icon-rss');
}
if ($(this).data('img') !== 'none') {
$feedToggle.css('background-image', $(this).data('img'));
} else {
$feedIcon.addClass('icon-rss');
}
});
});
if (!PTL.util.isMobile()) {
$selectDiv.addClass('collapsible');
......@@ -216,18 +215,17 @@ PTL.src = {
$feedIcon.removeClass('icon-rss');
$header.data('img',icon);
// var img = new Image();
var img = new Image();
img.src = icon;
// img.src = icon;
img.onerror = function() {
$feedIcon.addClass('icon-rss yowza');
$feedToggle.css('background-image', 'none');
};
// img.onerror = function() {
// $feedIcon.addClass('icon-rss yowza');
// $feedToggle.css('background-image', 'none');
// };
}).fail(function(err) {
console.log('err: %s (%s)', err.statusText, feedHost);
// console.log('err: %s (%s)', err.statusText, feedHost);
$feedIcon.addClass('icon-rss yowzo');
$feedToggle.css('background-image', 'none');
});
......
......@@ -228,7 +228,7 @@
<span class="dialog translate"
data-content="You can also drag this button to your bookmark toolbar, and click it when you want to add a website to Pétrolette">
You can also drag this button to your bookmark toolbar, and click it when you want to add a website to Pétrolette</span>:
<a href="javascript:void(var allParagraphs = document.querySelectorAll('p') ; window.open('http://petrolette.space/?source=' + window.location.href))"
<a href="#"
icon="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABp0lEQVRYhe2WO0sDURCFT2Z28QeonZ2N9qKVmMrsfaSwiI9S24D2QkC0zS+wF2zVUhCbIHb2FoJ2IlYpbPRYKEnWu5tofGCxF7YZZs/5zuywXNDoBq3c02qLPirjlw99VKbV1rvnOujkkU7ZeYwc0mBioFANykTXmOgqa9CB/QYTNHKY8nLyAHq9SBeVtNKmwTYNRvok2eu+E+32MR6hwTattEMfbYEG4/RyQCsvQYOTa1r4TGGrZz1CZ9k98HRynRHwhV4OaDDekyiepdPLEEJJp6d0mE4n0/PuZ9PzD6kn6fUkW6t0xQrms8dVg9KiHuzFG/UTDRqDAGjQoJWnjGk+0qL+mX0Bqxijk306eQ6EKlGSB8BFmAzjZzrZZxVjA40DEBvPBEvqsZUL4LGV7tUL2njmy8bhNIYEGCZ1AVAAFAAFQAFQAAQASxhNiSbYzAVIsJnqXcLo9wF2ILRy15NqIRfAR+VuTW4JlL4NAAB0mKaLmqzocqeWeyPSFbqoySqmfsQ8F6rPnfBPTgFQAPwHgOOen87R3wMsxnO0ckMrN/Tx7LA6r5V4Lpl2TCixAAAAAElFTkSuQmCC"
class="help-button help-bookmarklet translate icon-petrolette"
data-title="Drag to the bookmark bar"
......
......@@ -9,6 +9,10 @@ var express = require('express'),
crypto = require('crypto'),
pjson = require('../package.json');
const defaults = {
encoding: null
};
router.get('/', function(req, res) {
res.render('index', {
queryString:req.query.source,
......@@ -99,33 +103,15 @@ router.get('/favicon', function(req, res) {
var fileName = hash + '.favicon';
var filePath = path.join(process.env.FAVICONS_CACHE_DIR, fileName);
console.log('# %s (%s)', iconUrl, fileName);
// res.send(iconUrl);
if (fs.existsSync(filePath)) {
console.log('File exists');
res.contentType(filePath);
res.send('/favicons/' + fileName);
} else {
res.send(iconUrl);
res.send(iconUrl);
// if (fs.existsSync(filePath)) {
// res.send('/favicons/' + fileName);
console.log('File does NOT exist');
let stream = fs.createWriteStream(filePath);
request(iconUrl).pipe(stream);
stream.on('finish', function () {
console.log("SAVED %s to %s (%s)", fileName, filePath, iconUrl);
}).on('error', function (err) {
console.log("NOT SAVED %s (%s)", fileName, err);
});
}
// } else {
// res.send(iconUrl);
// request.get(iconUrl).pipe(fs.createWriteStream(filePath));
// }
} else {
res.status(500).send('No icon found');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment