mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Update not found image
This commit is contained in:
parent
e898703d43
commit
b732e43941
14 changed files with 1689 additions and 1551 deletions
|
@ -45,12 +45,12 @@ try {
|
|||
height = $('body').height();
|
||||
}
|
||||
parent.postMessage({height: height}, '*');
|
||||
}else if (e.data.play) {
|
||||
} else if (e.data.play) {
|
||||
var currentTime = e.data.play.currentTime;
|
||||
var muted = !empty(e.data.play.muted);
|
||||
if(!muted){
|
||||
if (!muted) {
|
||||
playerPlay(currentTime);
|
||||
}else{
|
||||
} else {
|
||||
tryToPlayMuted(currentTime);
|
||||
}
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ function addView(videos_id, currentTime) {
|
|||
|
||||
var isVideoAddViewCount = false;
|
||||
function _addView(videos_id, currentTime, seconds_watching_video) {
|
||||
if(isVideoAddViewCount){
|
||||
if (isVideoAddViewCount) {
|
||||
return false;
|
||||
}
|
||||
isVideoAddViewCount = true;
|
||||
|
@ -2310,7 +2310,7 @@ function avideoAjax(url, data) {
|
|||
}
|
||||
|
||||
function avideoAjax2(url, data, pleaseWait) {
|
||||
if(pleaseWait){
|
||||
if (pleaseWait) {
|
||||
modal.showPleaseWait();
|
||||
}
|
||||
$.ajax({
|
||||
|
@ -2318,7 +2318,7 @@ function avideoAjax2(url, data, pleaseWait) {
|
|||
data: data,
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
if(pleaseWait){
|
||||
if (pleaseWait) {
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
if (response.error) {
|
||||
|
@ -2978,81 +2978,84 @@ $(document).ready(function () {
|
|||
* @param {Boolean} nodes If true, returns HTML nodes instead of a string
|
||||
* @return {String|NodeList} The sanitized string or nodes
|
||||
*/
|
||||
function cleanHTML (str, nodes) {
|
||||
function cleanHTML(str, nodes) {
|
||||
|
||||
/**
|
||||
* Convert the string to an HTML document
|
||||
* @return {Node} An HTML document
|
||||
*/
|
||||
function stringToHTML () {
|
||||
let parser = new DOMParser();
|
||||
let doc = parser.parseFromString(str, 'text/html');
|
||||
return doc.body || document.createElement('body');
|
||||
}
|
||||
/**
|
||||
* Convert the string to an HTML document
|
||||
* @return {Node} An HTML document
|
||||
*/
|
||||
function stringToHTML() {
|
||||
let parser = new DOMParser();
|
||||
let doc = parser.parseFromString(str, 'text/html');
|
||||
return doc.body || document.createElement('body');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove <script> elements
|
||||
* @param {Node} html The HTML
|
||||
*/
|
||||
function removeScripts (html) {
|
||||
let scripts = html.querySelectorAll('script');
|
||||
for (let script of scripts) {
|
||||
script.remove();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Remove <script> elements
|
||||
* @param {Node} html The HTML
|
||||
*/
|
||||
function removeScripts(html) {
|
||||
let scripts = html.querySelectorAll('script');
|
||||
for (let script of scripts) {
|
||||
script.remove();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the attribute is potentially dangerous
|
||||
* @param {String} name The attribute name
|
||||
* @param {String} value The attribute value
|
||||
* @return {Boolean} If true, the attribute is potentially dangerous
|
||||
*/
|
||||
function isPossiblyDangerous (name, value) {
|
||||
let val = value.replace(/\s+/g, '').toLowerCase();
|
||||
if (['src', 'href', 'xlink:href'].includes(name)) {
|
||||
if (val.includes('javascript:') || val.includes('data:text/html')) return true;
|
||||
}
|
||||
if (name.startsWith('on')) return true;
|
||||
}
|
||||
/**
|
||||
* Check if the attribute is potentially dangerous
|
||||
* @param {String} name The attribute name
|
||||
* @param {String} value The attribute value
|
||||
* @return {Boolean} If true, the attribute is potentially dangerous
|
||||
*/
|
||||
function isPossiblyDangerous(name, value) {
|
||||
let val = value.replace(/\s+/g, '').toLowerCase();
|
||||
if (['src', 'href', 'xlink:href'].includes(name)) {
|
||||
if (val.includes('javascript:') || val.includes('data:text/html'))
|
||||
return true;
|
||||
}
|
||||
if (name.startsWith('on'))
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove potentially dangerous attributes from an element
|
||||
* @param {Node} elem The element
|
||||
*/
|
||||
function removeAttributes (elem) {
|
||||
/**
|
||||
* Remove potentially dangerous attributes from an element
|
||||
* @param {Node} elem The element
|
||||
*/
|
||||
function removeAttributes(elem) {
|
||||
|
||||
// Loop through each attribute
|
||||
// If it's dangerous, remove it
|
||||
let atts = elem.attributes;
|
||||
for (let {name, value} of atts) {
|
||||
if (!isPossiblyDangerous(name, value)) continue;
|
||||
elem.removeAttribute(name);
|
||||
}
|
||||
// Loop through each attribute
|
||||
// If it's dangerous, remove it
|
||||
let atts = elem.attributes;
|
||||
for (let {name, value} of atts) {
|
||||
if (!isPossiblyDangerous(name, value))
|
||||
continue;
|
||||
elem.removeAttribute(name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove dangerous stuff from the HTML document's nodes
|
||||
* @param {Node} html The HTML document
|
||||
*/
|
||||
function clean (html) {
|
||||
let nodes = html.children;
|
||||
for (let node of nodes) {
|
||||
removeAttributes(node);
|
||||
clean(node);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Remove dangerous stuff from the HTML document's nodes
|
||||
* @param {Node} html The HTML document
|
||||
*/
|
||||
function clean(html) {
|
||||
let nodes = html.children;
|
||||
for (let node of nodes) {
|
||||
removeAttributes(node);
|
||||
clean(node);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the string to HTML
|
||||
let html = stringToHTML();
|
||||
// Convert the string to HTML
|
||||
let html = stringToHTML();
|
||||
|
||||
// Sanitize it
|
||||
removeScripts(html);
|
||||
clean(html);
|
||||
// Sanitize it
|
||||
removeScripts(html);
|
||||
clean(html);
|
||||
|
||||
// If the user wants HTML nodes back, return them
|
||||
// Otherwise, pass a sanitized string back
|
||||
return nodes ? html.childNodes : html.innerHTML;
|
||||
// If the user wants HTML nodes back, return them
|
||||
// Otherwise, pass a sanitized string back
|
||||
return nodes ? html.childNodes : html.innerHTML;
|
||||
|
||||
}
|
||||
|
||||
|
@ -3799,15 +3802,15 @@ function avideoLogoff(redirect) {
|
|||
}
|
||||
}
|
||||
|
||||
async function sendAVideoMobileLiveStreamerMessage(type, value){
|
||||
async function sendAVideoMobileLiveStreamerMessage(type, value) {
|
||||
if (typeof window.flutter_inappwebview !== 'undefined') {
|
||||
if (typeof window.flutter_inappwebview.callHandler == 'function') {
|
||||
for (i = 0; i < 10; i++) {
|
||||
response = await window.flutter_inappwebview.callHandler('AVideoMobileLiveStreamer' + i, {type: type, value: value, instanceIndex: i});
|
||||
if(response!==null){
|
||||
if (response !== null) {
|
||||
console.log('sendAVideoMobileLiveStreamerMessage executed', i, response, type, value);
|
||||
break;
|
||||
}else{
|
||||
} else {
|
||||
console.log('sendAVideoMobileLiveStreamerMessage not found', i, type, value);
|
||||
}
|
||||
}
|
||||
|
@ -3833,3 +3836,7 @@ function getUser() {
|
|||
async: false
|
||||
}).responseText;
|
||||
}
|
||||
|
||||
function getUniqueValuesFromArray(items) {
|
||||
return [...new Set(items)];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue