Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bf905f81f | ||
|
|
f1720448c7 | ||
|
|
f73a1171c4 | ||
|
|
64afa7c5e9 | ||
|
|
c0af4e86b2 | ||
|
|
3cc2711e8c | ||
|
|
330ff2da2e | ||
|
|
80ea826948 | ||
|
|
e7dc5136e5 | ||
|
|
1aba41c992 | ||
|
|
afaf4ef856 | ||
|
|
52480401c8 | ||
|
|
46a9c8ab8c | ||
|
|
a5568de3cc | ||
|
|
d629c97dd8 | ||
|
|
3016fc6328 | ||
|
|
dac3137330 | ||
|
|
15361a21b6 | ||
|
|
c6e5abf87e | ||
|
|
e161dea9da | ||
|
|
6fc0f0ef97 | ||
|
|
c4fc917677 |
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
|
docs/
|
||||||
*.log
|
*.log
|
||||||
.DS_Store
|
.DS_Store
|
||||||
dist/
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
docs/
|
||||||
|
*.log
|
||||||
|
.git
|
||||||
|
.github
|
||||||
@@ -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 () {
|
(function () {
|
||||||
if (window.__YAKTUBE_ENGINE_LOADED__) return;
|
if (window.__YAKTUBE_ENGINE_LOADED__) return;
|
||||||
window.__YAKTUBE_ENGINE_LOADED__ = true;
|
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');
|
console.log('[YakTube] YakNet SSO, Custom Branding, A11y & On-Demand Engine Active');
|
||||||
|
|
||||||
// Dynamic Instance Name Helper
|
// Dynamic Instance Name Helper
|
||||||
@@ -49,6 +99,52 @@
|
|||||||
}, 50);
|
}, 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() {
|
function triggerYakNetOAuth() {
|
||||||
sessionStorage.removeItem('yaknet_manual_logout');
|
sessionStorage.removeItem('yaknet_manual_logout');
|
||||||
var callbackUrl = 'https://yaktube.yakhub.com.tr/plugins/peertube-plugin-auth-yaknet/router/auth-callback';
|
var callbackUrl = 'https://yaktube.yakhub.com.tr/plugins/peertube-plugin-auth-yaknet/router/auth-callback';
|
||||||
@@ -76,10 +172,7 @@
|
|||||||
var hasToken = localStorage.getItem('access_token') || localStorage.getItem('username');
|
var hasToken = localStorage.getItem('access_token') || localStorage.getItem('username');
|
||||||
if (hasToken) {
|
if (hasToken) {
|
||||||
console.log('[YakTube] YakNet session ended elsewhere. Clearing YakTube...');
|
console.log('[YakTube] YakNet session ended elsewhere. Clearing YakTube...');
|
||||||
try {
|
clearYakTubeAuthSession();
|
||||||
localStorage.clear();
|
|
||||||
sessionStorage.clear();
|
|
||||||
} catch (e) {}
|
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,20 +195,32 @@
|
|||||||
} else if (e.detail && e.detail.authenticated === false) {
|
} else if (e.detail && e.detail.authenticated === false) {
|
||||||
var hasToken = localStorage.getItem('access_token') || localStorage.getItem('username');
|
var hasToken = localStorage.getItem('access_token') || localStorage.getItem('username');
|
||||||
if (hasToken) {
|
if (hasToken) {
|
||||||
try {
|
clearYakTubeAuthSession();
|
||||||
localStorage.clear();
|
|
||||||
sessionStorage.clear();
|
|
||||||
} catch (err) {}
|
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Clear YakTube auth session and cloud search cache safely
|
||||||
|
function clearYakTubeAuthSession() {
|
||||||
|
try {
|
||||||
|
localStorage.removeItem('access_token');
|
||||||
|
localStorage.removeItem('refresh_token');
|
||||||
|
localStorage.removeItem('token_type');
|
||||||
|
localStorage.removeItem('id');
|
||||||
|
localStorage.removeItem('username');
|
||||||
|
localStorage.removeItem('displayName');
|
||||||
|
localStorage.removeItem('email');
|
||||||
|
localStorage.removeItem('role');
|
||||||
|
localStorage.removeItem('yaktube_recent_searches');
|
||||||
|
sessionStorage.clear();
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
// Unified single sign-out for YakTube and YakNet
|
// Unified single sign-out for YakTube and YakNet
|
||||||
function performUnifiedLogout() {
|
function performUnifiedLogout() {
|
||||||
|
clearYakTubeAuthSession();
|
||||||
try {
|
try {
|
||||||
localStorage.clear();
|
|
||||||
sessionStorage.clear();
|
|
||||||
sessionStorage.setItem('yaknet_manual_logout', 'true');
|
sessionStorage.setItem('yaknet_manual_logout', 'true');
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
window.location.replace(
|
window.location.replace(
|
||||||
@@ -283,15 +388,18 @@
|
|||||||
var isAuth = !!token && !!uName;
|
var isAuth = !!token && !!uName;
|
||||||
|
|
||||||
if (headerRight) {
|
if (headerRight) {
|
||||||
var defaultLoginLink = headerRight.querySelector('my-login-link, a[href*="/login"], .login-button');
|
|
||||||
var liveWidget = headerRight.querySelector('#yaknet-header-account-widget');
|
var liveWidget = headerRight.querySelector('#yaknet-header-account-widget');
|
||||||
|
|
||||||
if (isAuth) {
|
if (isAuth) {
|
||||||
// Logged In: Show YakNet Profile Menu, Hide default login link
|
// 1. AUTHENTICATED: Add class to body & Hide ALL native login links completely
|
||||||
if (defaultLoginLink) {
|
document.body.classList.add('yaktube-user-logged-in');
|
||||||
defaultLoginLink.style.display = 'none';
|
document
|
||||||
defaultLoginLink.setAttribute('aria-hidden', 'true');
|
.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) {
|
if (!liveWidget) {
|
||||||
var widgetWrap = document.createElement('div');
|
var widgetWrap = document.createElement('div');
|
||||||
@@ -332,6 +440,16 @@
|
|||||||
} else {
|
} else {
|
||||||
var el = liveWidget.querySelector('yaknet-account');
|
var el = liveWidget.querySelector('yaknet-account');
|
||||||
if (el) {
|
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) {
|
if (el.shadowRoot) {
|
||||||
var shadowLogoutBtn =
|
var shadowLogoutBtn =
|
||||||
el.shadowRoot.getElementById('logoutBtn') ||
|
el.shadowRoot.getElementById('logoutBtn') ||
|
||||||
@@ -350,32 +468,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 {
|
} 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) {
|
if (liveWidget) {
|
||||||
liveWidget.remove();
|
liveWidget.remove();
|
||||||
}
|
}
|
||||||
if (defaultLoginLink) {
|
|
||||||
defaultLoginLink.style.display = '';
|
|
||||||
defaultLoginLink.removeAttribute('aria-hidden');
|
|
||||||
|
|
||||||
var loginAnchor =
|
document
|
||||||
defaultLoginLink.tagName.toLowerCase() === 'a' ? defaultLoginLink : defaultLoginLink.querySelector('a');
|
.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) {
|
if (loginAnchor) {
|
||||||
loginAnchor.setAttribute('aria-label', 'YakNet ile Giriş Yap');
|
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');
|
var spanText = loginAnchor.querySelector('span');
|
||||||
if (spanText) {
|
if (spanText) {
|
||||||
spanText.textContent = 'YakNet ile Giriş Yap';
|
spanText.textContent = 'YakNet ile Giriş Yap';
|
||||||
@@ -383,7 +495,7 @@
|
|||||||
loginAnchor.textContent = 'YakNet ile Giriş Yap';
|
loginAnchor.textContent = 'YakNet ile Giriş Yap';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,7 +555,9 @@
|
|||||||
if (containerToHide && !isLocalLogin) {
|
if (containerToHide && !isLocalLogin) {
|
||||||
var subElements = Array.from(loginCard.children).filter(function (el) {
|
var subElements = Array.from(loginCard.children).filter(function (el) {
|
||||||
return (
|
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 +595,50 @@
|
|||||||
|
|
||||||
injectYakNetSSO();
|
injectYakNetSSO();
|
||||||
|
|
||||||
|
// 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
|
// 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(
|
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"]'
|
'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"]'
|
||||||
);
|
);
|
||||||
@@ -519,7 +676,8 @@
|
|||||||
.replace(/PeerTube hakkında/gi, 'YakTube Hakkında')
|
.replace(/PeerTube hakkında/gi, 'YakTube Hakkında')
|
||||||
.replace(/PeerTube'a katılın/gi, "YakTube'a Katılın")
|
.replace(/PeerTube'a katılın/gi, "YakTube'a Katılın")
|
||||||
.replace(/PeerTube örneği/gi, 'YakTube Sunucusu')
|
.replace(/PeerTube örneği/gi, 'YakTube Sunucusu')
|
||||||
.replace(/PeerTube/g, 'YakTube');
|
.replace(/PeerTube/g, 'YakTube')
|
||||||
|
.replace(/Giriş sayfasına git/gi, 'YakNet ile Giriş Yap');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -639,7 +797,9 @@
|
|||||||
if (!alt || alt.trim() === '') {
|
if (!alt || alt.trim() === '') {
|
||||||
var card = img.closest('.video-miniature, .video-card, .yaktube-card, [class*="miniature"]');
|
var card = img.closest('.video-miniature, .video-card, .yaktube-card, [class*="miniature"]');
|
||||||
if (card) {
|
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() : '';
|
var titleText = titleEl ? (titleEl.textContent || titleEl.getAttribute('title') || '').trim() : '';
|
||||||
if (titleText) {
|
if (titleText) {
|
||||||
img.setAttribute('alt', titleText + ' video kapağı');
|
img.setAttribute('alt', titleText + ' video kapağı');
|
||||||
@@ -785,7 +945,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getVideoElement() {
|
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) {
|
function formatTime(seconds) {
|
||||||
@@ -1469,7 +1644,10 @@
|
|||||||
if (sData.isImporting) {
|
if (sData.isImporting) {
|
||||||
showModal('[1/2] 📥 Video İndiriliyor...', 'Video sunucuya indiriliyor (' + attempts * 2 + ' sn)...');
|
showModal('[1/2] 📥 Video İndiriliyor...', 'Video sunucuya indiriliyor (' + attempts * 2 + ' sn)...');
|
||||||
} else if (sData.isTranscoding) {
|
} 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)) {
|
if (sData.isPublished || (sData.hasFiles && attempts >= 8)) {
|
||||||
@@ -1513,6 +1691,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkAndInjectSearchResults() {
|
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 url = new URL(window.location.href);
|
||||||
var searchParam = url.searchParams.get('search');
|
var searchParam = url.searchParams.get('search');
|
||||||
|
|
||||||
@@ -1793,6 +1983,284 @@
|
|||||||
var activeVoiceRec = null;
|
var activeVoiceRec = null;
|
||||||
var isVoiceListening = false;
|
var isVoiceListening = false;
|
||||||
|
|
||||||
|
// 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');
|
||||||
|
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'];
|
||||||
|
if (!isUserLoggedIn()) {
|
||||||
|
try {
|
||||||
|
localStorage.setItem('yaktube_recent_searches', JSON.stringify(defaults));
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
return defaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
function callCloudSearchHistory(method, queryParams, body, onSuccess, onError) {
|
||||||
|
var token = localStorage.getItem('access_token');
|
||||||
|
var email = localStorage.getItem('email');
|
||||||
|
var headers = {};
|
||||||
|
if (body) headers['Content-Type'] = 'application/json';
|
||||||
|
if (token) headers['Authorization'] = 'Bearer ' + token;
|
||||||
|
if (email) headers['X-User-Email'] = email;
|
||||||
|
|
||||||
|
var authUrl = 'https://auth.yakhub.com.tr/api/yaktube/search-history' + (queryParams || '');
|
||||||
|
var bridgeUrl = '/api-custom/search-history' + (queryParams || '');
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
method: method,
|
||||||
|
headers: headers,
|
||||||
|
credentials: 'include'
|
||||||
|
};
|
||||||
|
if (body) options.body = JSON.stringify(body);
|
||||||
|
|
||||||
|
fetch(authUrl, options)
|
||||||
|
.then(function (res) {
|
||||||
|
if (!res.ok) throw new Error('Auth server status ' + res.status);
|
||||||
|
return res.json();
|
||||||
|
})
|
||||||
|
.then(function (data) {
|
||||||
|
if (typeof onSuccess === 'function') onSuccess(data);
|
||||||
|
})
|
||||||
|
.catch(function () {
|
||||||
|
// Fallback to local PeerTube bridge proxy
|
||||||
|
fetch(bridgeUrl, options)
|
||||||
|
.then(function (res) { return res.json(); })
|
||||||
|
.then(function (data) {
|
||||||
|
if (typeof onSuccess === 'function') onSuccess(data);
|
||||||
|
})
|
||||||
|
.catch(function (e) {
|
||||||
|
if (typeof onError === 'function') onError(e);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var isSyncingHistory = false;
|
||||||
|
function syncCloudSearchHistory(callback) {
|
||||||
|
if (!isAccountSyncEnabled() || isSyncingHistory) return;
|
||||||
|
isSyncingHistory = true;
|
||||||
|
|
||||||
|
callCloudSearchHistory('GET', '', null, function (data) {
|
||||||
|
isSyncingHistory = false;
|
||||||
|
if (data && data.status === 'success' && Array.isArray(data.history)) {
|
||||||
|
if (data.history.length > 0) {
|
||||||
|
localStorage.setItem('yaktube_recent_searches', JSON.stringify(data.history));
|
||||||
|
}
|
||||||
|
if (typeof callback === 'function') callback();
|
||||||
|
}
|
||||||
|
}, function () {
|
||||||
|
isSyncingHistory = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveRecentSearch(query) {
|
||||||
|
if (!query || query.trim().length < 2) return;
|
||||||
|
var q = query.trim();
|
||||||
|
try {
|
||||||
|
var list = getRecentSearches();
|
||||||
|
list = list.filter(function (item) {
|
||||||
|
return item.toLowerCase() !== q.toLowerCase();
|
||||||
|
});
|
||||||
|
list.unshift(q);
|
||||||
|
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()) {
|
||||||
|
callCloudSearchHistory('POST', '', { query: q, device_name: 'YakTube Web' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearRecentSearches() {
|
||||||
|
try {
|
||||||
|
localStorage.removeItem('yaktube_recent_searches');
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
if (isAccountSyncEnabled()) {
|
||||||
|
callCloudSearchHistory('DELETE', '', null);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderDynamicSearchChips();
|
||||||
|
announce('Arama geçmişi temizlendi.');
|
||||||
|
}
|
||||||
|
|
||||||
|
var popularTrendingQueries = [
|
||||||
|
{ title: '🎵 Türkçe Pop', q: 'Türkçe Pop' },
|
||||||
|
{ title: '🎸 Anadolu Rock', q: 'Anadolu Rock' },
|
||||||
|
{ title: '🤖 Yapay Zeka', q: 'Yapay Zeka' },
|
||||||
|
{ title: '💻 Yazılım Dersleri', q: 'Yazılım Dersleri' },
|
||||||
|
{ title: '🎧 Sesli Kitap & Radyo Tiyatrosu', q: 'Sesli Kitap' },
|
||||||
|
{ title: '📺 Canlı Haber', q: 'Canlı Haber' },
|
||||||
|
{ title: '🌍 Bilim & Belgesel', q: 'Bilim Belgeseli' },
|
||||||
|
{ title: '🎼 Akustik Canlı Performans', q: 'Akustik Canlı' },
|
||||||
|
{ 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;
|
||||||
|
|
||||||
|
var container = modal.querySelector('#yaktube-modal-dynamic-chips-section');
|
||||||
|
if (!container) return;
|
||||||
|
|
||||||
|
var recent = getRecentSearches();
|
||||||
|
var loggedIn = isUserLoggedIn();
|
||||||
|
var syncEnabled = isAccountSyncEnabled();
|
||||||
|
var html = '';
|
||||||
|
|
||||||
|
// 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 +=
|
||||||
|
'<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, '"');
|
||||||
|
html +=
|
||||||
|
'<button class="yaktube-modal-chip yaktube-recent-chip" data-query="' +
|
||||||
|
safeTerm +
|
||||||
|
'" aria-label="Son arama: ' +
|
||||||
|
safeTerm +
|
||||||
|
'">🕒 ' +
|
||||||
|
safeTerm +
|
||||||
|
'</button>';
|
||||||
|
});
|
||||||
|
html += '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Popular & Trending searches section
|
||||||
|
html +=
|
||||||
|
'<div class="yaktube-modal-section-title">🔥 Hızlı ve Popüler Aramalar</div>' +
|
||||||
|
'<div class="yaktube-modal-chips-grid">';
|
||||||
|
|
||||||
|
popularTrendingQueries.forEach(function (item) {
|
||||||
|
var safeQ = item.q.replace(/"/g, '"');
|
||||||
|
html +=
|
||||||
|
'<button class="yaktube-modal-chip" data-query="' +
|
||||||
|
safeQ +
|
||||||
|
'" aria-label="Popüler arama: ' +
|
||||||
|
safeQ +
|
||||||
|
'">' +
|
||||||
|
item.title +
|
||||||
|
'</button>';
|
||||||
|
});
|
||||||
|
html += '</div>';
|
||||||
|
|
||||||
|
container.innerHTML = html;
|
||||||
|
|
||||||
|
// Attach click events
|
||||||
|
container.querySelectorAll('.yaktube-modal-chip').forEach(function (chip) {
|
||||||
|
chip.addEventListener('click', function () {
|
||||||
|
var query = chip.getAttribute('data-query');
|
||||||
|
var inp = modal.querySelector('#yaktube-modal-input');
|
||||||
|
if (inp) inp.value = query;
|
||||||
|
if (typeof window.__yaktube_execute_search__ === 'function') {
|
||||||
|
window.__yaktube_execute_search__(query);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var clearBtn = container.querySelector('#yaktube-clear-recent-btn');
|
||||||
|
if (clearBtn) {
|
||||||
|
clearBtn.addEventListener('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
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() {
|
function createFullSearchModal() {
|
||||||
var existingModal = document.getElementById('yaktube-full-search-modal');
|
var existingModal = document.getElementById('yaktube-full-search-modal');
|
||||||
if (existingModal) return existingModal;
|
if (existingModal) return existingModal;
|
||||||
@@ -1821,17 +2289,7 @@
|
|||||||
'<div id="yaktube-modal-voice-transcript" class="yaktube-modal-voice-transcript">Lütfen aramak istediğiniz videoyu söyleyin...</div>' +
|
'<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>' +
|
'<button id="yaktube-modal-mic-pulse" class="yaktube-modal-mic-pulse-btn" aria-label="Mikrofonu durdur">🎙️</button>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div class="yaktube-modal-section-title">🔥 Hızlı ve Popüler Aramalar</div>' +
|
'<div id="yaktube-modal-dynamic-chips-section"></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 class="yaktube-modal-hint-footer">' +
|
'<div class="yaktube-modal-hint-footer">' +
|
||||||
'<span>💡 <b>Enter</b> ile ara, <b>Shift+V</b> ile sesli ara</span>' +
|
'<span>💡 <b>Enter</b> ile ara, <b>Shift+V</b> ile sesli ara</span>' +
|
||||||
'<span><b>Escape</b> ile kapat</span>' +
|
'<span><b>Escape</b> ile kapat</span>' +
|
||||||
@@ -1881,11 +2339,14 @@
|
|||||||
function executeSearch(query) {
|
function executeSearch(query) {
|
||||||
var q = (query || inp.value || '').trim();
|
var q = (query || inp.value || '').trim();
|
||||||
if (q) {
|
if (q) {
|
||||||
|
saveRecentSearch(q);
|
||||||
announce('"' + q + '" için arama yapılıyor...', true);
|
announce('"' + q + '" için arama yapılıyor...', true);
|
||||||
closeFullSearchModal();
|
closeFullSearchModal();
|
||||||
window.location.href = '/search/videos?search=' + encodeURIComponent(q);
|
window.location.href = '/search?search=' + encodeURIComponent(q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
window.__yaktube_execute_search__ = executeSearch;
|
||||||
|
renderDynamicSearchChips();
|
||||||
|
|
||||||
submitBtn.addEventListener('click', function () {
|
submitBtn.addEventListener('click', function () {
|
||||||
executeSearch();
|
executeSearch();
|
||||||
@@ -1925,6 +2386,8 @@
|
|||||||
var modal = createFullSearchModal();
|
var modal = createFullSearchModal();
|
||||||
modal.classList.add('yaktube-modal-open');
|
modal.classList.add('yaktube-modal-open');
|
||||||
modal.style.display = 'flex';
|
modal.style.display = 'flex';
|
||||||
|
renderDynamicSearchChips();
|
||||||
|
syncCloudSearchHistory(renderDynamicSearchChips);
|
||||||
|
|
||||||
var inp = modal.querySelector('#yaktube-modal-input');
|
var inp = modal.querySelector('#yaktube-modal-input');
|
||||||
var clearBtn = modal.querySelector('#yaktube-modal-clear-btn');
|
var clearBtn = modal.querySelector('#yaktube-modal-clear-btn');
|
||||||
@@ -2011,7 +2474,7 @@
|
|||||||
announce('"' + transcript + '" için arama başlatılıyor...', true);
|
announce('"' + transcript + '" için arama başlatılıyor...', true);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
closeFullSearchModal();
|
closeFullSearchModal();
|
||||||
window.location.href = '/search/videos?search=' + encodeURIComponent(transcript);
|
window.location.href = '/search?search=' + encodeURIComponent(transcript);
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2059,7 +2522,10 @@
|
|||||||
|
|
||||||
var nativeInputs = searchContainer.querySelectorAll('input, button');
|
var nativeInputs = searchContainer.querySelectorAll('input, button');
|
||||||
nativeInputs.forEach(function (el) {
|
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.style.display = 'none';
|
||||||
el.setAttribute('tabindex', '-1');
|
el.setAttribute('tabindex', '-1');
|
||||||
el.setAttribute('aria-hidden', 'true');
|
el.setAttribute('aria-hidden', 'true');
|
||||||
@@ -2169,6 +2635,13 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Automatically trigger cloud search history pull on startup if logged in
|
||||||
|
try {
|
||||||
|
if (isAccountSyncEnabled()) {
|
||||||
|
syncCloudSearchHistory();
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
// 7.5. Reactive Hybrid Related Videos Engine (Watch Page)
|
// 7.5. Reactive Hybrid Related Videos Engine (Watch Page)
|
||||||
var currentActiveVideoKey = null;
|
var currentActiveVideoKey = null;
|
||||||
var isFetchingRelated = false;
|
var isFetchingRelated = false;
|
||||||
@@ -2325,7 +2798,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkAndInjectRelatedVideos(forceReload) {
|
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) {
|
if (!isWatchPage) {
|
||||||
var existing = document.getElementById('yaktube-hybrid-related-container');
|
var existing = document.getElementById('yaktube-hybrid-related-container');
|
||||||
if (existing) existing.remove();
|
if (existing) existing.remove();
|
||||||
@@ -2603,7 +3077,10 @@
|
|||||||
card.className = 'yaktube-comment-item';
|
card.className = 'yaktube-comment-item';
|
||||||
card.setAttribute('role', 'article');
|
card.setAttribute('role', 'article');
|
||||||
card.setAttribute('tabindex', '0');
|
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 =
|
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;';
|
'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;';
|
||||||
|
|
||||||
@@ -2679,9 +3156,11 @@
|
|||||||
|
|
||||||
// 6. PWA Mobile App Install Engine & Standalone Detection
|
// 6. PWA Mobile App Install Engine & Standalone Detection
|
||||||
var isInsideYakTubeApp =
|
var isInsideYakTubeApp =
|
||||||
navigator.userAgent.indexOf('YakTubeMobileApp') !== -1 ||
|
(navigator.userAgent && navigator.userAgent.indexOf('YakTubeMobileApp') !== -1) ||
|
||||||
window.matchMedia('(display-mode: standalone)').matches ||
|
(typeof window.matchMedia === 'function' &&
|
||||||
window.navigator.standalone === true;
|
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);
|
var isMobileDevice = /Android|iPhone|iPad|iPod|Mobile|Tablet/i.test(navigator.userAgent);
|
||||||
|
|
||||||
@@ -2736,7 +3215,12 @@
|
|||||||
headerButtons.prepend(installBtn);
|
headerButtons.prepend(installBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isYakTubeInstance() {
|
||||||
|
return window.location.hostname.includes('yaktube.yakhub.com.tr') || getInstanceName() === 'YakTube';
|
||||||
|
}
|
||||||
|
|
||||||
function injectApkDownloadButton() {
|
function injectApkDownloadButton() {
|
||||||
|
if (!isYakTubeInstance()) return;
|
||||||
// 1. If inside APK: NEVER show APK button
|
// 1. If inside APK: NEVER show APK button
|
||||||
if (isInsideYakTubeApp) {
|
if (isInsideYakTubeApp) {
|
||||||
var existBtnApp = document.getElementById('yaktube-apk-download-btn');
|
var existBtnApp = document.getElementById('yaktube-apk-download-btn');
|
||||||
@@ -2781,6 +3265,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function injectSidebarApkLink() {
|
function injectSidebarApkLink() {
|
||||||
|
if (!isYakTubeInstance()) return;
|
||||||
// If inside APK: NEVER show in sidebar
|
// If inside APK: NEVER show in sidebar
|
||||||
if (isInsideYakTubeApp) {
|
if (isInsideYakTubeApp) {
|
||||||
var existLink = document.getElementById('yaktube-sidebar-apk-link');
|
var existLink = document.getElementById('yaktube-sidebar-apk-link');
|
||||||
@@ -2828,3 +3313,148 @@
|
|||||||
});
|
});
|
||||||
checkAndInjectWatchPageComments();
|
checkAndInjectWatchPageComments();
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
// 5. Background Play (Screen-Off / Minimize) & MediaSession Lock-Screen Controls
|
||||||
|
(function initBackgroundPlaybackEngine() {
|
||||||
|
var videoState = {
|
||||||
|
hasPlayed: false,
|
||||||
|
explicitlyPausedByClick: false,
|
||||||
|
lastPlayTime: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
function attachVideoListeners(video) {
|
||||||
|
if (!video || video.hasAttribute('data-yaktube-bgplay-hooked')) return;
|
||||||
|
video.setAttribute('data-yaktube-bgplay-hooked', 'true');
|
||||||
|
|
||||||
|
video.addEventListener('play', function () {
|
||||||
|
videoState.hasPlayed = true;
|
||||||
|
videoState.explicitlyPausedByClick = false;
|
||||||
|
videoState.lastPlayTime = Date.now();
|
||||||
|
updateMediaSessionMetadata(video);
|
||||||
|
});
|
||||||
|
|
||||||
|
video.addEventListener('ended', function () {
|
||||||
|
videoState.hasPlayed = false;
|
||||||
|
videoState.explicitlyPausedByClick = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
video.addEventListener('timeupdate', function () {
|
||||||
|
updateMediaSessionPosition(video);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
// 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.explicitlyPausedByClick) {
|
||||||
|
video.play().catch(function () {});
|
||||||
|
}
|
||||||
|
}, 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) {
|
||||||
|
if (!('mediaSession' in navigator)) return;
|
||||||
|
|
||||||
|
var titleEl = document.querySelector('h1.video-title, .video-name, my-video-watch h1, .title');
|
||||||
|
var title = titleEl ? titleEl.textContent.trim() : 'YakTube Video';
|
||||||
|
var authorEl = document.querySelector('.actor-name, .channel-name, .video-channel-name, a.actor-link');
|
||||||
|
var artist = authorEl ? authorEl.textContent.trim() : 'YakTube';
|
||||||
|
|
||||||
|
var artwork = [];
|
||||||
|
var thumbEl = document.querySelector('meta[property="og:image"]');
|
||||||
|
if (thumbEl && thumbEl.content) {
|
||||||
|
artwork.push({ src: thumbEl.content, sizes: '512x512', type: 'image/jpeg' });
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
navigator.mediaSession.metadata = new MediaMetadata({
|
||||||
|
title: title,
|
||||||
|
artist: artist,
|
||||||
|
album: 'YakTube',
|
||||||
|
artwork: artwork
|
||||||
|
});
|
||||||
|
|
||||||
|
navigator.mediaSession.setActionHandler('play', function () {
|
||||||
|
video.play();
|
||||||
|
announce('Video oynatılıyor.');
|
||||||
|
});
|
||||||
|
navigator.mediaSession.setActionHandler('pause', function () {
|
||||||
|
videoState.pausedByUser = true;
|
||||||
|
video.pause();
|
||||||
|
announce('Video duraklatıldı.');
|
||||||
|
});
|
||||||
|
navigator.mediaSession.setActionHandler('seekbackward', function (details) {
|
||||||
|
var skipTime = details.seekOffset || 10;
|
||||||
|
video.currentTime = Math.max(0, video.currentTime - skipTime);
|
||||||
|
announce(skipTime + ' saniye geri sarıldı.');
|
||||||
|
});
|
||||||
|
navigator.mediaSession.setActionHandler('seekforward', function (details) {
|
||||||
|
var skipTime = details.seekOffset || 10;
|
||||||
|
video.currentTime = Math.min(video.duration || 99999, video.currentTime + skipTime);
|
||||||
|
announce(skipTime + ' saniye ileri sarıldı.');
|
||||||
|
});
|
||||||
|
navigator.mediaSession.setActionHandler('stop', function () {
|
||||||
|
videoState.pausedByUser = true;
|
||||||
|
video.pause();
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateMediaSessionPosition(video) {
|
||||||
|
if (!('mediaSession' in navigator) || !navigator.mediaSession.setPositionState) return;
|
||||||
|
if (isNaN(video.duration) || isNaN(video.currentTime) || video.duration <= 0) return;
|
||||||
|
try {
|
||||||
|
navigator.mediaSession.setPositionState({
|
||||||
|
duration: video.duration,
|
||||||
|
playbackRate: video.playbackRate || 1,
|
||||||
|
position: Math.min(video.currentTime, video.duration)
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto-hook active video elements
|
||||||
|
setInterval(function () {
|
||||||
|
var video = getVideoElement();
|
||||||
|
if (video) attachVideoListeners(video);
|
||||||
|
}, 1000);
|
||||||
|
})();
|
||||||
|
} catch (err) {
|
||||||
|
console.error('[YakTube] Safe catch error:', err);
|
||||||
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "peertube-plugin-yaktube-ondemand",
|
"name": "peertube-plugin-yaktube-ondemand",
|
||||||
"version": "1.4.4",
|
"version": "1.4.26",
|
||||||
"description": "Accessible On-Demand YouTube Import, Live Streams, Smart Recommendations and A11y Engine for PeerTube",
|
"description": "Accessible On-Demand YouTube Import, Live Streams, Smart Recommendations and A11y Engine for PeerTube",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"library": "./main.js",
|
"library": "./main.js",
|
||||||
|
|||||||
@@ -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 */
|
/* YakTube Accessibility & On-Demand CSS */
|
||||||
|
|
||||||
:focus-visible {
|
:focus-visible {
|
||||||
@@ -894,3 +946,18 @@ body.yaktube-theater-mode .video-js {
|
|||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
outline: none !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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user