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 | |
|---|---|---|---|
|
|
3016fc6328 | ||
|
|
dac3137330 | ||
|
|
15361a21b6 | ||
|
|
c6e5abf87e | ||
|
|
e161dea9da | ||
|
|
6fc0f0ef97 | ||
|
|
c4fc917677 | ||
|
|
551b6d1ab6 |
+1
-1
@@ -1,4 +1,4 @@
|
||||
node_modules/
|
||||
docs/
|
||||
*.log
|
||||
.DS_Store
|
||||
dist/
|
||||
@@ -0,0 +1,4 @@
|
||||
docs/
|
||||
*.log
|
||||
.git
|
||||
.github
|
||||
@@ -1,3 +1,4 @@
|
||||
try {
|
||||
(function () {
|
||||
if (window.__YAKTUBE_ENGINE_LOADED__) return;
|
||||
window.__YAKTUBE_ENGINE_LOADED__ = true;
|
||||
@@ -283,7 +284,15 @@
|
||||
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');
|
||||
|
||||
// Always hide duplicate native login link in favor of unified YakNet component
|
||||
if (defaultLoginLink) {
|
||||
defaultLoginLink.style.display = 'none';
|
||||
defaultLoginLink.setAttribute('aria-hidden', 'true');
|
||||
}
|
||||
|
||||
if (!liveWidget) {
|
||||
var widgetWrap = document.createElement('div');
|
||||
widgetWrap.id = 'yaknet-header-account-widget';
|
||||
@@ -297,22 +306,19 @@
|
||||
'client-id="01a03c41-f758-721e-b927-619bffde5c23" ' +
|
||||
'redirect-uri="https://yaktube.yakhub.com.tr/plugins/peertube-plugin-auth-yaknet/router/auth-callback" ' +
|
||||
'base-url="https://auth.yakhub.com.tr" ' +
|
||||
'login-url="/login" ' +
|
||||
'authenticated="' +
|
||||
(isAuth ? 'true' : 'false') +
|
||||
'" ' +
|
||||
'login-url="https://auth.yakhub.com.tr/oauth/authorize?client_id=01a03c41-f758-721e-b927-619bffde5c23&redirect_uri=https%3A%2F%2Fyaktube.yakhub.com.tr%2Fplugins%2Fpeertube-plugin-auth-yaknet%2Frouter%2Fauth-callback&response_type=code&scope=" ' +
|
||||
(isAuth ? 'authenticated="true" ' : 'authenticated="false" ') +
|
||||
'user-name="' +
|
||||
(isAuth ? displayName.replace(/"/g, '"') : '') +
|
||||
displayName.replace(/"/g, '"') +
|
||||
'" ' +
|
||||
'user-email="' +
|
||||
(isAuth ? emailStr.replace(/"/g, '"') : '') +
|
||||
emailStr.replace(/"/g, '"') +
|
||||
'" ' +
|
||||
'theme="dark">' +
|
||||
'</yaknet-account>';
|
||||
|
||||
var targetSibling =
|
||||
headerRight.querySelector('my-user-menu') ||
|
||||
headerRight.querySelector('my-login-link') ||
|
||||
headerRight.querySelector('.user-menu') ||
|
||||
headerRight.querySelector('.settings-button') ||
|
||||
headerRight.querySelector('my-user-notifications') ||
|
||||
@@ -323,17 +329,20 @@
|
||||
} else {
|
||||
headerRight.prepend(widgetWrap);
|
||||
}
|
||||
|
||||
var defaultLoginLink = headerRight.querySelector('my-login-link');
|
||||
if (defaultLoginLink) {
|
||||
defaultLoginLink.setAttribute('aria-hidden', 'true');
|
||||
defaultLoginLink.setAttribute('tabindex', '-1');
|
||||
defaultLoginLink.style.display = 'none';
|
||||
}
|
||||
} else {
|
||||
// Sync widget attributes dynamically if auth state changed
|
||||
var el = liveWidget.querySelector('yaknet-account');
|
||||
if (el) {
|
||||
var authAttr = isAuth ? 'true' : 'false';
|
||||
if (el.getAttribute('authenticated') !== authAttr || el.getAttribute('user-name') !== displayName) {
|
||||
el.setAttribute('authenticated', authAttr);
|
||||
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') ||
|
||||
@@ -352,19 +361,6 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var expectedAuth = isAuth ? 'true' : 'false';
|
||||
var expectedName = isAuth ? displayName : '';
|
||||
var expectedEmail = isAuth ? emailStr : '';
|
||||
if (el.getAttribute('authenticated') !== expectedAuth || el.getAttribute('user-name') !== expectedName) {
|
||||
el.setAttribute('authenticated', expectedAuth);
|
||||
el.setAttribute('user-name', expectedName);
|
||||
el.setAttribute('user-email', expectedEmail);
|
||||
if (typeof el.syncStateFromAttributes === 'function') {
|
||||
el.syncStateFromAttributes();
|
||||
el.render();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -425,7 +421,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')
|
||||
);
|
||||
});
|
||||
|
||||
@@ -463,6 +461,35 @@
|
||||
|
||||
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';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Aggressively remove generic Framasoft Open-in-App / Play Store banners
|
||||
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"]'
|
||||
@@ -501,7 +528,8 @@
|
||||
.replace(/PeerTube hakkında/gi, 'YakTube Hakkında')
|
||||
.replace(/PeerTube'a katılın/gi, "YakTube'a Katılın")
|
||||
.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');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -621,7 +649,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ğı');
|
||||
@@ -1451,7 +1481,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)) {
|
||||
@@ -1775,6 +1808,145 @@
|
||||
var activeVoiceRec = null;
|
||||
var isVoiceListening = false;
|
||||
|
||||
// Dynamic Search History & Trending Helpers
|
||||
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'];
|
||||
try {
|
||||
localStorage.setItem('yaktube_recent_searches', JSON.stringify(defaults));
|
||||
} catch (e) {}
|
||||
return defaults;
|
||||
}
|
||||
|
||||
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 > 8) list = list.slice(0, 8);
|
||||
localStorage.setItem('yaktube_recent_searches', JSON.stringify(list));
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function clearRecentSearches() {
|
||||
try {
|
||||
localStorage.removeItem('yaktube_recent_searches');
|
||||
} catch (e) {}
|
||||
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 html = '';
|
||||
|
||||
// 1. Recent searches section (if any)
|
||||
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;">';
|
||||
|
||||
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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function createFullSearchModal() {
|
||||
var existingModal = document.getElementById('yaktube-full-search-modal');
|
||||
if (existingModal) return existingModal;
|
||||
@@ -1803,17 +1975,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>' +
|
||||
@@ -1863,11 +2025,14 @@
|
||||
function executeSearch(query) {
|
||||
var q = (query || inp.value || '').trim();
|
||||
if (q) {
|
||||
saveRecentSearch(q);
|
||||
announce('"' + q + '" için arama yapılıyor...', true);
|
||||
closeFullSearchModal();
|
||||
window.location.href = '/search/videos?search=' + encodeURIComponent(q);
|
||||
}
|
||||
}
|
||||
window.__yaktube_execute_search__ = executeSearch;
|
||||
renderDynamicSearchChips();
|
||||
|
||||
submitBtn.addEventListener('click', function () {
|
||||
executeSearch();
|
||||
@@ -1907,6 +2072,7 @@
|
||||
var modal = createFullSearchModal();
|
||||
modal.classList.add('yaktube-modal-open');
|
||||
modal.style.display = 'flex';
|
||||
renderDynamicSearchChips();
|
||||
|
||||
var inp = modal.querySelector('#yaktube-modal-input');
|
||||
var clearBtn = modal.querySelector('#yaktube-modal-clear-btn');
|
||||
@@ -2041,7 +2207,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');
|
||||
@@ -2307,7 +2476,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();
|
||||
@@ -2585,7 +2755,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;';
|
||||
|
||||
@@ -2661,9 +2834,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);
|
||||
|
||||
@@ -2718,7 +2893,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');
|
||||
@@ -2763,6 +2943,7 @@
|
||||
}
|
||||
|
||||
function injectSidebarApkLink() {
|
||||
if (!isYakTubeInstance()) return;
|
||||
// If inside APK: NEVER show in sidebar
|
||||
if (isInsideYakTubeApp) {
|
||||
var existLink = document.getElementById('yaktube-sidebar-apk-link');
|
||||
@@ -2810,3 +2991,148 @@
|
||||
});
|
||||
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",
|
||||
"version": "1.4.3",
|
||||
"version": "1.4.11",
|
||||
"description": "Accessible On-Demand YouTube Import, Live Streams, Smart Recommendations and A11y Engine for PeerTube",
|
||||
"main": "main.js",
|
||||
"library": "./main.js",
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
/* 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 {
|
||||
|
||||
Reference in New Issue
Block a user