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 | |
|---|---|---|---|
|
|
875ee098bd | ||
|
|
d8e87f29d5 |
@@ -2283,15 +2283,33 @@ try {
|
||||
|
||||
function sanitizeWatchPageLabels(videoTitle) {
|
||||
// 1. Next Video button in Video.js control bar
|
||||
var firstRec =
|
||||
typeof window.__yaktube_get_first_smart_rec === 'function' ? window.__yaktube_get_first_smart_rec() : null;
|
||||
var nextLabel =
|
||||
firstRec && firstRec.title
|
||||
? 'Sonraki Video (İlk Öneri): ' + firstRec.title + ' (Shift+N)'
|
||||
: 'Sonraki Video (Shift+N)';
|
||||
var nextBtns = document.querySelectorAll(
|
||||
'.vjs-next-video-control, .vjs-next-control, button[title*="Next video"], button[aria-label*="Next video"]'
|
||||
'.vjs-next-video, .vjs-next-video-control, .vjs-next-control, button[title*="Next video"], button[aria-label*="Next video"]'
|
||||
);
|
||||
nextBtns.forEach(function (btn) {
|
||||
btn.setAttribute('aria-label', 'Sonraki Video (Shift+N)');
|
||||
btn.setAttribute('title', 'Sonraki Video (Shift+N)');
|
||||
if (
|
||||
firstRec &&
|
||||
!(typeof window.__yaktube_is_playlist_watch === 'function' && window.__yaktube_is_playlist_watch())
|
||||
) {
|
||||
btn.classList.remove('vjs-disabled');
|
||||
btn.classList.remove('vjs-hidden');
|
||||
btn.removeAttribute('disabled');
|
||||
}
|
||||
if (btn.getAttribute('aria-label') !== nextLabel) {
|
||||
btn.setAttribute('aria-label', nextLabel);
|
||||
}
|
||||
if (btn.getAttribute('title') !== nextLabel) {
|
||||
btn.setAttribute('title', nextLabel);
|
||||
}
|
||||
var ctrlText = btn.querySelector('.vjs-control-text');
|
||||
if (ctrlText && ctrlText.textContent.includes('Next video')) {
|
||||
ctrlText.textContent = 'Sonraki Video (Shift+N)';
|
||||
if (ctrlText && ctrlText.textContent !== nextLabel) {
|
||||
ctrlText.textContent = nextLabel;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2769,11 +2787,18 @@ try {
|
||||
return;
|
||||
}
|
||||
|
||||
// Shift+N: Next Video
|
||||
// Shift+N: Next Video (Smart First Recommendation)
|
||||
if (e.shiftKey && (e.key === 'n' || e.key === 'N')) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var nextBtn = document.querySelector('.vjs-next-video-control, .vjs-next-control');
|
||||
if (
|
||||
!(typeof window.__yaktube_is_playlist_watch === 'function' && window.__yaktube_is_playlist_watch()) &&
|
||||
typeof window.__yaktube_play_next_smart__ === 'function'
|
||||
) {
|
||||
window.__yaktube_play_next_smart__('player-shortcut-shift-n');
|
||||
return;
|
||||
}
|
||||
var nextBtn = document.querySelector('.vjs-next-video, .vjs-next-video-control, .vjs-next-control');
|
||||
if (nextBtn) {
|
||||
nextBtn.click();
|
||||
announce('Sonraki videoya geçiliyor...');
|
||||
@@ -2827,9 +2852,22 @@ try {
|
||||
bar.setAttribute('role', 'toolbar');
|
||||
bar.setAttribute('aria-label', 'Video Araçları ve Ek Özellikler');
|
||||
|
||||
var initialAutoPlay = true;
|
||||
try {
|
||||
initialAutoPlay = localStorage.getItem('yaktube_smart_autoplay') !== 'false';
|
||||
} catch (e) {}
|
||||
|
||||
bar.innerHTML =
|
||||
'<span class="yaktube-player-bar-label">🛠️ Video Araçları:</span>' +
|
||||
'<button id="yaktube-bar-back-btn" class="yaktube-player-action-btn" aria-label="Önceki Sayfaya Geri Dön (Alt+Sol Ok)" title="Önceki Sayfaya Geri Dön (Alt+Sol Ok)">⬅️ Geri Dön</button>' +
|
||||
'<button id="yaktube-bar-next-btn" class="yaktube-player-action-btn" aria-label="Sıradaki İlk Önerilen Videoyu Oynat (Shift+N)" title="Sıradaki İlk Önerilen Videoyu Oynat (Shift+N)">⏭️ Sonraki</button>' +
|
||||
'<button id="yaktube-bar-autoplay-btn" class="yaktube-player-action-btn" role="switch" aria-checked="' +
|
||||
(initialAutoPlay ? 'true' : 'false') +
|
||||
'" aria-label="Akıllı Otomatik Oynatma: ' +
|
||||
(initialAutoPlay ? 'Açık' : 'Kapalı') +
|
||||
'" title="Video bittiğinde ilk öneriyi otomatik oynat">' +
|
||||
(initialAutoPlay ? '🔁 Oto-Oynat: Açık' : '🔁 Oto-Oynat: Kapalı') +
|
||||
'</button>' +
|
||||
'<button id="yaktube-bar-speed-btn" class="yaktube-player-action-btn" aria-label="Oynatma Hızını Değiştir (Alt+.)">⚡ Hız</button>' +
|
||||
'<button id="yaktube-bar-sleep-btn" class="yaktube-player-action-btn" aria-label="Uyku Zamanlayıcısı (Alt+U)">⏱️ Uyku</button>' +
|
||||
'<button id="yaktube-bar-qr-btn" class="yaktube-player-action-btn" aria-label="Telefonda Devam Et / QR Kod (Alt+Q)">📱 Telefonda Aç</button>' +
|
||||
@@ -2870,6 +2908,24 @@ try {
|
||||
});
|
||||
}
|
||||
|
||||
var nextBarBtn = bar.querySelector('#yaktube-bar-next-btn');
|
||||
if (nextBarBtn) {
|
||||
nextBarBtn.addEventListener('click', function () {
|
||||
if (typeof window.__yaktube_play_next_smart__ === 'function') {
|
||||
window.__yaktube_play_next_smart__('action-bar-next');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var autoPlayBarBtn = bar.querySelector('#yaktube-bar-autoplay-btn');
|
||||
if (autoPlayBarBtn) {
|
||||
autoPlayBarBtn.addEventListener('click', function () {
|
||||
if (typeof window.__yaktube_toggle_smart_autoplay__ === 'function') {
|
||||
window.__yaktube_toggle_smart_autoplay__();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bar.querySelector('#yaktube-bar-speed-btn').addEventListener('click', function () {
|
||||
adjustPlaybackSpeed(true);
|
||||
});
|
||||
@@ -3147,6 +3203,19 @@ try {
|
||||
e.preventDefault();
|
||||
adjustPlaybackSpeed(false);
|
||||
}
|
||||
// Next Video: Shift+N or Alt+N (Plays #1 Smart Recommendation)
|
||||
else if ((e.shiftKey && key === 'n') || (alt && key === 'n')) {
|
||||
e.preventDefault();
|
||||
if (
|
||||
!(typeof window.__yaktube_is_playlist_watch === 'function' && window.__yaktube_is_playlist_watch()) &&
|
||||
typeof window.__yaktube_play_next_smart__ === 'function'
|
||||
) {
|
||||
window.__yaktube_play_next_smart__('global-shortcut-shift-n');
|
||||
} else {
|
||||
var nextBtnGlobal = document.querySelector('.vjs-next-video, .vjs-next-video-control, .vjs-next-control');
|
||||
if (nextBtnGlobal) nextBtnGlobal.click();
|
||||
}
|
||||
}
|
||||
// Percentage Jumps (0 - 9)
|
||||
else if (key >= '0' && key <= '9' && !e.ctrlKey && !e.altKey && !e.metaKey) {
|
||||
e.preventDefault();
|
||||
@@ -3615,6 +3684,7 @@ try {
|
||||
var cachedGuestImportLimit = null;
|
||||
var cachedCategories = null;
|
||||
var cachedSmartPrefetchMode = 'auto-when-no-local';
|
||||
var cachedFederatedRecommendationsMode = 'smart-relevant';
|
||||
|
||||
function fetchGuestImportLimit() {
|
||||
if (cachedGuestImportLimit !== null && cachedCategories !== null) {
|
||||
@@ -3631,6 +3701,9 @@ try {
|
||||
if (d && typeof d.smartPrefetchMode === 'string') {
|
||||
cachedSmartPrefetchMode = d.smartPrefetchMode;
|
||||
}
|
||||
if (d && typeof d.federatedRecommendationsMode === 'string') {
|
||||
cachedFederatedRecommendationsMode = d.federatedRecommendationsMode;
|
||||
}
|
||||
if (d && Array.isArray(d.categories) && d.categories.length > 0) {
|
||||
cachedCategories = d.categories;
|
||||
try {
|
||||
@@ -5690,6 +5763,172 @@ try {
|
||||
return interests.slice(0, 8);
|
||||
}
|
||||
|
||||
var showNativeFediverseDrawer = false;
|
||||
|
||||
function isPlaylistWatch() {
|
||||
if (typeof window === 'undefined' || !window.location) return false;
|
||||
var p = window.location.pathname || '';
|
||||
var s = window.location.search || '';
|
||||
return p.includes('/w/p/') || s.includes('playlistPosition=') || s.includes('videoPlaylist=');
|
||||
}
|
||||
window.__yaktube_is_playlist_watch = isPlaylistWatch;
|
||||
|
||||
function isYakTubeAutoplayEnabled() {
|
||||
try {
|
||||
return localStorage.getItem('yaktube_smart_autoplay') !== 'false';
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function setYakTubeAutoplayEnabled(enabled) {
|
||||
var val = Boolean(enabled);
|
||||
try {
|
||||
localStorage.setItem('yaktube_smart_autoplay', val ? 'true' : 'false');
|
||||
} catch (e) {}
|
||||
syncPlayerNextButtonAndAutoplayUI();
|
||||
var relContainer = document.getElementById('yaktube-hybrid-related-container');
|
||||
if (relContainer && cachedRelatedResults && cachedRelatedResults.length > 0) {
|
||||
renderRelatedCards(relContainer, cachedRelatedResults, cachedRelatedQuery);
|
||||
}
|
||||
announce(
|
||||
val
|
||||
? 'Akıllı otomatik oynatma açıldı. Video bittiğinde ilk öneri otomatik oynatılacak.'
|
||||
: 'Akıllı otomatik oynatma kapatıldı.'
|
||||
);
|
||||
showQuickToast(val ? '🔁 Otomatik Oynatma: Açık' : '🔁 Otomatik Oynatma: Kapalı');
|
||||
}
|
||||
|
||||
function toggleYakTubeAutoplay() {
|
||||
setYakTubeAutoplayEnabled(!isYakTubeAutoplayEnabled());
|
||||
}
|
||||
window.__yaktube_toggle_smart_autoplay__ = toggleYakTubeAutoplay;
|
||||
|
||||
function getFirstSmartRecommendation() {
|
||||
if (cachedRelatedResults && cachedRelatedResults.length > 0 && cachedRelatedResults[0]) {
|
||||
return cachedRelatedResults[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
window.__yaktube_get_first_smart_rec = getFirstSmartRecommendation;
|
||||
|
||||
function playFirstSmartRecommendation(triggerSource) {
|
||||
clearUpNextOverlay();
|
||||
var nextItem = getFirstSmartRecommendation();
|
||||
if (!nextItem) {
|
||||
announce('Henüz sıradaki öneri hazır değil.');
|
||||
showQuickToast('⏳ Öneriler yükleniyor...');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nextItem.isDownloaded && nextItem.localVideo && nextItem.localVideo.url) {
|
||||
announce('Sıradaki ilk öneri oynatılıyor: ' + (nextItem.title || ''));
|
||||
showQuickToast('⏭️ ' + (nextItem.title || 'Sıradaki Video'));
|
||||
currentActiveVideoKey = null;
|
||||
window.location.href = nextItem.localVideo.url;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (nextItem.url) {
|
||||
announce(
|
||||
'Sıradaki ilk öneri ' + getInstanceName() + "'a aktarılıp hemen oynatılıyor: " + (nextItem.title || '')
|
||||
);
|
||||
showQuickToast('📥 İlk öneri hazırlanıp oynatılıyor...');
|
||||
var existingCardBtn = null;
|
||||
var relContainer = document.getElementById('yaktube-hybrid-related-container');
|
||||
if (relContainer) {
|
||||
existingCardBtn = relContainer.querySelector('.yaktube-related-import');
|
||||
}
|
||||
var targetBtn = existingCardBtn || document.createElement('button');
|
||||
handleImport(nextItem.url, targetBtn, nextItem.title || 'Sıradaki Video');
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
window.__yaktube_play_next_smart__ = playFirstSmartRecommendation;
|
||||
|
||||
function syncPlayerNextButtonAndAutoplayUI() {
|
||||
var firstRec = getFirstSmartRecommendation();
|
||||
var autoOn = isYakTubeAutoplayEnabled();
|
||||
|
||||
var barAutoBtn = document.getElementById('yaktube-bar-autoplay-btn');
|
||||
if (barAutoBtn) {
|
||||
barAutoBtn.setAttribute('aria-checked', autoOn ? 'true' : 'false');
|
||||
barAutoBtn.setAttribute('aria-label', 'Akıllı Otomatik Oynatma: ' + (autoOn ? 'Açık' : 'Kapalı'));
|
||||
barAutoBtn.textContent = autoOn ? '🔁 Oto-Oynat: Açık' : '🔁 Oto-Oynat: Kapalı';
|
||||
}
|
||||
|
||||
var barNextBtn = document.getElementById('yaktube-bar-next-btn');
|
||||
if (barNextBtn) {
|
||||
var barNextLabel =
|
||||
firstRec && firstRec.title
|
||||
? 'Sıradaki İlk Öneri: ' + firstRec.title + ' (Shift+N)'
|
||||
: 'Sıradaki İlk Önerilen Videoyu Oynat (Shift+N)';
|
||||
barNextBtn.setAttribute('aria-label', barNextLabel);
|
||||
barNextBtn.setAttribute('title', barNextLabel);
|
||||
}
|
||||
|
||||
if (!isPlaylistWatch()) {
|
||||
// Hide PeerTube's native Fediverse upnext overlay inside Video.js so YakTube Smart Autoplay handles it
|
||||
var nativeUpNext = document.querySelectorAll('.vjs-upnext-content');
|
||||
nativeUpNext.forEach(function (el) {
|
||||
el.style.setProperty('display', 'none', 'important');
|
||||
el.setAttribute('aria-hidden', 'true');
|
||||
});
|
||||
|
||||
var nextBtns = document.querySelectorAll('.vjs-next-video, .vjs-next-video-control, .vjs-next-control');
|
||||
nextBtns.forEach(function (btn) {
|
||||
if (firstRec) {
|
||||
btn.classList.remove('vjs-disabled');
|
||||
btn.classList.remove('vjs-hidden');
|
||||
btn.removeAttribute('disabled');
|
||||
var lbl = 'Sonraki Video (İlk Öneri): ' + (firstRec.title || '') + ' (Shift+N)';
|
||||
btn.setAttribute('aria-label', lbl);
|
||||
btn.setAttribute('title', lbl);
|
||||
var ctrlTxt = btn.querySelector('.vjs-control-text');
|
||||
if (ctrlTxt) ctrlTxt.textContent = lbl;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Intercept clicks & keydowns on Video.js native ".vjs-next-video" button so it plays #1 Smart Recommendation instead of Fediverse
|
||||
document.addEventListener(
|
||||
'click',
|
||||
function (e) {
|
||||
if (!e.target || typeof e.target.closest !== 'function') return;
|
||||
var nextBtn = e.target.closest(
|
||||
'.vjs-next-video, .vjs-next-video-control, .vjs-next-control, .vjs-upnext-autoplay-icon'
|
||||
);
|
||||
if (nextBtn && !isPlaylistWatch() && getFirstSmartRecommendation()) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
playFirstSmartRecommendation('vjs-next-button');
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
document.addEventListener(
|
||||
'keydown',
|
||||
function (e) {
|
||||
if (e.key !== 'Enter' && e.key !== ' ') return;
|
||||
if (!e.target || typeof e.target.closest !== 'function') return;
|
||||
var nextBtn = e.target.closest(
|
||||
'.vjs-next-video, .vjs-next-video-control, .vjs-next-control, .vjs-upnext-autoplay-icon'
|
||||
);
|
||||
if (nextBtn && !isPlaylistWatch() && getFirstSmartRecommendation()) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
playFirstSmartRecommendation('vjs-next-button-key');
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
function suppressUnrelatedNativeRecommendations() {
|
||||
try {
|
||||
// Prevent PeerTube's native player from auto-redirecting to unrelated foreign/federated videos on video end
|
||||
@@ -5697,14 +5936,25 @@ try {
|
||||
sessionStorage.setItem('auto-play-video', 'false');
|
||||
} catch (e) {}
|
||||
|
||||
syncPlayerNextButtonAndAutoplayUI();
|
||||
|
||||
var shouldShowNativeList =
|
||||
cachedFederatedRecommendationsMode === 'show-all' ||
|
||||
(cachedFederatedRecommendationsMode === 'smart-relevant' && showNativeFediverseDrawer);
|
||||
|
||||
var recContainers = document.querySelectorAll('my-recommended-videos, .other-videos, .video-watch-next');
|
||||
recContainers.forEach(function (rec) {
|
||||
Array.from(rec.children).forEach(function (child) {
|
||||
if (child.id === 'yaktube-hybrid-related-container' || child.id === 'yaktube-upnext-overlay') {
|
||||
return;
|
||||
}
|
||||
if (shouldShowNativeList) {
|
||||
child.style.removeProperty('display');
|
||||
child.removeAttribute('aria-hidden');
|
||||
} else {
|
||||
child.style.setProperty('display', 'none', 'important');
|
||||
child.setAttribute('aria-hidden', 'true');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -5723,18 +5973,29 @@ try {
|
||||
var displayed = results.slice(0, limit);
|
||||
|
||||
var cardsHtml = '';
|
||||
displayed.forEach(function (item) {
|
||||
displayed.forEach(function (item, idx) {
|
||||
var isLocal = !!item.isDownloaded;
|
||||
var badgeLabel = item.reasonBadge || (isLocal ? '✅ ' + getInstanceName() + "'da İzle" : '🔥 Benzer İçerik');
|
||||
var isFed = !!item.isFederated;
|
||||
var isFirstRec = idx === 0;
|
||||
var badgeLabel =
|
||||
item.reasonBadge ||
|
||||
(isFed ? "🌐 Fediverse'de İzle" : isLocal ? '✅ ' + getInstanceName() + "'da İzle" : '🔥 Benzer İçerik');
|
||||
var isHistoryMatch = badgeLabel.indexOf('Geçmişinize Göre') !== -1;
|
||||
|
||||
var badgeStyle = isLocal
|
||||
var badgeStyle = isFed
|
||||
? 'background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); color: #fff;'
|
||||
: isLocal
|
||||
? 'background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: #fff;'
|
||||
: isHistoryMatch
|
||||
? 'background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); color: #fff;'
|
||||
: 'background: linear-gradient(135deg, #ff8f37 0%, #ff5e3a 100%); color: #fff;';
|
||||
|
||||
var firstBadgeHtml = isFirstRec
|
||||
? '<span class="yaktube-badge" style="background: #ff8f37; color: #000; margin-bottom: 4px; margin-right: 4px; display: inline-block; font-size:10px; padding:2px 7px; font-weight:800;">⏭️ İLK ÖNERİ</span>'
|
||||
: '';
|
||||
|
||||
var statusBadge =
|
||||
firstBadgeHtml +
|
||||
'<span class="yaktube-badge" style="' +
|
||||
badgeStyle +
|
||||
' margin-bottom: 4px; display: inline-block; font-size:10px; padding:2px 8px; font-weight:700;">' +
|
||||
@@ -5746,11 +6007,15 @@ try {
|
||||
isLocal && item.localVideo && item.localVideo.url
|
||||
? '<a href="' +
|
||||
escapeHtml(item.localVideo.url) +
|
||||
'" class="yaktube-play-btn yaktube-related-play-link" style="font-size:11px; padding:6px 10px;" aria-label="' +
|
||||
'" class="yaktube-play-btn yaktube-related-play-link" style="font-size:11px; padding:6px 10px;' +
|
||||
(isFed ? ' background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); color:#fff;' : '') +
|
||||
'" aria-label="' +
|
||||
safeTitleAttr +
|
||||
' videosunu ' +
|
||||
escapeHtml(getInstanceName()) +
|
||||
'\'dan hemen izle">▶️ Hemen İzle</a>'
|
||||
(isFed ? 'Fediverse ağından' : escapeHtml(getInstanceName()) + "'dan") +
|
||||
' hemen izle">' +
|
||||
(isFed ? "🌐 Fediverse'den İzle" : '▶️ Hemen İzle') +
|
||||
'</a>'
|
||||
: '<button class="yaktube-import-btn yaktube-related-import" data-yt-id="' +
|
||||
escapeHtml(item.id || '') +
|
||||
'" data-url="' +
|
||||
@@ -5764,9 +6029,18 @@ try {
|
||||
'\'a indir ve izle">📥 İndir ve İzle</button>';
|
||||
|
||||
var cardLabel =
|
||||
item.title + ' (' + badgeLabel + '), ' + item.channel + ' kanalı, Süre: ' + (item.durationFormatted || '');
|
||||
(isFirstRec ? 'İlk Öneri: ' : '') +
|
||||
item.title +
|
||||
' (' +
|
||||
badgeLabel +
|
||||
'), ' +
|
||||
item.channel +
|
||||
' kanalı, Süre: ' +
|
||||
(item.durationFormatted || '');
|
||||
cardsHtml +=
|
||||
'<div class="yaktube-card" role="article" tabindex="0" style="margin-bottom:10px;" aria-label="' +
|
||||
'<div class="yaktube-card" role="article" tabindex="0" style="margin-bottom:10px;' +
|
||||
(isFirstRec ? ' border: 1.5px solid rgba(255,143,55,0.65);' : '') +
|
||||
'" aria-label="' +
|
||||
cardLabel.replace(/"/g, '"') +
|
||||
'">' +
|
||||
'<div class="yaktube-thumb-wrap">' +
|
||||
@@ -5813,6 +6087,18 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
var fediverseDrawerBtn = '';
|
||||
if (cachedFederatedRecommendationsMode === 'smart-relevant') {
|
||||
fediverseDrawerBtn =
|
||||
'<button id="yaktube-toggle-native-fediverse-btn" class="yaktube-shortcuts-btn" style="width:100%; margin-top:10px; padding:9px 12px; justify-content:center; font-size:12px; font-weight:600; background:rgba(14,165,233,0.1); border:1px solid rgba(14,165,233,0.35); color:#7dd3fc;" aria-expanded="' +
|
||||
(showNativeFediverseDrawer ? 'true' : 'false') +
|
||||
'" aria-label="Fediverse ağındaki diğer videoları göster veya gizle">' +
|
||||
(showNativeFediverseDrawer
|
||||
? '🔼 Fediverse Ağındaki Diğer Videoları Gizle'
|
||||
: '🌐 Fediverse Ağındaki Diğer Videoları Göster (İsteğe Bağlı)') +
|
||||
'</button>';
|
||||
}
|
||||
|
||||
var headerCountText = count > 12 && !relatedShowAll ? displayed.length + ' / ' + count : count;
|
||||
var prefetchStatusHtml = '';
|
||||
if (smartPrefetchState.videoKey === currentActiveVideoKey) {
|
||||
@@ -5825,6 +6111,11 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
var autoPlayEnabled = isYakTubeAutoplayEnabled();
|
||||
var autoPlayBtnStyle = autoPlayEnabled
|
||||
? 'background:rgba(16,185,129,0.18); border-color:#10b981; color:#6ee7b7; font-weight:700;'
|
||||
: 'background:rgba(148,163,184,0.12); border-color:rgba(148,163,184,0.35); color:#cbd5e1;';
|
||||
|
||||
container.innerHTML =
|
||||
'<div class="yaktube-header" style="flex-wrap:wrap; gap:8px;">' +
|
||||
'<div class="yaktube-header-left" style="flex-wrap:wrap; gap:8px;">' +
|
||||
@@ -5838,14 +6129,43 @@ try {
|
||||
')</h3>' +
|
||||
prefetchStatusHtml +
|
||||
'</div>' +
|
||||
'<div style="display:flex; align-items:center; gap:8px; flex-wrap:wrap;">' +
|
||||
'<button id="yaktube-related-play-first-btn" class="yaktube-shortcuts-btn" style="background:rgba(255,143,55,0.16); border-color:#ff8f37; color:#fff; font-weight:700;" aria-label="Sıradaki ilk önerilen videoyu oynat (Shift+N)" title="Sıradaki ilk önerilen videoyu oynat (Shift+N)">' +
|
||||
'⏭️ İlk Öneriyi Oynat' +
|
||||
'</button>' +
|
||||
'<button id="yaktube-related-autoplay-btn" class="yaktube-shortcuts-btn" role="switch" aria-checked="' +
|
||||
(autoPlayEnabled ? 'true' : 'false') +
|
||||
'" style="' +
|
||||
autoPlayBtnStyle +
|
||||
'" aria-label="Akıllı Otomatik Oynatma: ' +
|
||||
(autoPlayEnabled ? 'Açık' : 'Kapalı') +
|
||||
'" title="Video bittiğinde ilk öneriyi otomatik oynat">' +
|
||||
(autoPlayEnabled ? '🔁 Otomatik Oynat: Açık' : '🔁 Otomatik Oynat: Kapalı') +
|
||||
'</button>' +
|
||||
'<button id="yaktube-related-refresh-btn" class="yaktube-shortcuts-btn" aria-label="Önerileri Yenile">' +
|
||||
'🔄 Yenile' +
|
||||
'</button>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="yaktube-grid" style="grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap:12px;">' +
|
||||
cardsHtml +
|
||||
'</div>' +
|
||||
loadMoreBtn;
|
||||
loadMoreBtn +
|
||||
fediverseDrawerBtn;
|
||||
|
||||
var playFirstBtn = document.getElementById('yaktube-related-play-first-btn');
|
||||
if (playFirstBtn) {
|
||||
playFirstBtn.addEventListener('click', function () {
|
||||
playFirstSmartRecommendation('related-header-btn');
|
||||
});
|
||||
}
|
||||
|
||||
var autoPlayHeaderBtn = document.getElementById('yaktube-related-autoplay-btn');
|
||||
if (autoPlayHeaderBtn) {
|
||||
autoPlayHeaderBtn.addEventListener('click', function () {
|
||||
toggleYakTubeAutoplay();
|
||||
});
|
||||
}
|
||||
|
||||
var toggleBtn = document.getElementById('yaktube-related-toggle-more');
|
||||
if (toggleBtn) {
|
||||
@@ -5858,6 +6178,20 @@ try {
|
||||
});
|
||||
}
|
||||
|
||||
var fedDrawerBtn = document.getElementById('yaktube-toggle-native-fediverse-btn');
|
||||
if (fedDrawerBtn) {
|
||||
fedDrawerBtn.addEventListener('click', function () {
|
||||
showNativeFediverseDrawer = !showNativeFediverseDrawer;
|
||||
suppressUnrelatedNativeRecommendations();
|
||||
renderRelatedCards(container, cachedRelatedResults, cachedRelatedQuery);
|
||||
announce(
|
||||
showNativeFediverseDrawer
|
||||
? 'Fediverse ağındaki diğer videolar gösteriliyor.'
|
||||
: 'Fediverse ağındaki diğer videolar gizlendi.'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
var refreshBtn = document.getElementById('yaktube-related-refresh-btn');
|
||||
if (refreshBtn) {
|
||||
refreshBtn.addEventListener('click', function () {
|
||||
@@ -5994,16 +6328,29 @@ try {
|
||||
}
|
||||
|
||||
function checkSmartPrefetchOnTimeUpdate(video) {
|
||||
if (!video || !currentActiveVideoKey || !smartPrefetchCandidate) return;
|
||||
if (!video || !currentActiveVideoKey) return;
|
||||
if (smartPrefetchState.videoKey === currentActiveVideoKey && smartPrefetchState.status !== 'idle') return;
|
||||
if (cachedSmartPrefetchMode === 'disabled') return;
|
||||
if (cachedSmartPrefetchMode === 'auto-when-no-local' && smartHasLocalMatch) return;
|
||||
|
||||
var firstRec = getFirstSmartRecommendation();
|
||||
var firstNeedsPrefetch = Boolean(firstRec && !firstRec.isDownloaded && firstRec.url);
|
||||
var targetCandidate = firstNeedsPrefetch ? firstRec : smartPrefetchCandidate;
|
||||
if (!targetCandidate) return;
|
||||
|
||||
// If #1 recommendation is not downloaded yet and autoplay is enabled, always pre-fetch #1 so autoplay is instant!
|
||||
if (
|
||||
cachedSmartPrefetchMode === 'auto-when-no-local' &&
|
||||
smartHasLocalMatch &&
|
||||
!(firstNeedsPrefetch && isYakTubeAutoplayEnabled())
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
var cur = video.currentTime || 0;
|
||||
var dur = video.duration || 0;
|
||||
var threshold = dur > 0 && dur < 65 ? Math.max(8, dur * 0.35) : 25;
|
||||
var threshold = dur > 0 && dur < 65 ? Math.max(8, dur * 0.35) : 20;
|
||||
if (cur >= threshold) {
|
||||
triggerSilentBackgroundPrefetch(smartPrefetchCandidate, currentActiveVideoKey);
|
||||
triggerSilentBackgroundPrefetch(targetCandidate, currentActiveVideoKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6020,19 +6367,16 @@ try {
|
||||
clearUpNextOverlay();
|
||||
if (!cachedRelatedResults || cachedRelatedResults.length === 0) return;
|
||||
|
||||
// Pick #1 ready local match first; otherwise #1 topic match
|
||||
var nextItem =
|
||||
cachedRelatedResults.find(function (it) {
|
||||
return it && it.isDownloaded && it.localVideo && it.localVideo.url;
|
||||
}) || cachedRelatedResults[0];
|
||||
|
||||
// Always pick the very first recommendation (#1 in Smart Recommendations)
|
||||
var nextItem = getFirstSmartRecommendation();
|
||||
if (!nextItem) return;
|
||||
|
||||
var isReadyLocal = !!(nextItem.isDownloaded && nextItem.localVideo && nextItem.localVideo.url);
|
||||
var autoPlayOn = isYakTubeAutoplayEnabled();
|
||||
var banner = document.createElement('div');
|
||||
banner.id = 'yaktube-upnext-overlay';
|
||||
banner.setAttribute('role', 'region');
|
||||
banner.setAttribute('aria-label', 'Sıradaki İlgili Video Önerisi');
|
||||
banner.setAttribute('aria-label', 'Sıradaki İlk Önerilen Video');
|
||||
banner.style.cssText =
|
||||
'margin: 14px 0 18px 0; padding: 16px 20px; border-radius: 14px; background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); border: 2px solid #ff8f37; box-shadow: 0 10px 30px rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;';
|
||||
|
||||
@@ -6050,7 +6394,7 @@ try {
|
||||
'" alt="" style="width:96px; height:56px; object-fit:cover; border-radius:8px; flex-shrink:0; border:1px solid rgba(255,255,255,0.15);" onerror="this.src=\'/client/assets/images/default-thumbnail.jpg\'" />' +
|
||||
'<div style="min-width:0;">' +
|
||||
'<div style="display:flex; align-items:center; gap:8px; margin-bottom:4px; flex-wrap:wrap;">' +
|
||||
'<span style="background:#ff8f37; color:#000; font-size:11px; font-weight:800; padding:2px 8px; border-radius:6px;">⏭️ SIRADAKİ İLGİLİ VİDEO</span>' +
|
||||
'<span style="background:#ff8f37; color:#000; font-size:11px; font-weight:800; padding:2px 8px; border-radius:6px;">⏭️ SIRADAKİ İLK ÖNERİ</span>' +
|
||||
'<span style="font-size:11px; color:#5eead4; font-weight:600;">' +
|
||||
safeBadge +
|
||||
'</span>' +
|
||||
@@ -6060,11 +6404,13 @@ try {
|
||||
'</div>' +
|
||||
'<div style="font-size:12px; color:#94a3b8; margin-top:2px;">' +
|
||||
safeChannel +
|
||||
(isReadyLocal
|
||||
(autoPlayOn
|
||||
? ' • <span id="yaktube-upnext-countdown-txt" style="color:#ff8f37; font-weight:700;">' +
|
||||
secondsLeft +
|
||||
' saniye içinde başlıyor...</span>'
|
||||
: '') +
|
||||
' saniye içinde ' +
|
||||
(isReadyLocal ? 'başlıyor...' : 'otomatik aktarılıp başlıyor...') +
|
||||
'</span>'
|
||||
: ' • <span id="yaktube-upnext-countdown-txt" style="color:#94a3b8;">Otomatik oynatma kapalı</span>') +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
@@ -6075,7 +6421,7 @@ try {
|
||||
'" style="background:linear-gradient(135deg, #10b981 0%, #059669 100%); color:#fff; text-decoration:none; padding:10px 18px; border-radius:10px; font-weight:800; font-size:13px; display:inline-flex; align-items:center; gap:6px;">▶️ Hemen İzle</a>'
|
||||
: '<button type="button" id="yaktube-upnext-import-btn" style="background:linear-gradient(135deg, #ff8f37 0%, #ea580c 100%); color:#000; border:none; padding:10px 18px; border-radius:10px; font-weight:800; font-size:13px; cursor:pointer; display:inline-flex; align-items:center; gap:6px;">📥 İndir ve Hemen İzle</button>') +
|
||||
'<button type="button" id="yaktube-upnext-cancel-btn" style="background:#334155; color:#e2e8f0; border:1px solid rgba(255,255,255,0.15); padding:10px 14px; border-radius:10px; font-weight:600; font-size:12px; cursor:pointer;">' +
|
||||
(isReadyLocal ? '✕ Otomatik Geçişi Durdur' : '✕ Kapat') +
|
||||
(autoPlayOn ? '✕ Otomatik Geçişi Durdur' : '✕ Kapat') +
|
||||
'</button>' +
|
||||
'</div>';
|
||||
|
||||
@@ -6109,13 +6455,13 @@ try {
|
||||
if (importBtn) {
|
||||
importBtn.addEventListener('click', function () {
|
||||
clearUpNextOverlay();
|
||||
handleImport(nextItem.url, importBtn, nextItem.title);
|
||||
playFirstSmartRecommendation('upnext-banner-click');
|
||||
});
|
||||
}
|
||||
|
||||
if (isReadyLocal) {
|
||||
if (autoPlayOn) {
|
||||
announce(
|
||||
'Video sona erdi. Sıradaki ilgili video 6 saniye içinde başlayacak: ' +
|
||||
'Video sona erdi. Sıradaki ilk önerilen video 6 saniye içinde başlayacak: ' +
|
||||
nextItem.title +
|
||||
'. Durdurmak için Otomatik Geçişi Durdur düğmesine basabilirsiniz.'
|
||||
);
|
||||
@@ -6123,16 +6469,17 @@ try {
|
||||
secondsLeft--;
|
||||
var cdTxt = document.getElementById('yaktube-upnext-countdown-txt');
|
||||
if (cdTxt && secondsLeft > 0) {
|
||||
cdTxt.textContent = secondsLeft + ' saniye içinde başlıyor...';
|
||||
cdTxt.textContent =
|
||||
secondsLeft + ' saniye içinde ' + (isReadyLocal ? 'başlıyor...' : 'otomatik aktarılıp başlıyor...');
|
||||
}
|
||||
if (secondsLeft <= 0) {
|
||||
clearInterval(upNextCountdownTimer);
|
||||
upNextCountdownTimer = null;
|
||||
window.location.href = nextItem.localVideo.url;
|
||||
playFirstSmartRecommendation('autoplay-ended');
|
||||
}
|
||||
}, 1000);
|
||||
} else {
|
||||
announce('Video sona erdi. Sıradaki ilgili öneri: ' + nextItem.title);
|
||||
announce('Video sona erdi. Sıradaki ilk öneri: ' + nextItem.title);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6268,6 +6615,9 @@ try {
|
||||
if (data && typeof data.smartPrefetchMode === 'string') {
|
||||
cachedSmartPrefetchMode = data.smartPrefetchMode;
|
||||
}
|
||||
if (data && typeof data.federatedRecommendationsMode === 'string') {
|
||||
cachedFederatedRecommendationsMode = data.federatedRecommendationsMode;
|
||||
}
|
||||
smartHasLocalMatch = Boolean(data && data.hasLocalMatch);
|
||||
smartPrefetchCandidate = (data && data.topPrefetchCandidate) || null;
|
||||
if (smartPrefetchState.videoKey !== thisVideoKey) {
|
||||
@@ -6296,6 +6646,7 @@ try {
|
||||
cachedRelatedQuery = (data && data.query) || searchQuery;
|
||||
currentActiveVideoKey = thisVideoKey;
|
||||
relatedShowAll = false;
|
||||
showNativeFediverseDrawer = false;
|
||||
|
||||
renderRelatedCards(container, uniqueResults, cachedRelatedQuery);
|
||||
|
||||
@@ -6808,6 +7159,11 @@ try {
|
||||
videoState.pausedByUser = true;
|
||||
video.pause();
|
||||
});
|
||||
navigator.mediaSession.setActionHandler('nexttrack', function () {
|
||||
if (typeof window.__yaktube_play_next_smart__ === 'function') {
|
||||
window.__yaktube_play_next_smart__('media-session-next');
|
||||
}
|
||||
});
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
@@ -6973,6 +7329,61 @@ try {
|
||||
|
||||
// PeerTube Plugin Client Hook Registration
|
||||
export async function register({ registerHook, peertubeHelpers } = {}) {
|
||||
if (typeof registerHook === 'function') {
|
||||
try {
|
||||
registerHook({
|
||||
target: 'filter:internal.video-watch.player.load-options.result',
|
||||
handler: function (result) {
|
||||
if (!result || typeof result !== 'object') return result;
|
||||
var origNextVideo = result.nextVideo;
|
||||
result.nextVideo = function () {
|
||||
var orig = typeof origNextVideo === 'function' ? origNextVideo() : {};
|
||||
if (typeof window !== 'undefined' && typeof window.__yaktube_is_playlist_watch === 'function') {
|
||||
if (window.__yaktube_is_playlist_watch()) return orig;
|
||||
}
|
||||
var firstRec =
|
||||
typeof window !== 'undefined' && typeof window.__yaktube_get_first_smart_rec === 'function'
|
||||
? window.__yaktube_get_first_smart_rec()
|
||||
: null;
|
||||
return Object.assign({}, orig, {
|
||||
enabled: Boolean(firstRec) || Boolean(orig && orig.enabled),
|
||||
displayControlBarButton: true,
|
||||
getClipTitle: function () {
|
||||
var rec =
|
||||
typeof window !== 'undefined' && typeof window.__yaktube_get_first_smart_rec === 'function'
|
||||
? window.__yaktube_get_first_smart_rec()
|
||||
: null;
|
||||
if (rec && rec.title) return rec.title;
|
||||
return orig && typeof orig.getClipTitle === 'function' ? orig.getClipTitle() : 'Sonraki Önerilen Video';
|
||||
},
|
||||
handler: function () {
|
||||
if (typeof window !== 'undefined' && typeof window.__yaktube_play_next_smart__ === 'function') {
|
||||
window.__yaktube_play_next_smart__('peertube-player-hook');
|
||||
return;
|
||||
}
|
||||
if (orig && typeof orig.handler === 'function') orig.handler();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (result.upnext && typeof result.upnext === 'object') {
|
||||
var origUpnext = result.upnext;
|
||||
result.upnext = Object.assign({}, origUpnext, {
|
||||
isEnabled: function () {
|
||||
if (typeof window !== 'undefined' && typeof window.__yaktube_is_playlist_watch === 'function') {
|
||||
if (window.__yaktube_is_playlist_watch()) {
|
||||
return origUpnext && typeof origUpnext.isEnabled === 'function' ? origUpnext.isEnabled() : false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
});
|
||||
} catch (e) {}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -196,6 +196,7 @@ async function register({ registerHook, getRouter, registerSetting, settingsMana
|
||||
let maxDiskUsagePercent = 85;
|
||||
let yaknetSsoEnabled = true;
|
||||
let smartPrefetchMode = 'auto-when-no-local';
|
||||
let federatedRecommendationsMode = 'smart-relevant';
|
||||
let customChannelId = '';
|
||||
let customYtDlpPath = '';
|
||||
let safeSearchEnabled = true;
|
||||
@@ -279,6 +280,32 @@ async function register({ registerHook, getRouter, registerSetting, settingsMana
|
||||
default: 'auto-when-no-local'
|
||||
});
|
||||
|
||||
registerSetting({
|
||||
name: 'federated-recommendations-mode',
|
||||
label: 'Fediverse (Diğer PeerTube Sunucuları) Öneri Görünümü',
|
||||
type: 'select',
|
||||
options: [
|
||||
{
|
||||
label:
|
||||
'Akıllı Alaka Süzgeci (Önerilen — Konuyla ve geçmişle alakalı Fediverse videolarını 🌐 rozetiyle önerilere dahil et, diğerlerini açılır buton altında tut)',
|
||||
value: 'smart-relevant'
|
||||
},
|
||||
{
|
||||
label:
|
||||
'Tam Açık (Akıllı önerilerin altında PeerTube standart Fediverse öneri listesini de her zaman açık bırak)',
|
||||
value: 'show-all'
|
||||
},
|
||||
{
|
||||
label: 'Kapalı (Önerilerde yalnızca bu sunucudaki yerel videoları ve YouTube sonuçlarını göster)',
|
||||
value: 'disabled'
|
||||
}
|
||||
],
|
||||
description:
|
||||
'İzleme sayfasındaki önerilerde Fediverse (diğer PeerTube sunucularından gelen federe videolar) içeriklerinin nasıl sunulacağını belirler. Varsayılan "Akıllı Alaka Süzgeci" modu Fediverse videolarını engellemez; izlenen videoyla, dille veya kullanıcı geçmişiyle alakalı olan Fediverse videolarını "🌐 Fediverse\'de İzle" rozetiyle doğrudan önerilere dahil eder, alakasız/yabancı yayınları ise isteğe bağlı "🌐 Fediverse Ağındaki Diğer Videoları Göster" çekmecesi altında toplar.',
|
||||
private: false,
|
||||
default: 'smart-relevant'
|
||||
});
|
||||
|
||||
registerSetting({
|
||||
name: 'safe-search-enabled',
|
||||
label: 'Güvenli Okul & Aile Araması (SafeSearch)',
|
||||
@@ -637,6 +664,15 @@ async function register({ registerHook, getRouter, registerSetting, settingsMana
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
const fedVal = await settingsManager.getSetting('federated-recommendations-mode');
|
||||
if (fedVal && ['smart-relevant', 'show-all', 'disabled'].includes(String(fedVal).trim())) {
|
||||
federatedRecommendationsMode = String(fedVal).trim();
|
||||
} else {
|
||||
federatedRecommendationsMode = 'smart-relevant';
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
const safeVal = await settingsManager.getSetting('safe-search-enabled');
|
||||
if (safeVal !== undefined && safeVal !== null) {
|
||||
@@ -1079,6 +1115,7 @@ async function register({ registerHook, getRouter, registerSetting, settingsMana
|
||||
ok: true,
|
||||
yaknetSsoEnabled,
|
||||
smartPrefetchMode,
|
||||
federatedRecommendationsMode,
|
||||
guestImportLimit,
|
||||
maxDiskUsagePercent,
|
||||
safeSearchEnabled,
|
||||
@@ -1515,6 +1552,7 @@ async function register({ registerHook, getRouter, registerSetting, settingsMana
|
||||
durationFormatted: formatDurationLabel(lv.duration || 0),
|
||||
isLive: false,
|
||||
isDownloaded: true,
|
||||
isFederated: false,
|
||||
reasonBadge: reasonBadge ? `✅ ${reasonBadge.replace(/^[🔥🎯📂]\s*/, '')}` : "✅ YakTube'da İzle",
|
||||
relevanceScore: finalScore,
|
||||
url: lv.importUrl || `/videos/watch/${lv.uuid}`,
|
||||
@@ -1531,6 +1569,118 @@ async function register({ registerHook, getRouter, registerSetting, settingsMana
|
||||
if (logger) logger.warn('[YakTube SmartRec] Local DB query warning: ' + e.message);
|
||||
}
|
||||
|
||||
// 1.5. Score Relevant Fediverse (Remote PeerTube) Videos when federatedRecommendationsMode !== 'disabled'
|
||||
if (federatedRecommendationsMode !== 'disabled') {
|
||||
try {
|
||||
const searchPatterns = Array.from(
|
||||
new Set(
|
||||
[...(artistNorm && artistNorm.length >= 3 ? [artistNorm] : []), ...currentKeywords, ...historyKeywords]
|
||||
.filter(k => k && k.length >= 3)
|
||||
.slice(0, 8)
|
||||
.map(k => `%${k}%`)
|
||||
)
|
||||
);
|
||||
|
||||
if (searchPatterns.length > 0) {
|
||||
const fedRows = await dbQuery(
|
||||
`SELECT DISTINCT ON (v.id)
|
||||
v.id, v.uuid, v.name, v.category, v.language, v.duration, v.views, v."isLive", v.nsfw,
|
||||
t.filename AS "thumbFilename"
|
||||
FROM "video" v
|
||||
LEFT JOIN "thumbnail" t ON t."videoId" = v.id
|
||||
WHERE v.remote = true
|
||||
AND v.state = 1
|
||||
AND v.privacy = 1
|
||||
AND v.nsfw = false
|
||||
AND (v.name ILIKE ANY($1) OR v.language = 'tr')
|
||||
ORDER BY v.id DESC, t.type ASC
|
||||
LIMIT 80`,
|
||||
[searchPatterns]
|
||||
);
|
||||
|
||||
for (const fv of fedRows) {
|
||||
if (!fv || !fv.name) continue;
|
||||
if (resolvedUuid && fv.uuid === resolvedUuid) continue;
|
||||
if (safeSearchEnabled && (fv.nsfw || isContentBlocked(fv.name, blockedKeywordsList))) continue;
|
||||
|
||||
const normFv = normalizeTitleForMatch(fv.name);
|
||||
if (!normFv || normFv === normCurrentTitle) continue;
|
||||
|
||||
let fedScore = 0;
|
||||
let fedBadge = '';
|
||||
|
||||
if (artistNorm && artistNorm.length >= 3 && normFv.includes(artistNorm)) {
|
||||
fedScore += 65;
|
||||
fedBadge = '🌐 Fediverse • Aynı Sanatçı';
|
||||
}
|
||||
|
||||
const fvKeywords = extractRecommendationKeywords(fv.name);
|
||||
let kwOverlap = 0;
|
||||
for (const kw of currentKeywords) {
|
||||
if (fvKeywords.includes(kw) || (kw.length >= 4 && normFv.includes(kw))) {
|
||||
kwOverlap++;
|
||||
}
|
||||
}
|
||||
if (kwOverlap > 0) {
|
||||
fedScore += kwOverlap * 30;
|
||||
if (!fedBadge) fedBadge = '🌐 Fediverse • Benzer İçerik';
|
||||
}
|
||||
|
||||
let histOverlap = 0;
|
||||
for (const hkw of historyKeywords) {
|
||||
if (fvKeywords.includes(hkw) || (hkw.length >= 4 && normFv.includes(hkw))) {
|
||||
histOverlap++;
|
||||
}
|
||||
}
|
||||
if (histOverlap > 0) {
|
||||
fedScore += Math.min(48, histOverlap * 24);
|
||||
if (!fedBadge) fedBadge = '🌐 Fediverse • Geçmişinize Göre';
|
||||
}
|
||||
|
||||
if (
|
||||
currentCategory &&
|
||||
fv.category &&
|
||||
Number(fv.category) === currentCategory &&
|
||||
String(fv.language || '').toLowerCase() === 'tr'
|
||||
) {
|
||||
fedScore += 22;
|
||||
if (!fedBadge) fedBadge = '🌐 Fediverse • Aynı Kategori';
|
||||
}
|
||||
|
||||
// Require strong relevance (score >= 28) so random foreign webcams never slip in
|
||||
if (fedScore < 28) continue;
|
||||
|
||||
const thumbUrl = fv.thumbFilename
|
||||
? `/lazy-static/thumbnails/${fv.thumbFilename}`
|
||||
: '/client/assets/images/default-thumbnail.jpg';
|
||||
|
||||
scoredLocalItems.push({
|
||||
id: `fed-${fv.uuid}`,
|
||||
title: fv.name,
|
||||
channel: 'Fediverse Ağı',
|
||||
duration: fv.duration || 0,
|
||||
durationFormatted: fv.isLive ? 'CANLI' : formatDurationLabel(fv.duration || 0),
|
||||
isLive: Boolean(fv.isLive),
|
||||
isDownloaded: true,
|
||||
isFederated: true,
|
||||
reasonBadge: fedBadge || "🌐 Fediverse'de İzle",
|
||||
relevanceScore: fedScore + 20,
|
||||
url: `/videos/watch/${fv.uuid}`,
|
||||
thumbnail: thumbUrl,
|
||||
localVideo: {
|
||||
id: fv.id,
|
||||
uuid: fv.uuid,
|
||||
name: fv.name,
|
||||
url: `/videos/watch/${fv.uuid}`
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (logger) logger.warn('[YakTube SmartRec] Federated DB query warning: ' + e.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Query YouTube On-Demand for Current Video Topic + User History in Parallel
|
||||
let primaryYtResults = [];
|
||||
let historyYtResults = [];
|
||||
@@ -1655,6 +1805,7 @@ async function register({ registerHook, getRouter, registerSetting, settingsMana
|
||||
historyQuery: historyQuery || null,
|
||||
hasLocalMatch: hasDirectLocalMatch,
|
||||
smartPrefetchMode,
|
||||
federatedRecommendationsMode,
|
||||
topPrefetchCandidate: topPrefetchCandidate
|
||||
? {
|
||||
id: topPrefetchCandidate.id,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "peertube-plugin-yaktube-ondemand",
|
||||
"version": "1.7.7",
|
||||
"version": "1.7.9",
|
||||
"description": "Accessible On-Demand YouTube Import, Live Streams, Smart Recommendations, Sleep Timer, Touch Gestures, Voice Assistant & A11y Engine for PeerTube",
|
||||
"main": "main.js",
|
||||
"library": "./main.js",
|
||||
|
||||
Reference in New Issue
Block a user