Compare commits

...
9 Commits
Author SHA1 Message Date
Enes Yakıştır f1720448c7 fix(auth): preserve incompatible-browser DOM element for Angular loadUser and restore native auth links (v1.4.25) 2026-09-04 07:07:34 +03:00
Enes Yakıştır f73a1171c4 fix(auth): guarantee all login links are hidden when user is logged in (v1.4.24) 2026-09-04 06:55:20 +03:00
Enes Yakıştır 64afa7c5e9 fix(mobile): eradicate incompatible browser false positive banner across mobile and desktop (v1.4.23) 2026-09-04 06:42:38 +03:00
Enes Yakıştır c0af4e86b2 feat(search): implement YakNet cloud search history sync with auth.yakhub.com.tr (v1.4.22) 2026-09-03 20:16:33 +03:00
Enes Yakıştır 3cc2711e8c fix(search): route to native /search instead of 404 /search/videos and cleanup error mascot (v1.4.21) 2026-09-03 18:19:15 +03:00
Enes Yakıştır 330ff2da2e feat(bgplay): install peertube-plugin-background-play v0.0.5 into database and integrate exact engine into client v1.4.20 2026-08-31 21:42:52 +03:00
Enes Yakıştır 80ea826948 feat(webaudio): implement WebAudio AudioContext bridge to prevent mobile Chrome audio suspension and wire prominent 10s seek buttons v1.4.19 2026-08-31 21:37:33 +03:00
Enes Yakıştır e7dc5136e5 feat(lockscreen): ultimate lock-screen MediaSession player with real video metadata and 10s seek buttons v1.4.18 2026-08-31 21:34:30 +03:00
Enes Yakıştır 1aba41c992 feat(player): full lock-screen MediaSession player integration and silent audio bridge for background audio v1.4.17 2026-08-31 21:27:46 +03:00
3 changed files with 293 additions and 66 deletions
+270 -62
View File
@@ -1,3 +1,48 @@
// 100% Incompatible Browser Suppression & Error Guardian
// CRITICAL: PeerTube's Angular app (my-app ngOnInit) relies on document.getElementById('incompatible-browser')
// to exist so it can do .className += " browser-ok" before calling this.loadUser()!
// Removing it from DOM causes a null pointer crash that breaks user session initialization!
if (typeof window !== 'undefined') {
try {
window.displayIncompatibleBrowser = function () {};
var neuterIncompatible = function () {
var el = document.getElementById('incompatible-browser');
if (el) {
if (!el.classList.contains('browser-ok')) {
el.classList.add('browser-ok');
}
el.style.setProperty('display', 'none', 'important');
el.style.setProperty('visibility', 'hidden', 'important');
el.style.setProperty('height', '0px', 'important');
el.style.setProperty('width', '0px', 'important');
el.style.setProperty('opacity', '0', 'important');
el.style.setProperty('pointer-events', 'none', 'important');
} else {
try {
var dummy = document.createElement('div');
dummy.id = 'incompatible-browser';
dummy.className = 'browser-ok';
dummy.style.display = 'none';
(document.body || document.documentElement).appendChild(dummy);
} catch (e) {}
}
};
neuterIncompatible();
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', neuterIncompatible);
}
setInterval(neuterIncompatible, 1000);
} catch (e) {}
}
// Immediate URL rewrite: redirect legacy /search/videos to /search
if (typeof window !== 'undefined' && window.location) {
if (window.location.pathname === '/search/videos' || window.location.pathname.startsWith('/search/videos/')) {
var targetSearch = window.location.search || '';
window.location.replace('/search' + targetSearch);
}
}
try {
(function () {
if (window.__YAKTUBE_ENGINE_LOADED__) return;
@@ -334,15 +379,18 @@ try {
var isAuth = !!token && !!uName;
if (headerRight) {
var defaultLoginLink = headerRight.querySelector('my-login-link, a[href*="/login"], .login-button');
var liveWidget = headerRight.querySelector('#yaknet-header-account-widget');
if (isAuth) {
// 1. AUTHENTICATED: Hide native login link, Show YakNet Account Profile Menu
if (defaultLoginLink) {
defaultLoginLink.style.display = 'none';
defaultLoginLink.setAttribute('aria-hidden', 'true');
}
// 1. AUTHENTICATED: Add class to body & Hide ALL native login links completely
document.body.classList.add('yaktube-user-logged-in');
document
.querySelectorAll('my-login-link, a[href*="/login"], .login-button, [class*="login-link"]')
.forEach(function (btn) {
btn.style.setProperty('display', 'none', 'important');
btn.setAttribute('aria-hidden', 'true');
btn.setAttribute('tabindex', '-1');
});
if (!liveWidget) {
var widgetWrap = document.createElement('div');
@@ -415,29 +463,30 @@ try {
}
} else {
// 2. GUEST / NOT LOGGED IN:
// A. Physically remove any <yaknet-account> widget from DOM to guarantee zero shadow DOM duplicate buttons
document.body.classList.remove('yaktube-user-logged-in');
if (liveWidget) {
liveWidget.remove();
}
// B. Ensure PeerTube's native login link is the ONLY single accessible login element
if (defaultLoginLink) {
defaultLoginLink.style.display = '';
defaultLoginLink.removeAttribute('aria-hidden');
document
.querySelectorAll('my-login-link, a[href*="/login"], .login-button, [class*="login-link"]')
.forEach(function (btn) {
btn.style.display = '';
btn.removeAttribute('aria-hidden');
btn.removeAttribute('tabindex');
var loginAnchor =
defaultLoginLink.tagName.toLowerCase() === 'a' ? defaultLoginLink : defaultLoginLink.querySelector('a');
if (loginAnchor) {
loginAnchor.setAttribute('aria-label', 'YakNet ile Giriş Yap');
loginAnchor.setAttribute('title', 'YakNet ile Giriş Yap');
var spanText = loginAnchor.querySelector('span');
if (spanText) {
spanText.textContent = 'YakNet ile Giriş Yap';
} else {
loginAnchor.textContent = 'YakNet ile Giriş Yap';
var loginAnchor = btn.tagName.toLowerCase() === 'a' ? btn : btn.querySelector('a');
if (loginAnchor) {
loginAnchor.setAttribute('aria-label', 'YakNet ile Giriş Yap');
loginAnchor.setAttribute('title', 'YakNet ile Giriş Yap');
var spanText = loginAnchor.querySelector('span');
if (spanText) {
spanText.textContent = 'YakNet ile Giriş Yap';
} else {
loginAnchor.textContent = 'YakNet ile Giriş Yap';
}
}
}
}
});
}
}
@@ -537,34 +586,41 @@ try {
injectYakNetSSO();
// Replace all login buttons labels and titles
document
.querySelectorAll(
'my-login-link, a[href*="/login"], a[title*="Giriş sayfasına git"], [aria-label*="Giriş sayfasına git"]'
)
.forEach(function (el) {
if (el.getAttribute('title') && el.getAttribute('title').includes('Giriş sayfasına git')) {
el.setAttribute('title', 'YakNet ile Giriş Yap');
}
if (el.getAttribute('aria-label') && el.getAttribute('aria-label').includes('Giriş sayfasına git')) {
el.setAttribute('aria-label', 'YakNet ile Giriş Yap');
}
var anchor = el.tagName.toLowerCase() === 'a' ? el : el.querySelector('a');
if (anchor) {
anchor.setAttribute('title', 'YakNet ile Giriş Yap');
anchor.setAttribute('aria-label', 'YakNet ile Giriş Yap');
var spans = anchor.querySelectorAll('span');
spans.forEach(function (s) {
if (
s.textContent.includes('Giriş sayfasına git') ||
s.textContent.trim() === 'Giriş' ||
s.textContent.trim() === 'Giriş yap'
) {
s.textContent = 'YakNet ile Giriş Yap';
}
});
}
});
// Check auth status for login button rendering
var tokenVal = localStorage.getItem('access_token');
var userVal = localStorage.getItem('username');
var isAlreadyAuth = !!tokenVal && !!userVal;
if (!isAlreadyAuth) {
// Replace all login buttons labels and titles ONLY for guests
document
.querySelectorAll(
'my-login-link, a[href*="/login"], a[title*="Giriş sayfasına git"], [aria-label*="Giriş sayfasına git"]'
)
.forEach(function (el) {
if (el.getAttribute('title') && el.getAttribute('title').includes('Giriş sayfasına git')) {
el.setAttribute('title', 'YakNet ile Giriş Yap');
}
if (el.getAttribute('aria-label') && el.getAttribute('aria-label').includes('Giriş sayfasına git')) {
el.setAttribute('aria-label', 'YakNet ile Giriş Yap');
}
var anchor = el.tagName.toLowerCase() === 'a' ? el : el.querySelector('a');
if (anchor) {
anchor.setAttribute('title', 'YakNet ile Giriş Yap');
anchor.setAttribute('aria-label', 'YakNet ile Giriş Yap');
var spans = anchor.querySelectorAll('span');
spans.forEach(function (s) {
if (
s.textContent.includes('Giriş sayfasına git') ||
s.textContent.trim() === 'Giriş' ||
s.textContent.trim() === 'Giriş yap'
) {
s.textContent = 'YakNet ile Giriş Yap';
}
});
}
});
}
// Aggressively remove generic Framasoft Open-in-App / Play Store banners
document
@@ -880,7 +936,22 @@ try {
}
function getVideoElement() {
return document.querySelector('video');
// 1. Direct video tag in DOM
var v = document.querySelector('video');
if (v) return v;
// 2. Video inside iframes (e.g. embed player)
var iframes = document.querySelectorAll('iframe');
for (var i = 0; i < iframes.length; i++) {
try {
var doc = iframes[i].contentDocument || (iframes[i].contentWindow && iframes[i].contentWindow.document);
if (doc) {
var iv = doc.querySelector('video');
if (iv) return iv;
}
} catch (e) {}
}
return null;
}
function formatTime(seconds) {
@@ -1611,6 +1682,18 @@ try {
}
function checkAndInjectSearchResults() {
// Clean up stray 404 error mascot pages if on search
try {
var errPages = document.querySelectorAll('my-error-page');
errPages.forEach(function(ep) { ep.remove(); });
} catch (e) {}
// Instant URL fixer: redirect legacy /search/videos to native /search
if (window.location.pathname === '/search/videos' || window.location.pathname.startsWith('/search/videos/')) {
window.location.replace('/search' + window.location.search);
return;
}
var url = new URL(window.location.href);
var searchParam = url.searchParams.get('search');
@@ -1891,7 +1974,27 @@ try {
var activeVoiceRec = null;
var isVoiceListening = false;
// Dynamic Search History & Trending Helpers
// Dynamic Search History & Trending Helpers with YakNet Cloud Sync
function isUserLoggedIn() {
try {
var token = localStorage.getItem('access_token');
var username = localStorage.getItem('username');
return Boolean(token || username);
} catch (e) {
return false;
}
}
function isAccountSyncEnabled() {
try {
var userPref = localStorage.getItem('yaktube_sync_search_history');
if (userPref === 'false') return false;
return isUserLoggedIn();
} catch (e) {
return false;
}
}
function getRecentSearches() {
try {
var data = localStorage.getItem('yaktube_recent_searches');
@@ -1908,6 +2011,33 @@ try {
return defaults;
}
var isSyncingHistory = false;
function syncCloudSearchHistory(callback) {
if (!isAccountSyncEnabled() || isSyncingHistory) return;
isSyncingHistory = true;
var token = localStorage.getItem('access_token');
var headers = {};
if (token) headers['Authorization'] = 'Bearer ' + token;
fetch('/api-custom/search-history', {
method: 'GET',
headers: headers,
credentials: 'include'
})
.then(function (res) { return res.json(); })
.then(function (data) {
isSyncingHistory = false;
if (data && data.status === 'success' && Array.isArray(data.history) && data.history.length > 0) {
localStorage.setItem('yaktube_recent_searches', JSON.stringify(data.history));
if (typeof callback === 'function') callback();
}
})
.catch(function () {
isSyncingHistory = false;
});
}
function saveRecentSearch(query) {
if (!query || query.trim().length < 2) return;
var q = query.trim();
@@ -1917,15 +2047,42 @@ try {
return item.toLowerCase() !== q.toLowerCase();
});
list.unshift(q);
if (list.length > 8) list = list.slice(0, 8);
if (list.length > 12) list = list.slice(0, 12);
localStorage.setItem('yaktube_recent_searches', JSON.stringify(list));
} catch (e) {}
// If user is logged in and sync is active, sync with YakNet account
if (isAccountSyncEnabled()) {
var token = localStorage.getItem('access_token');
var headers = { 'Content-Type': 'application/json' };
if (token) headers['Authorization'] = 'Bearer ' + token;
fetch('/api-custom/search-history', {
method: 'POST',
headers: headers,
credentials: 'include',
body: JSON.stringify({ query: q })
}).catch(function () {});
}
}
function clearRecentSearches() {
try {
localStorage.removeItem('yaktube_recent_searches');
} catch (e) {}
if (isAccountSyncEnabled()) {
var token = localStorage.getItem('access_token');
var headers = { 'Content-Type': 'application/json' };
if (token) headers['Authorization'] = 'Bearer ' + token;
fetch('/api-custom/search-history', {
method: 'DELETE',
headers: headers,
credentials: 'include'
}).catch(function () {});
}
renderDynamicSearchChips();
announce('Arama geçmişi temizlendi.');
}
@@ -1963,17 +2120,49 @@ try {
if (!container) return;
var recent = getRecentSearches();
var loggedIn = isUserLoggedIn();
var syncEnabled = isAccountSyncEnabled();
var html = '';
// 1. Recent searches section (if any)
// 1. Recent searches section
html +=
'<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 8px;">' +
'<div class="yaktube-modal-section-title" style="margin-bottom: 0;">🕒 Son Aramalarınız</div>' +
'<div style="display: flex; align-items: center; gap: 8px;">';
if (loggedIn) {
var syncTitle = syncEnabled
? 'YakNet Bulut Eşitlemesi Aktif (Tüm cihazlarınızda senkronize edilir. Kapatmak için tıklayın.)'
: 'Eşitleme Kapalı (Aramalar sadece bu cihazda saklanır. Açmak için tıklayın.)';
var syncText = syncEnabled ? '☁️ Eşitleme: Açık' : '☁️ Eşitleme: Kapalı';
var syncBg = syncEnabled ? '#0f766e' : '#334155';
var syncColor = syncEnabled ? '#5eead4' : '#94a3b8';
html +=
'<button id="yaktube-sync-toggle-btn" style="background: ' +
syncBg +
'; border: 1px solid rgba(255,255,255,0.15); border-radius: 6px; padding: 2px 8px; color: ' +
syncColor +
'; font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.2s ease;" title="' +
syncTitle +
'" aria-label="' +
syncTitle +
'">' +
syncText +
'</button>';
} else {
html +=
'<span style="font-size: 11px; color: #94a3b8; background: #1e293b; border-radius: 6px; padding: 2px 8px;" title="Misafir modundasınız, aramalar sadece bu cihazda saklanır">🔒 Bu Cihazda</span>';
}
if (recent.length > 0) {
html +=
'<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">' +
'<div class="yaktube-modal-section-title" style="margin-bottom: 0;">🕒 Son Aramalarınız</div>' +
'<button id="yaktube-clear-recent-btn" style="background: transparent; border: none; color: #ff8f37; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: underline;" aria-label="Arama geçmişini temizle">Geçmişi Temizle</button>' +
'</div>' +
'<div class="yaktube-modal-chips-grid" style="margin-bottom: 18px;">';
'<button id="yaktube-clear-recent-btn" style="background: transparent; border: none; color: #ff8f37; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: underline;" aria-label="Arama geçmişini temizle">Geçmişi Temizle</button>';
}
html += '</div></div>';
if (recent.length > 0) {
html += '<div class="yaktube-modal-chips-grid" style="margin-bottom: 18px;">';
recent.forEach(function (term) {
var safeTerm = term.replace(/"/g, '&quot;');
html +=
@@ -2028,6 +2217,24 @@ try {
clearRecentSearches();
});
}
var syncToggleBtn = container.querySelector('#yaktube-sync-toggle-btn');
if (syncToggleBtn) {
syncToggleBtn.addEventListener('click', function (e) {
e.preventDefault();
e.stopPropagation();
var current = localStorage.getItem('yaktube_sync_search_history') !== 'false';
var next = !current;
localStorage.setItem('yaktube_sync_search_history', next ? 'true' : 'false');
if (next) {
announce('YakNet arama geçmişi eşitlemesi açıldı.');
syncCloudSearchHistory(renderDynamicSearchChips);
} else {
announce('Arama geçmişi eşitlemesi kapatıldı. Aramalar sadece bu cihazda saklanacak.');
}
renderDynamicSearchChips();
});
}
}
function createFullSearchModal() {
@@ -2111,7 +2318,7 @@ try {
saveRecentSearch(q);
announce('"' + q + '" için arama yapılıyor...', true);
closeFullSearchModal();
window.location.href = '/search/videos?search=' + encodeURIComponent(q);
window.location.href = '/search?search=' + encodeURIComponent(q);
}
}
window.__yaktube_execute_search__ = executeSearch;
@@ -2156,6 +2363,7 @@ try {
modal.classList.add('yaktube-modal-open');
modal.style.display = 'flex';
renderDynamicSearchChips();
syncCloudSearchHistory(renderDynamicSearchChips);
var inp = modal.querySelector('#yaktube-modal-input');
var clearBtn = modal.querySelector('#yaktube-modal-clear-btn');
@@ -2242,7 +2450,7 @@ try {
announce('"' + transcript + '" için arama başlatılıyor...', true);
setTimeout(function () {
closeFullSearchModal();
window.location.href = '/search/videos?search=' + encodeURIComponent(transcript);
window.location.href = '/search?search=' + encodeURIComponent(transcript);
}, 500);
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "peertube-plugin-yaktube-ondemand",
"version": "1.4.16",
"version": "1.4.25",
"description": "Accessible On-Demand YouTube Import, Live Streams, Smart Recommendations and A11y Engine for PeerTube",
"main": "main.js",
"library": "./main.js",
@@ -44,4 +44,4 @@
"homepage": "https://yaktube.yakhub.com.tr",
"bugs": "https://github.com/yakistir98/peertube-plugin-yaktube-ondemand/issues",
"license": "AGPL-3.0-or-later"
}
}
+21 -2
View File
@@ -1,4 +1,8 @@
/* 100% Elimination of PeerTube Mobile Open-in-App Banner & Close Button */
/* 100% Elimination of PeerTube Mobile Open-in-App & Incompatible Browser Banners */
#incompatible-browser,
.alert-light#incompatible-browser,
div[id="incompatible-browser"],
.incompatible-browser,
.mobile-msg,
my-header .mobile-msg,
[class*='mobile-msg'],
@@ -16,7 +20,7 @@ button[title*='Dismiss'],
pointer-events: none !important;
opacity: 0 !important;
position: absolute !important;
z-index: -99999 !important;
z-index: -999999 !important;
clip: rect(0, 0, 0, 0) !important;
}
@@ -942,3 +946,18 @@ body.yaktube-theater-mode .video-js {
color: #fff !important;
outline: none !important;
}
/* Suppress 404 Mascot and Error Page on Search results */
body:has(#yaktube-ondemand-container) my-error-page,
#yaktube-ondemand-container ~ my-error-page,
my-error-page:has(~ #yaktube-ondemand-container),
my-error-page {
/* Only hide if search param is active */
}
body:has(#yaktube-ondemand-container) my-error-page {
display: none !important;
visibility: hidden !important;
height: 0 !important;
overflow: hidden !important;
}