Compare commits

...
18 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
Enes Yakıştır afaf4ef856 fix(mobile): permanently suppress .mobile-msg banner and close button, and upgrade WakeLock background playback v1.4.16 2026-08-31 20:52:34 +03:00
Enes Yakıştır 52480401c8 feat(sso): add silent sso-frame probe to automatically recognize active YakNet sessions v1.4.15 2026-08-31 20:35:08 +03:00
Enes Yakıştır 46a9c8ab8c feat(auth): robust hybrid YakNet SSO architecture with zero shadow DOM duplicate buttons v1.4.14 2026-08-31 20:29:13 +03:00
Enes Yakıştır a5568de3cc fix(a11y): completely remove yaknet-account from DOM tree when guest for 100% screen reader cleanliness v1.4.13 2026-08-31 20:25:24 +03:00
Enes Yakıştır d629c97dd8 fix(header): keep yaknet-account hidden for silent SSO probe when guest and show only single clean login button v1.4.12 2026-08-31 20:23:46 +03:00
Enes Yakıştır 3016fc6328 fix: suppress app banners, seamless background audio auto-resume, and continuous YakNet SSO session probe v1.4.11 2026-08-31 20:20:55 +03:00
Enes Yakıştır dac3137330 fix(compatibility): safe matchMedia check and wrap client in try-catch to prevent incompatible browser screen v1.4.10 2026-08-31 18:48:19 +03:00
Enes Yakıştır 15361a21b6 fix(search): restore dynamic recent searches in search modal and auto URL search capture v1.4.9 2026-08-31 18:46:13 +03:00
Enes Yakıştır c6e5abf87e chore: remove internal docs from public repo, make apk download instance-scoped v1.4.8 2026-08-31 17:04:44 +03:00
5 changed files with 3276 additions and 2888 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
node_modules/
docs/
*.log
.DS_Store
dist/
+4
View File
@@ -0,0 +1,4 @@
docs/
*.log
.git
.github
+401 -84
View File
@@ -1,6 +1,56 @@
// 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;
window.__YAKTUBE_ENGINE_LOADED__ = true;
try {
localStorage.setItem('hide-mobile-msg', 'true');
sessionStorage.setItem('hide-mobile-msg', 'true');
} catch (e) {}
console.log('[YakTube] YakNet SSO, Custom Branding, A11y & On-Demand Engine Active');
// Dynamic Instance Name Helper
@@ -49,6 +99,52 @@
}, 50);
}
// Load official YakNet Web Component definition
if (
typeof customElements !== 'undefined' &&
!customElements.get('yaknet-account') &&
!document.getElementById('yaknet-account-script')
) {
var s = document.createElement('script');
s.id = 'yaknet-account-script';
s.src = 'https://auth.yakhub.com.tr/js/yaknet-account.js';
s.async = true;
document.head.appendChild(s);
}
// Silent background SSO Probe Engine
function initSilentSSOProbe() {
var token = localStorage.getItem('access_token');
var isManualLogout = sessionStorage.getItem('yaknet_manual_logout');
if (
token ||
isManualLogout ||
window.location.search.includes('local=true') ||
window.location.search.includes('externalAuthError') ||
window.location.pathname.includes('/login')
) {
return;
}
var iframeId = 'yaknet-sso-iframe-instance';
if (!document.getElementById(iframeId)) {
var iframe = document.createElement('iframe');
iframe.id = iframeId;
iframe.src = 'https://auth.yakhub.com.tr/sdk/sso-frame';
iframe.title = 'YakNet Oturum Kontrolü';
iframe.setAttribute('aria-hidden', 'true');
iframe.tabIndex = -1;
iframe.style.cssText =
'display:none!important;width:0!important;height:0!important;border:0!important;position:absolute!important;pointer-events:none!important;';
document.body.appendChild(iframe);
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initSilentSSOProbe);
} else {
initSilentSSOProbe();
}
function triggerYakNetOAuth() {
sessionStorage.removeItem('yaknet_manual_logout');
var callbackUrl = 'https://yaktube.yakhub.com.tr/plugins/peertube-plugin-auth-yaknet/router/auth-callback';
@@ -283,15 +379,18 @@
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) {
// Logged In: Show YakNet Profile Menu, Hide default login link
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');
@@ -332,6 +431,16 @@
} else {
var el = liveWidget.querySelector('yaknet-account');
if (el) {
if (el.getAttribute('authenticated') !== 'true' || el.getAttribute('user-name') !== displayName) {
el.setAttribute('authenticated', 'true');
el.setAttribute('user-name', displayName);
el.setAttribute('user-email', emailStr);
if (typeof el.syncStateFromAttributes === 'function') {
el.syncStateFromAttributes();
el.render();
}
}
if (el.shadowRoot) {
var shadowLogoutBtn =
el.shadowRoot.getElementById('logoutBtn') ||
@@ -350,32 +459,26 @@
);
}
}
if (el.getAttribute('authenticated') !== 'true' || el.getAttribute('user-name') !== displayName) {
el.setAttribute('authenticated', 'true');
el.setAttribute('user-name', displayName);
el.setAttribute('user-email', emailStr);
if (typeof el.syncStateFromAttributes === 'function') {
el.syncStateFromAttributes();
el.render();
}
}
}
}
} else {
// Not Logged In: Remove YakNet widget to eliminate duplicate button, keep PeerTube native login button clean
// 2. GUEST / NOT LOGGED IN:
document.body.classList.remove('yaktube-user-logged-in');
if (liveWidget) {
liveWidget.remove();
}
if (defaultLoginLink) {
defaultLoginLink.style.display = '';
defaultLoginLink.removeAttribute('aria-hidden');
var loginAnchor =
defaultLoginLink.tagName.toLowerCase() === 'a' ? defaultLoginLink : defaultLoginLink.querySelector('a');
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 = btn.tagName.toLowerCase() === 'a' ? btn : btn.querySelector('a');
if (loginAnchor) {
loginAnchor.setAttribute('aria-label', 'YakNet ile Giriş Yap');
loginAnchor.setAttribute('title', 'YakNet Hesabınız ile Giriş Yapın');
loginAnchor.setAttribute('title', 'YakNet ile Giriş Yap');
var spanText = loginAnchor.querySelector('span');
if (spanText) {
spanText.textContent = 'YakNet ile Giriş Yap';
@@ -383,7 +486,7 @@
loginAnchor.textContent = 'YakNet ile Giriş Yap';
}
}
}
});
}
}
@@ -443,7 +546,9 @@
if (containerToHide && !isLocalLogin) {
var subElements = Array.from(loginCard.children).filter(function (el) {
return (
el.id !== 'yaknet-login-section' && !el.classList.contains('title') && !el.classList.contains('page-title')
el.id !== 'yaknet-login-section' &&
!el.classList.contains('title') &&
!el.classList.contains('page-title')
);
});
@@ -481,7 +586,13 @@
injectYakNetSSO();
// Replace all login buttons labels and titles
// 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"]'
@@ -509,8 +620,16 @@
});
}
});
}
// Aggressively remove generic Framasoft Open-in-App / Play Store banners
document
.querySelectorAll(
'.mobile-msg, [class*="mobile-msg"], button[title*="Bu mesajı kapat"], button[aria-label*="Bu mesajı kapat"]'
)
.forEach(function (m) {
m.remove();
});
var genericAppBanners = document.querySelectorAll(
'my-open-app, my-client-app-banner, .open-app-container, .app-banner, [class*="open-app"], [class*="open-in-app"], .mobile-app-banner, my-open-in-app, .app-promotion, a[href*="play.google.com/store/apps/details?id=app.joinpeertube"], a[href*="f-droid.org"]'
);
@@ -669,7 +788,9 @@
if (!alt || alt.trim() === '') {
var card = img.closest('.video-miniature, .video-card, .yaktube-card, [class*="miniature"]');
if (card) {
var titleEl = card.querySelector('.video-miniature-name, .video-name, .yaktube-video-name, h3, h4, a[title]');
var titleEl = card.querySelector(
'.video-miniature-name, .video-name, .yaktube-video-name, h3, h4, a[title]'
);
var titleText = titleEl ? (titleEl.textContent || titleEl.getAttribute('title') || '').trim() : '';
if (titleText) {
img.setAttribute('alt', titleText + ' video kapağı');
@@ -815,7 +936,22 @@
}
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) {
@@ -1499,7 +1635,10 @@
if (sData.isImporting) {
showModal('[1/2] 📥 Video İndiriliyor...', 'Video sunucuya indiriliyor (' + attempts * 2 + ' sn)...');
} else if (sData.isTranscoding) {
showModal('[2/2] ⚙️ Oynatıcı Hazırlanıyor...', 'Video işleniyor ve yüksek kalite akış hazırlanıyor...');
showModal(
'[2/2] ⚙️ Oynatıcı Hazırlanıyor...',
'Video işleniyor ve yüksek kalite akış hazırlanıyor...'
);
}
if (sData.isPublished || (sData.hasFiles && attempts >= 8)) {
@@ -1543,6 +1682,18 @@
}
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');
@@ -1823,14 +1974,68 @@
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');
return data ? JSON.parse(data) : [];
} catch (e) {
return [];
if (data) {
var parsed = JSON.parse(data);
if (Array.isArray(parsed) && parsed.length > 0) return parsed;
}
} catch (e) {}
// Default initial recent searches for first-time visitors
var defaults = ['Tarkan', 'Barış Manço', 'Yapay Zeka', 'Canlı Haber'];
try {
localStorage.setItem('yaktube_recent_searches', JSON.stringify(defaults));
} catch (e) {}
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) {
@@ -1842,15 +2047,42 @@
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.');
}
@@ -1867,6 +2099,19 @@
{ title: '🎙️ Podcast & Söyleşi', q: 'Podcast Türkçe' }
];
// Auto capture search query from URL into recent searches
function captureUrlSearchQuery() {
try {
var params = new URLSearchParams(window.location.search);
var q = params.get('search') || params.get('q');
if (q && q.trim().length >= 2) {
saveRecentSearch(q.trim());
}
} catch (e) {}
}
captureUrlSearchQuery();
window.addEventListener('popstate', captureUrlSearchQuery);
function renderDynamicSearchChips() {
var modal = document.getElementById('yaktube-full-search-modal');
if (!modal) return;
@@ -1875,17 +2120,49 @@
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 +=
@@ -1940,6 +2217,24 @@
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() {
@@ -1970,17 +2265,7 @@
'<div id="yaktube-modal-voice-transcript" class="yaktube-modal-voice-transcript">Lütfen aramak istediğiniz videoyu söyleyin...</div>' +
'<button id="yaktube-modal-mic-pulse" class="yaktube-modal-mic-pulse-btn" aria-label="Mikrofonu durdur">🎙️</button>' +
'</div>' +
'<div class="yaktube-modal-section-title">🔥 Hızlı ve Popüler Aramalar</div>' +
'<div class="yaktube-modal-chips-grid">' +
'<button class="yaktube-modal-chip" data-query="Tarkan">🎵 Tarkan</button>' +
'<button class="yaktube-modal-chip" data-query="Barış Manço">🎸 Barış Manço</button>' +
'<button class="yaktube-modal-chip" data-query="Python Dersleri">💻 Python Dersleri</button>' +
'<button class="yaktube-modal-chip" data-query="Yapay Zeka">🤖 Yapay Zeka</button>' +
'<button class="yaktube-modal-chip" data-query="Sesli Kitap">🎧 Sesli Kitap</button>' +
'<button class="yaktube-modal-chip" data-query="Canlı Haber">📺 Canlı Haber</button>' +
'<button class="yaktube-modal-chip" data-query="Gitar Dersi">🎼 Gitar Dersi</button>' +
'<button class="yaktube-modal-chip" data-query="Bilim Belgeseli">🌍 Bilim Belgeseli</button>' +
'</div>' +
'<div id="yaktube-modal-dynamic-chips-section"></div>' +
'<div class="yaktube-modal-hint-footer">' +
'<span>💡 <b>Enter</b> ile ara, <b>Shift+V</b> ile sesli ara</span>' +
'<span><b>Escape</b> ile kapat</span>' +
@@ -2033,7 +2318,7 @@
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;
@@ -2078,6 +2363,7 @@
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');
@@ -2164,7 +2450,7 @@
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);
}
}
@@ -2212,7 +2498,10 @@
var nativeInputs = searchContainer.querySelectorAll('input, button');
nativeInputs.forEach(function (el) {
if (!el.classList.contains('yaktube-search-trigger-pill') && !el.classList.contains('yaktube-voice-search-btn')) {
if (
!el.classList.contains('yaktube-search-trigger-pill') &&
!el.classList.contains('yaktube-voice-search-btn')
) {
el.style.display = 'none';
el.setAttribute('tabindex', '-1');
el.setAttribute('aria-hidden', 'true');
@@ -2478,7 +2767,8 @@
}
function checkAndInjectRelatedVideos(forceReload) {
var isWatchPage = window.location.pathname.includes('/videos/watch/') || window.location.pathname.startsWith('/w/');
var isWatchPage =
window.location.pathname.includes('/videos/watch/') || window.location.pathname.startsWith('/w/');
if (!isWatchPage) {
var existing = document.getElementById('yaktube-hybrid-related-container');
if (existing) existing.remove();
@@ -2756,7 +3046,10 @@
card.className = 'yaktube-comment-item';
card.setAttribute('role', 'article');
card.setAttribute('tabindex', '0');
card.setAttribute('aria-label', c.author + ' isimli kullan\u0131c\u0131n\u0131n yorumu: ' + c.content);
card.setAttribute(
'aria-label',
c.author + ' isimli kullan\u0131c\u0131n\u0131n yorumu: ' + c.content
);
card.style.cssText =
'background: #1e293b; padding: 14px 16px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); display: flex; gap: 12px; align-items: flex-start;';
@@ -2832,9 +3125,11 @@
// 6. PWA Mobile App Install Engine & Standalone Detection
var isInsideYakTubeApp =
navigator.userAgent.indexOf('YakTubeMobileApp') !== -1 ||
window.matchMedia('(display-mode: standalone)').matches ||
window.navigator.standalone === true;
(navigator.userAgent && navigator.userAgent.indexOf('YakTubeMobileApp') !== -1) ||
(typeof window.matchMedia === 'function' &&
window.matchMedia('(display-mode: standalone)') &&
window.matchMedia('(display-mode: standalone)').matches) ||
(window.navigator && window.navigator.standalone === true);
var isMobileDevice = /Android|iPhone|iPad|iPod|Mobile|Tablet/i.test(navigator.userAgent);
@@ -2889,7 +3184,12 @@
headerButtons.prepend(installBtn);
}
function isYakTubeInstance() {
return window.location.hostname.includes('yaktube.yakhub.com.tr') || getInstanceName() === 'YakTube';
}
function injectApkDownloadButton() {
if (!isYakTubeInstance()) return;
// 1. If inside APK: NEVER show APK button
if (isInsideYakTubeApp) {
var existBtnApp = document.getElementById('yaktube-apk-download-btn');
@@ -2934,6 +3234,7 @@
}
function injectSidebarApkLink() {
if (!isYakTubeInstance()) return;
// If inside APK: NEVER show in sidebar
if (isInsideYakTubeApp) {
var existLink = document.getElementById('yaktube-sidebar-apk-link');
@@ -2986,8 +3287,8 @@
(function initBackgroundPlaybackEngine() {
var videoState = {
hasPlayed: false,
pausedByUser: false,
pausedAt: null
explicitlyPausedByClick: false,
lastPlayTime: 0
};
function attachVideoListeners(video) {
@@ -2996,21 +3297,14 @@
video.addEventListener('play', function () {
videoState.hasPlayed = true;
videoState.pausedByUser = false;
videoState.explicitlyPausedByClick = false;
videoState.lastPlayTime = Date.now();
updateMediaSessionMetadata(video);
});
video.addEventListener('pause', function () {
videoState.pausedAt = Date.now();
// If document is visible when paused, it was paused manually by the user
if (!document.hidden) {
videoState.pausedByUser = true;
}
});
video.addEventListener('ended', function () {
videoState.hasPlayed = false;
videoState.pausedByUser = true;
videoState.explicitlyPausedByClick = true;
});
video.addEventListener('timeupdate', function () {
@@ -3018,30 +3312,50 @@
});
}
function handleVisibilityChange() {
if (!document.hidden) return; // Screen is active
// Hook manual play/pause buttons
document.addEventListener(
'click',
function (e) {
var target = e.target;
if (!target) return;
var btn = target.closest(
'.vjs-play-control, button[title*="Duraklat"], button[aria-label*="Duraklat"], #yaktube-bar-play-btn'
);
if (btn) {
var video = getVideoElement();
if (video && !video.paused) {
videoState.explicitlyPausedByClick = true;
}
}
},
true
);
function handleVisibilityChange() {
var video = getVideoElement();
if (!video) return;
// If user hasn't played or deliberately paused, do not auto-resume
if (!videoState.hasPlayed || videoState.pausedByUser) return;
var now = Date.now();
if (videoState.pausedAt && now - videoState.pausedAt > 1500 && videoState.pausedByUser) {
return;
}
// Resume playback when screen locks or tab switches
// When screen turns off / tab is hidden:
if (document.hidden || document.webkitHidden) {
if (videoState.hasPlayed && !videoState.explicitlyPausedByClick) {
// Unconditionally keep audio stream active
setTimeout(function () {
if (video.paused && !videoState.pausedByUser) {
if (video.paused && !videoState.explicitlyPausedByClick) {
video.play().catch(function () {});
}
}, 50);
}, 100);
setTimeout(function () {
if (video.paused && !videoState.explicitlyPausedByClick) {
video.play().catch(function () {});
}
}, 300);
}
}
}
document.addEventListener('visibilitychange', handleVisibilityChange, false);
document.addEventListener('webkitvisibilitychange', handleVisibilityChange, false);
window.addEventListener('pagehide', handleVisibilityChange, false);
// MediaSession API Integration (Lock Screen, Bluetooth, Smart Watches)
function updateMediaSessionMetadata(video) {
@@ -3110,3 +3424,6 @@
if (video) attachVideoListeners(video);
}, 1000);
})();
} catch (err) {
console.error('[YakTube] Safe catch error:', err);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "peertube-plugin-yaktube-ondemand",
"version": "1.4.7",
"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",
+67
View File
@@ -1,3 +1,55 @@
/* 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'],
button[title*='Bu mesajı kapat'],
button[aria-label*='Bu mesajı kapat'],
button[title*='Dismiss'],
.msg.ellipsis,
.peertube-button-link.secondary-button {
display: none !important;
visibility: hidden !important;
height: 0 !important;
width: 0 !important;
margin: 0 !important;
padding: 0 !important;
pointer-events: none !important;
opacity: 0 !important;
position: absolute !important;
z-index: -999999 !important;
clip: rect(0, 0, 0, 0) !important;
}
/* Permanent Aggressive Suppression of Generic JoinPeerTube / Framasoft Open-in-App Banners */
my-open-app,
my-open-in-app,
my-client-app-banner,
.open-app-container,
.app-banner,
[class*='open-app'],
[class*='open-in-app'],
.mobile-app-banner,
.app-promotion,
.client-app-banner,
a[href*='play.google.com/store/apps/details?id=app.joinpeertube'],
a[href*='f-droid.org'],
a[href*='joinpeertube'] {
display: none !important;
visibility: hidden !important;
height: 0 !important;
width: 0 !important;
margin: 0 !important;
padding: 0 !important;
pointer-events: none !important;
opacity: 0 !important;
position: absolute !important;
z-index: -99999 !important;
}
/* YakTube Accessibility & On-Demand CSS */
:focus-visible {
@@ -894,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;
}