From 1ec31c694260321a4be439387f46a6cf48adc617 Mon Sep 17 00:00:00 2001 From: Jason Green Date: Thu, 21 Nov 2013 12:10:38 +0000 Subject: [PATCH 01/13] added rel=0 to youtube plugin --- plugins/domains/youtube.com.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/domains/youtube.com.js b/plugins/domains/youtube.com.js index 9d916d4c9..f460b19b2 100644 --- a/plugins/domains/youtube.com.js +++ b/plugins/domains/youtube.com.js @@ -71,7 +71,7 @@ module.exports = { width: 480, height: 360 }, { - href: '//www.youtube.com/embed/' + youtube_gdata.id, + href: '//www.youtube.com/embed/' + youtube_gdata.id + '?rel=0', rel: CONFIG.R.player, type: CONFIG.T.text_html, "aspect-ratio": (youtube_gdata.aspectRatio === "widescreen") ? 16/9 : 4/3 From 4b9522581892b956505ba8502eedd5b194655c0d Mon Sep 17 00:00:00 2001 From: Jason Green Date: Mon, 6 Oct 2014 12:22:50 +0100 Subject: [PATCH 02/13] [Jason, Evgeny] bash scripts --- .gitignore | 2 +- iframelyRestart.sh | 2 ++ iframelyStart.sh | 4 ++++ iframelyUpdate.sh | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 iframelyRestart.sh create mode 100644 iframelyStart.sh create mode 100644 iframelyUpdate.sh diff --git a/.gitignore b/.gitignore index 621824cd8..d03bd6c38 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,6 @@ config.local.js test/test2.js static/test iframely-*.json - +logs node_modules083 node_modules2 diff --git a/iframelyRestart.sh b/iframelyRestart.sh new file mode 100644 index 000000000..aabab4b33 --- /dev/null +++ b/iframelyRestart.sh @@ -0,0 +1,2 @@ +#!/bin/bash +forever restartall diff --git a/iframelyStart.sh b/iframelyStart.sh new file mode 100644 index 000000000..a5ae49b8e --- /dev/null +++ b/iframelyStart.sh @@ -0,0 +1,4 @@ +#!/bin/bash +NOW=$(date +"%m-%d-%Y") +mv ~/.forever/iframely.log ~/.forever/iframely.log-$NOW +forever start -l iframely.log server.js diff --git a/iframelyUpdate.sh b/iframelyUpdate.sh new file mode 100644 index 000000000..4523808c1 --- /dev/null +++ b/iframelyUpdate.sh @@ -0,0 +1,3 @@ +#!/bin/bash +git pull +npm install From 60f4f56d4b64ce75c28368f84e170fd2cd44b14f Mon Sep 17 00:00:00 2001 From: Fabio Manera Date: Fri, 21 Nov 2014 14:44:24 +0000 Subject: [PATCH 03/13] chmod a+x iframe*.sh --- iframelyRestart.sh | 0 iframelyStart.sh | 0 iframelyUpdate.sh | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 iframelyRestart.sh mode change 100644 => 100755 iframelyStart.sh mode change 100644 => 100755 iframelyUpdate.sh diff --git a/iframelyRestart.sh b/iframelyRestart.sh old mode 100644 new mode 100755 diff --git a/iframelyStart.sh b/iframelyStart.sh old mode 100644 new mode 100755 diff --git a/iframelyUpdate.sh b/iframelyUpdate.sh old mode 100644 new mode 100755 From 604b30a18224de03a56bf90d854332cc2fe8e369 Mon Sep 17 00:00:00 2001 From: Fabio Manera Date: Fri, 21 Nov 2014 15:05:02 +0000 Subject: [PATCH 04/13] only roll iframely.log if it exists --- iframelyStart.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/iframelyStart.sh b/iframelyStart.sh index a5ae49b8e..63507802f 100755 --- a/iframelyStart.sh +++ b/iframelyStart.sh @@ -1,4 +1,3 @@ #!/bin/bash -NOW=$(date +"%m-%d-%Y") -mv ~/.forever/iframely.log ~/.forever/iframely.log-$NOW +[ -f ~/.forever/iframely.log ] && mv ~/.forever/iframely.log ~/.forever/iframely.log-`date +"%m-%d-%Y"` forever start -l iframely.log server.js From 722e33a7c78ffd8f44019a4f5f2dac0a9a517432 Mon Sep 17 00:00:00 2001 From: Fabio Manera Date: Wed, 3 Dec 2014 11:00:58 +0000 Subject: [PATCH 05/13] retrieve oembed straight from instagram (so auto-resizing for mobile works) --- plugins/domains/instagram.com.js | 81 ++++++++++++++++---------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/plugins/domains/instagram.com.js b/plugins/domains/instagram.com.js index 4f0218b02..8de2b570a 100644 --- a/plugins/domains/instagram.com.js +++ b/plugins/domains/instagram.com.js @@ -1,3 +1,6 @@ +var http = require('http'); +var rurl = require('url'); + module.exports = { re: [ @@ -14,51 +17,47 @@ module.exports = { "favicon" ], - getLinks: function(urlMatch, meta) { - var src = 'http://instagram.com/p/' + urlMatch[1] + '/media/?size='; - var embed = '//instagram.com/p/' + urlMatch[1] + '/embed/'; + provides: 'instagram_oembed', + + getData: function(url, cb) { + var ops = rurl.parse("http://api.instagram.com/oembed"); + ops.query = { + beta: true, + url: url + }; + + iurl = rurl.format(ops); + + http.get(iurl, + function(res) { + + if (res.statusCode != 200) { + return cb(res.statusCode); + } - var links = [ - { - href: embed, - type: CONFIG.T.text_html, - rel: (meta.og && meta.og.video) ? [CONFIG.R.player, CONFIG.R.html5]: CONFIG.R.app, - width: 616, - height: 714 - }, - // Images. - { - href: src + 't', - type: CONFIG.T.image, - rel: CONFIG.R.thumbnail, - width: 150, - height: 150 - }, { - href: src + 'm', - type: CONFIG.T.image, - rel: CONFIG.R.thumbnail, - width: 306, - height: 306 - }, { - href: src + 'l', - type: CONFIG.T.image, - rel: (meta.og && meta.og.video) ? CONFIG.R.thumbnail : CONFIG.R.image, - width: 612, - height: 612 - }]; + var chunks = []; + res.on('data', function(chunk) { chunks.push(chunk); }); - if (meta.og && meta.og.video) { - links.push({ - href: meta.og.video.url || meta.og.video, - type: meta.og.video.type || CONFIG.T.maybe_text_html, - rel: [CONFIG.R.player, CONFIG.R.html5], - "aspect-ratio": meta.og.video.width / meta.og.video.height, - "max-width": meta.og.video.width, - "max-height": meta.og.video.height + res.on('end', function () { + var oembed = JSON.parse(Buffer.concat(chunks)); + cb(null, { + title: oembed.title, + instagram_oembed: oembed + }); + }); + + }).on('error', function(e) { + cb("Got error: " + e.message); }); - } + }, + + getLink: function(instagram_oembed) { - return links; + return { + type: CONFIG.T.text_html, + html: instagram_oembed.html, + rel: [CONFIG.R.oembed, CONFIG.R.app, CONFIG.R.inline, CONFIG.R.ssl] + }; }, tests: [{ From 71a6436ce66f2e4932213cc166de6e8090831e78 Mon Sep 17 00:00:00 2001 From: Fabio Manera Date: Wed, 3 Dec 2014 16:54:41 +0000 Subject: [PATCH 06/13] wip: add wrapping div to centralize tweet --- plugins/domains/twitter.status.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/domains/twitter.status.js b/plugins/domains/twitter.status.js index 1cbba24c4..5863f3621 100644 --- a/plugins/domains/twitter.status.js +++ b/plugins/domains/twitter.status.js @@ -74,7 +74,7 @@ module.exports = { return { type: CONFIG.T.text_html, - html: twitter_oembed.html, + html: '
'+ twitter_oembed.html+'
', rel: [CONFIG.R.oembed, CONFIG.R.app, CONFIG.R.inline, CONFIG.R.ssl], "min-width": c["min-width"], "max-width": c["max-width"] From 6dcc6f49603799beaea15c015bc203a434d79374 Mon Sep 17 00:00:00 2001 From: Fabio Manera Date: Wed, 3 Dec 2014 17:55:44 +0000 Subject: [PATCH 07/13] Revert "wip: add wrapping div to centralize tweet " This reverts commit 71a6436ce66f2e4932213cc166de6e8090831e78. --- plugins/domains/twitter.status.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/domains/twitter.status.js b/plugins/domains/twitter.status.js index 5863f3621..1cbba24c4 100644 --- a/plugins/domains/twitter.status.js +++ b/plugins/domains/twitter.status.js @@ -74,7 +74,7 @@ module.exports = { return { type: CONFIG.T.text_html, - html: '
'+ twitter_oembed.html+'
', + html: twitter_oembed.html, rel: [CONFIG.R.oembed, CONFIG.R.app, CONFIG.R.inline, CONFIG.R.ssl], "min-width": c["min-width"], "max-width": c["max-width"] From d7b8746ec6366e8d714dd430fea83a45d5412ad8 Mon Sep 17 00:00:00 2001 From: Fabio Manera Date: Mon, 29 Dec 2014 10:22:25 +0000 Subject: [PATCH 08/13] set instagram socket timeout to 5 seconds --- plugins/domains/instagram.com.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/domains/instagram.com.js b/plugins/domains/instagram.com.js index 8de2b570a..e6ad95289 100644 --- a/plugins/domains/instagram.com.js +++ b/plugins/domains/instagram.com.js @@ -28,7 +28,7 @@ module.exports = { iurl = rurl.format(ops); - http.get(iurl, + var req = http.get(iurl, function(res) { if (res.statusCode != 200) { @@ -49,6 +49,13 @@ module.exports = { }).on('error', function(e) { cb("Got error: " + e.message); }); + + req.on('socket', function (socket) { + socket.setTimeout(5000); + socket.on('timeout', function() { + req.abort(); + }); + }); }, getLink: function(instagram_oembed) { From de3b125c9c3ffd4d81452a24b3abe146a4addbb5 Mon Sep 17 00:00:00 2001 From: Jason Green Date: Mon, 6 Oct 2014 12:22:50 +0100 Subject: [PATCH 09/13] [Jason, Evgeny] bash scripts --- .gitignore | 2 +- iframelyRestart.sh | 2 ++ iframelyStart.sh | 4 ++++ iframelyUpdate.sh | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 iframelyRestart.sh create mode 100644 iframelyStart.sh create mode 100644 iframelyUpdate.sh diff --git a/.gitignore b/.gitignore index 5f2472306..a529c687f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ config.local.js test/test2.js static/test iframely-*.json - +logs node_modules083 node_modules2 diff --git a/iframelyRestart.sh b/iframelyRestart.sh new file mode 100644 index 000000000..aabab4b33 --- /dev/null +++ b/iframelyRestart.sh @@ -0,0 +1,2 @@ +#!/bin/bash +forever restartall diff --git a/iframelyStart.sh b/iframelyStart.sh new file mode 100644 index 000000000..a5ae49b8e --- /dev/null +++ b/iframelyStart.sh @@ -0,0 +1,4 @@ +#!/bin/bash +NOW=$(date +"%m-%d-%Y") +mv ~/.forever/iframely.log ~/.forever/iframely.log-$NOW +forever start -l iframely.log server.js diff --git a/iframelyUpdate.sh b/iframelyUpdate.sh new file mode 100644 index 000000000..4523808c1 --- /dev/null +++ b/iframelyUpdate.sh @@ -0,0 +1,3 @@ +#!/bin/bash +git pull +npm install From 5465276cef56d10c6b37d1f88b3a8caea528b60a Mon Sep 17 00:00:00 2001 From: Fabio Manera Date: Fri, 21 Nov 2014 14:44:24 +0000 Subject: [PATCH 10/13] chmod a+x iframe*.sh --- iframelyRestart.sh | 0 iframelyStart.sh | 0 iframelyUpdate.sh | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 iframelyRestart.sh mode change 100644 => 100755 iframelyStart.sh mode change 100644 => 100755 iframelyUpdate.sh diff --git a/iframelyRestart.sh b/iframelyRestart.sh old mode 100644 new mode 100755 diff --git a/iframelyStart.sh b/iframelyStart.sh old mode 100644 new mode 100755 diff --git a/iframelyUpdate.sh b/iframelyUpdate.sh old mode 100644 new mode 100755 From 98d1ad4f4ca22941c093b3405fad45f2937d1d52 Mon Sep 17 00:00:00 2001 From: Fabio Manera Date: Fri, 21 Nov 2014 15:05:02 +0000 Subject: [PATCH 11/13] only roll iframely.log if it exists --- iframelyStart.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/iframelyStart.sh b/iframelyStart.sh index a5ae49b8e..63507802f 100755 --- a/iframelyStart.sh +++ b/iframelyStart.sh @@ -1,4 +1,3 @@ #!/bin/bash -NOW=$(date +"%m-%d-%Y") -mv ~/.forever/iframely.log ~/.forever/iframely.log-$NOW +[ -f ~/.forever/iframely.log ] && mv ~/.forever/iframely.log ~/.forever/iframely.log-`date +"%m-%d-%Y"` forever start -l iframely.log server.js From 02345e7775a6af4ab612866fc2fe2c2ba920e096 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Fri, 1 May 2020 07:19:57 +0100 Subject: [PATCH 12/13] fix: package.json & .snyk to reduce vulnerabilities The following vulnerabilities are fixed with a Snyk patch: - https://snyk.io/vuln/SNYK-JS-LODASH-567746 --- package.json | 127 +++++++++++++++++++++++++-------------------------- 1 file changed, 61 insertions(+), 66 deletions(-) diff --git a/package.json b/package.json index 94a3cd13e..21c71510f 100644 --- a/package.json +++ b/package.json @@ -1,68 +1,63 @@ { - "name": "iframely", - "version": "0.9.6", - - "description": "oEmbed/2 gateway endpoint. Get embed data for various http links through one self-hosted API", - "keywords": ["oembed", "embed", "open graph", "og", "twitter cards"], - "homepage": "http://iframely.com", - - "repository" : { - "type": "git", - "url": "https://github.com/itteco/iframely.git" - }, - - "bugs": { - "url": "https://github.com/itteco/iframely/issues" - }, - - "license": "MIT", - - "dependencies": { - - "jslint": "0.8", - "async": "1.4.2", - "underscore": "1.8.3", - "request": "2.72.x", - "express": "3.2.4", - "send": "0.1.0", - "connect": "2.7.9", - "ejs": "2.3.4", - "moment": "2.10.6", - "chokidar": "1.2.0", - "jsontoxml": "0.0.11", - - "sax": "1.1.3", - "htmlparser2": "3.8.x", - "entities": "1.1.x", - "imagesize": "1.0.0", - "iconv-lite": "0.4.13", - "mimelib": "0.2", - - "redis": "0.8.3", - "memcached": "2.2.*", - "node-cache": "1.0.3", - - "readabilitySAX":"1.6.1", - "cheerio": "0.19.0", - - "usage": "*" - }, - - "devDependencies": { - "vows": "~0.7.0", - "feedparser": "0.16", - "mongoose": "4.0.3" - }, - - "iframely-proxy-plugins": true, - - "main": "./lib/core", - - "scripts": { - "test": "vows test/main.js --isolate --spec" - }, - - "engines": { - "node": ">=0.10.21" - } + "name": "iframely", + "version": "0.9.6", + "description": "oEmbed/2 gateway endpoint. Get embed data for various http links through one self-hosted API", + "keywords": [ + "oembed", + "embed", + "open graph", + "og", + "twitter cards" + ], + "homepage": "http://iframely.com", + "repository": { + "type": "git", + "url": "https://github.com/itteco/iframely.git" + }, + "bugs": { + "url": "https://github.com/itteco/iframely/issues" + }, + "license": "MIT", + "dependencies": { + "jslint": "0.8", + "async": "1.4.2", + "underscore": "1.8.3", + "request": "2.72.x", + "express": "3.2.4", + "send": "0.1.0", + "connect": "2.7.9", + "ejs": "2.3.4", + "moment": "2.10.6", + "chokidar": "1.2.0", + "jsontoxml": "0.0.11", + "sax": "1.1.3", + "htmlparser2": "3.8.x", + "entities": "1.1.x", + "imagesize": "1.0.0", + "iconv-lite": "0.4.13", + "mimelib": "0.2", + "redis": "0.8.3", + "memcached": "2.2.*", + "node-cache": "1.0.3", + "readabilitySAX": "1.6.1", + "cheerio": "0.19.0", + "usage": "*", + "snyk": "^1.316.1" + }, + "devDependencies": { + "vows": "~0.7.0", + "feedparser": "0.16", + "mongoose": "4.0.3" + }, + "iframely-proxy-plugins": true, + "main": "./lib/core", + "scripts": { + "test": "vows test/main.js --isolate --spec", + "snyk-protect": "snyk protect", + "prepublish": "npm run snyk-protect" + }, + "engines": { + "node": ">=0.10.21" + }, + "snyk": true } From e54a401d7dee082937ce5504c5081168ad93b8ee Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Fri, 1 May 2020 07:19:58 +0100 Subject: [PATCH 13/13] fix: package.json & .snyk to reduce vulnerabilities The following vulnerabilities are fixed with a Snyk patch: - https://snyk.io/vuln/SNYK-JS-LODASH-567746 --- .snyk | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .snyk diff --git a/.snyk b/.snyk new file mode 100644 index 000000000..8106ff31b --- /dev/null +++ b/.snyk @@ -0,0 +1,8 @@ +# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. +version: v1.14.1 +ignore: {} +# patches apply the minimum changes required to fix a vulnerability +patch: + SNYK-JS-LODASH-567746: + - request > form-data > async > lodash: + patched: '2020-05-01T06:19:55.194Z'