1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +01:00

various fixes: wombat: add Date.UTC and Date.parse

rewrite: support vi_ https -> metadata
video: fallback to vi_ call on current page
remove debug logging
This commit is contained in:
Ilya Kreymer 2014-11-25 00:21:28 -08:00
parent 4b7186a62e
commit 3e3a74619f
5 changed files with 13 additions and 3 deletions

View File

@ -126,7 +126,6 @@ class FuzzyQuery:
if 'end_key' in params: if 'end_key' in params:
del params['end_key'] del params['end_key']
print(params)
return params return params

View File

@ -63,6 +63,9 @@ class LiveRewriter(object):
if cookie_val: if cookie_val:
value = cookie_val value = cookie_val
elif name == 'HTTP_REFERER':
continue
elif name.startswith('HTTP_'): elif name.startswith('HTTP_'):
name = name[5:].title().replace('_', '-') name = name[5:].title().replace('_', '-')

View File

@ -100,7 +100,6 @@ __wbvidrw = (function() {
// Wait to see if video is playing, if so, don't replace it // Wait to see if video is playing, if so, don't replace it
window.setTimeout(function() { window.setTimeout(function() {
if (ytvideo[0].readyState == 0) { if (ytvideo[0].readyState == 0) {
console.log("Replacing Broken Video");
check_replacement(ytvideo[0], wbinfo.url); check_replacement(ytvideo[0], wbinfo.url);
} }
}, 4000); }, 4000);
@ -117,7 +116,7 @@ __wbvidrw = (function() {
return false; return false;
} }
function check_replacement(elem, src) { function check_replacement(elem, src, no_retry) {
if (!src || src.indexOf("javascript:") == 0) { if (!src || src.indexOf("javascript:") == 0) {
return; return;
} }
@ -134,6 +133,9 @@ __wbvidrw = (function() {
xhr.onload = function() { xhr.onload = function() {
if (xhr.status == 200) { if (xhr.status == 200) {
do_replace_video(elem, JSON.parse(xhr.responseText)); do_replace_video(elem, JSON.parse(xhr.responseText));
} else if (!no_retry) {
check_replacement(elem, wbinfo.url, true);
console.log("REPL RETRY: " + wbinfo.url);
} }
}; };
xhr.send(); xhr.send();

View File

@ -536,6 +536,8 @@ _WBWombat = (function() {
window.__Date = window.Date; window.__Date = window.Date;
window.__Date_now = window.Date.now; window.__Date_now = window.Date.now;
var utc = window.Date.UTC;
var parse = window.Date.parse;
window.Date = function (Date) { window.Date = function (Date) {
return function (A, B, C, D, E, F, G) { return function (A, B, C, D, E, F, G) {
@ -565,6 +567,9 @@ _WBWombat = (function() {
window.Date.now = function() { window.Date.now = function() {
return __Date_now() - timediff; return __Date_now() - timediff;
} }
window.Date.UTC = utc;
window.Date.parse = parse;
} }
//============================================ //============================================

View File

@ -74,6 +74,7 @@ class QueryHandler(object):
if wb_url.mod == 'vi_': if wb_url.mod == 'vi_':
# matching metadata explicitly with special scheme # matching metadata explicitly with special scheme
params['url'] = wb_url.url.replace('http:/', 'metadata:/') params['url'] = wb_url.url.replace('http:/', 'metadata:/')
params['url'] = wb_url.url.replace('https:/', 'metadata:/')
params['filter'].append('~original:metadata://') params['filter'].append('~original:metadata://')
cdx_iter = self.load_cdx(wbrequest, params) cdx_iter = self.load_cdx(wbrequest, params)