Deprecate legacy vimeo-oauth lookup

This commit is contained in:
Calvin Montgomery 2017-07-22 11:14:29 -07:00
parent 52030506b5
commit 282ad986b6
5 changed files with 13 additions and 65 deletions

12
NEWS.md
View File

@ -1,3 +1,15 @@
2017-07-22
==========
Support for the old version of Vimeo's OAuth API (the `vimeo-oauth`
configuration block) has been dropped. It's unlikely anyone was using this,
since you haven't been able to register new API keys for it in years (it was
superseded by a newer OAuth API, which CyTube does not support), and in fact I
lost my credentials for this API and no longer have a way to test it.
Vimeo videos can still be added -- the metadata will be queried from the
anonymous API which has been the default since the beginning.
2017-07-17 2017-07-17
========== ==========

View File

@ -176,16 +176,6 @@ aliases:
# Workaround for Vimeo blocking my domain # Workaround for Vimeo blocking my domain
vimeo-workaround: false vimeo-workaround: false
# OPTIONAL: Use Vimeo's OAuth API instead of the anonymous API.
# This allows you to add private videos that have embedding enabled.
# See https://developer.vimeo.com/apps/new to register for this API.
# Note that in order to use this feature you must agree to Vimeo's
# Terms of Service and License Agreement.
vimeo-oauth:
enabled: false
consumer-key: ''
secret: ''
# Regular expressions for defining reserved user and channel names and page titles # Regular expressions for defining reserved user and channel names and page titles
# The list of regular expressions will be joined with an OR, and compared without # The list of regular expressions will be joined with an OR, and compared without
# case sensitivity. # case sensitivity.

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "3.42.1", "version": "3.43.0",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },
@ -30,7 +30,6 @@
"morgan": "^1.6.1", "morgan": "^1.6.1",
"mysql": "^2.9.0", "mysql": "^2.9.0",
"nodemailer": "^1.4.0", "nodemailer": "^1.4.0",
"oauth": "^0.9.12",
"prom-client": "^10.0.2", "prom-client": "^10.0.2",
"proxy-addr": "^1.1.4", "proxy-addr": "^1.1.4",
"pug": "^2.0.0-beta3", "pug": "^2.0.0-beta3",

View File

@ -87,11 +87,6 @@ var defaults = {
"max-age": 2592000000 "max-age": 2592000000
}, },
"vimeo-workaround": false, "vimeo-workaround": false,
"vimeo-oauth": {
enabled: false,
"consumer-key": "",
secret: ""
},
"html-template": { "html-template": {
title: "CyTube Beta", description: "Free, open source synchtube" title: "CyTube Beta", description: "Free, open source synchtube"
}, },

View File

@ -135,10 +135,6 @@ var Getters = {
return; return;
} }
if (Config.get("vimeo-oauth.enabled")) {
return Getters.vi_oauth(id, callback);
}
Vimeo.lookup(id).then(video => { Vimeo.lookup(id).then(video => {
video = new Media(video.id, video.title, video.duration, "vi"); video = new Media(video.id, video.title, video.duration, "vi");
callback(null, video); callback(null, video);
@ -147,50 +143,6 @@ var Getters = {
}); });
}, },
vi_oauth: function (id, callback) {
var OAuth = require("oauth");
var oa = new OAuth.OAuth(
"https://vimeo.com/oauth/request_token",
"https://vimeo.com/oauth/access_token",
Config.get("vimeo-oauth.consumer-key"),
Config.get("vimeo-oauth.secret"),
"1.0",
null,
"HMAC-SHA1"
);
oa.get("https://vimeo.com/api/rest/v2?format=json" +
"&method=vimeo.videos.getInfo&video_id=" + id,
null,
null,
function (err, data, res) {
if (err) {
return callback(err, null);
}
try {
data = JSON.parse(data);
if (data.stat !== "ok") {
return callback(data.err.msg, null);
}
var video = data.video[0];
if (video.embed_privacy !== "anywhere") {
return callback("Embedding disabled", null);
}
var id = video.id;
var seconds = parseInt(video.duration);
var title = video.title;
callback(null, new Media(id, title, seconds, "vi"));
} catch (e) {
callback("Error handling Vimeo response", null);
}
});
},
/* dailymotion.com */ /* dailymotion.com */
dm: function (id, callback) { dm: function (id, callback) {
var m = id.match(/([\w-]+)/); var m = id.match(/([\w-]+)/);