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
4
Commits
88cdc34fa3
..
v1.4.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51e41df3ca | ||
|
|
97079931f2 | ||
|
|
22ed7a4bda | ||
|
|
774c8f0f02 |
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
docs/
|
|
||||||
*.log
|
*.log
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
dist/
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
docs/
|
|
||||||
*.log
|
|
||||||
.git
|
|
||||||
.github
|
|
||||||
@@ -283,104 +283,86 @@
|
|||||||
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 (!liveWidget) {
|
||||||
|
var widgetWrap = document.createElement('div');
|
||||||
|
widgetWrap.id = 'yaknet-header-account-widget';
|
||||||
|
widgetWrap.className = 'yaknet-header-widget';
|
||||||
|
widgetWrap.style.display = 'inline-flex';
|
||||||
|
widgetWrap.style.alignItems = 'center';
|
||||||
|
widgetWrap.style.marginRight = '8px';
|
||||||
|
|
||||||
if (isAuth) {
|
widgetWrap.innerHTML =
|
||||||
// Logged In: Show YakNet Profile Menu, Hide default login link
|
'<yaknet-account ' +
|
||||||
if (defaultLoginLink) {
|
'client-id="01a03c41-f758-721e-b927-619bffde5c23" ' +
|
||||||
defaultLoginLink.style.display = 'none';
|
'redirect-uri="https://yaktube.yakhub.com.tr/plugins/peertube-plugin-auth-yaknet/router/auth-callback" ' +
|
||||||
defaultLoginLink.setAttribute('aria-hidden', 'true');
|
'base-url="https://auth.yakhub.com.tr" ' +
|
||||||
|
'login-url="/login" ' +
|
||||||
|
'authenticated="' +
|
||||||
|
(isAuth ? 'true' : 'false') +
|
||||||
|
'" ' +
|
||||||
|
'user-name="' +
|
||||||
|
(isAuth ? displayName.replace(/"/g, '"') : '') +
|
||||||
|
'" ' +
|
||||||
|
'user-email="' +
|
||||||
|
(isAuth ? 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') ||
|
||||||
|
headerRight.querySelector('my-notification-bell');
|
||||||
|
|
||||||
|
if (targetSibling && targetSibling.parentElement === headerRight) {
|
||||||
|
headerRight.insertBefore(widgetWrap, targetSibling);
|
||||||
|
} else {
|
||||||
|
headerRight.prepend(widgetWrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!liveWidget) {
|
var defaultLoginLink = headerRight.querySelector('my-login-link');
|
||||||
var widgetWrap = document.createElement('div');
|
if (defaultLoginLink) {
|
||||||
widgetWrap.id = 'yaknet-header-account-widget';
|
defaultLoginLink.setAttribute('aria-hidden', 'true');
|
||||||
widgetWrap.className = 'yaknet-header-widget';
|
defaultLoginLink.setAttribute('tabindex', '-1');
|
||||||
widgetWrap.style.display = 'inline-flex';
|
defaultLoginLink.style.display = 'none';
|
||||||
widgetWrap.style.alignItems = 'center';
|
|
||||||
widgetWrap.style.marginRight = '8px';
|
|
||||||
|
|
||||||
widgetWrap.innerHTML =
|
|
||||||
'<yaknet-account ' +
|
|
||||||
'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="true" ' +
|
|
||||||
'user-name="' +
|
|
||||||
displayName.replace(/"/g, '"') +
|
|
||||||
'" ' +
|
|
||||||
'user-email="' +
|
|
||||||
emailStr.replace(/"/g, '"') +
|
|
||||||
'" ' +
|
|
||||||
'theme="dark">' +
|
|
||||||
'</yaknet-account>';
|
|
||||||
|
|
||||||
var targetSibling =
|
|
||||||
headerRight.querySelector('my-user-menu') ||
|
|
||||||
headerRight.querySelector('.user-menu') ||
|
|
||||||
headerRight.querySelector('.settings-button') ||
|
|
||||||
headerRight.querySelector('my-user-notifications') ||
|
|
||||||
headerRight.querySelector('my-notification-bell');
|
|
||||||
|
|
||||||
if (targetSibling && targetSibling.parentElement === headerRight) {
|
|
||||||
headerRight.insertBefore(widgetWrap, targetSibling);
|
|
||||||
} else {
|
|
||||||
headerRight.prepend(widgetWrap);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var el = liveWidget.querySelector('yaknet-account');
|
|
||||||
if (el) {
|
|
||||||
if (el.shadowRoot) {
|
|
||||||
var shadowLogoutBtn =
|
|
||||||
el.shadowRoot.getElementById('logoutBtn') ||
|
|
||||||
el.shadowRoot.querySelector('.yn-logout-btn') ||
|
|
||||||
el.shadowRoot.querySelector('button[title*="Çıkış"], button[aria-label*="Çıkış"]');
|
|
||||||
if (shadowLogoutBtn && !shadowLogoutBtn.hasAttribute('data-yaktube-hooked')) {
|
|
||||||
shadowLogoutBtn.setAttribute('data-yaktube-hooked', 'true');
|
|
||||||
shadowLogoutBtn.addEventListener(
|
|
||||||
'click',
|
|
||||||
function (ev) {
|
|
||||||
ev.preventDefault();
|
|
||||||
ev.stopPropagation();
|
|
||||||
performUnifiedLogout();
|
|
||||||
},
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
// Sync widget attributes dynamically if auth state changed
|
||||||
if (liveWidget) {
|
var el = liveWidget.querySelector('yaknet-account');
|
||||||
liveWidget.remove();
|
if (el) {
|
||||||
}
|
if (el.shadowRoot) {
|
||||||
if (defaultLoginLink) {
|
var shadowLogoutBtn =
|
||||||
defaultLoginLink.style.display = '';
|
el.shadowRoot.getElementById('logoutBtn') ||
|
||||||
defaultLoginLink.removeAttribute('aria-hidden');
|
el.shadowRoot.querySelector('.yn-logout-btn') ||
|
||||||
|
el.shadowRoot.querySelector('button[title*="Çıkış"], button[aria-label*="Çıkış"]');
|
||||||
|
if (shadowLogoutBtn && !shadowLogoutBtn.hasAttribute('data-yaktube-hooked')) {
|
||||||
|
shadowLogoutBtn.setAttribute('data-yaktube-hooked', 'true');
|
||||||
|
shadowLogoutBtn.addEventListener(
|
||||||
|
'click',
|
||||||
|
function (ev) {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
performUnifiedLogout();
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var loginAnchor =
|
var expectedAuth = isAuth ? 'true' : 'false';
|
||||||
defaultLoginLink.tagName.toLowerCase() === 'a' ? defaultLoginLink : defaultLoginLink.querySelector('a');
|
var expectedName = isAuth ? displayName : '';
|
||||||
if (loginAnchor) {
|
var expectedEmail = isAuth ? emailStr : '';
|
||||||
loginAnchor.setAttribute('aria-label', 'YakNet ile Giriş Yap');
|
if (el.getAttribute('authenticated') !== expectedAuth || el.getAttribute('user-name') !== expectedName) {
|
||||||
loginAnchor.setAttribute('title', 'YakNet Hesabınız ile Giriş Yapın');
|
el.setAttribute('authenticated', expectedAuth);
|
||||||
var spanText = loginAnchor.querySelector('span');
|
el.setAttribute('user-name', expectedName);
|
||||||
if (spanText) {
|
el.setAttribute('user-email', expectedEmail);
|
||||||
spanText.textContent = 'YakNet ile Giriş Yap';
|
if (typeof el.syncStateFromAttributes === 'function') {
|
||||||
} else {
|
el.syncStateFromAttributes();
|
||||||
loginAnchor.textContent = 'YakNet ile Giriş Yap';
|
el.render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -481,35 +463,6 @@
|
|||||||
|
|
||||||
injectYakNetSSO();
|
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
|
// Aggressively remove generic Framasoft Open-in-App / Play Store banners
|
||||||
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"]'
|
||||||
@@ -548,8 +501,7 @@
|
|||||||
.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');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1823,125 +1775,6 @@
|
|||||||
var activeVoiceRec = null;
|
var activeVoiceRec = null;
|
||||||
var isVoiceListening = false;
|
var isVoiceListening = false;
|
||||||
|
|
||||||
// Dynamic Search History & Trending Helpers
|
|
||||||
function getRecentSearches() {
|
|
||||||
try {
|
|
||||||
var data = localStorage.getItem('yaktube_recent_searches');
|
|
||||||
return data ? JSON.parse(data) : [];
|
|
||||||
} catch (e) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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' }
|
|
||||||
];
|
|
||||||
|
|
||||||
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() {
|
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;
|
||||||
@@ -2030,14 +1863,11 @@
|
|||||||
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/videos?search=' + encodeURIComponent(q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.__yaktube_execute_search__ = executeSearch;
|
|
||||||
renderDynamicSearchChips();
|
|
||||||
|
|
||||||
submitBtn.addEventListener('click', function () {
|
submitBtn.addEventListener('click', function () {
|
||||||
executeSearch();
|
executeSearch();
|
||||||
@@ -2077,7 +1907,6 @@
|
|||||||
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();
|
|
||||||
|
|
||||||
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');
|
||||||
@@ -2889,12 +2718,7 @@
|
|||||||
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');
|
||||||
@@ -2939,7 +2763,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
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');
|
||||||
@@ -2987,132 +2810,3 @@
|
|||||||
});
|
});
|
||||||
checkAndInjectWatchPageComments();
|
checkAndInjectWatchPageComments();
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// 5. Background Play (Screen-Off / Minimize) & MediaSession Lock-Screen Controls
|
|
||||||
(function initBackgroundPlaybackEngine() {
|
|
||||||
var videoState = {
|
|
||||||
hasPlayed: false,
|
|
||||||
pausedByUser: false,
|
|
||||||
pausedAt: null
|
|
||||||
};
|
|
||||||
|
|
||||||
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.pausedByUser = false;
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
|
|
||||||
video.addEventListener('timeupdate', function () {
|
|
||||||
updateMediaSessionPosition(video);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleVisibilityChange() {
|
|
||||||
if (!document.hidden) return; // Screen is active
|
|
||||||
|
|
||||||
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
|
|
||||||
setTimeout(function () {
|
|
||||||
if (video.paused && !videoState.pausedByUser) {
|
|
||||||
video.play().catch(function () {});
|
|
||||||
}
|
|
||||||
}, 50);
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('visibilitychange', handleVisibilityChange, false);
|
|
||||||
document.addEventListener('webkitvisibilitychange', 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);
|
|
||||||
})();
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "peertube-plugin-yaktube-ondemand",
|
"name": "peertube-plugin-yaktube-ondemand",
|
||||||
"version": "1.4.8",
|
"version": "1.4.3",
|
||||||
"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",
|
||||||
|
|||||||
Reference in New Issue
Block a user