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
feat(search): implement YakNet cloud search history sync with auth.yakhub.com.tr (v1.4.22)
This commit is contained in:
@@ -1926,7 +1926,27 @@ try {
|
|||||||
var activeVoiceRec = null;
|
var activeVoiceRec = null;
|
||||||
var isVoiceListening = false;
|
var isVoiceListening = false;
|
||||||
|
|
||||||
// Dynamic Search History & Trending Helpers
|
// Dynamic Search History & Trending Helpers with YakNet Cloud Sync
|
||||||
|
function isUserLoggedIn() {
|
||||||
|
try {
|
||||||
|
var token = localStorage.getItem('access_token');
|
||||||
|
var username = localStorage.getItem('username');
|
||||||
|
return Boolean(token || username);
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isAccountSyncEnabled() {
|
||||||
|
try {
|
||||||
|
var userPref = localStorage.getItem('yaktube_sync_search_history');
|
||||||
|
if (userPref === 'false') return false;
|
||||||
|
return isUserLoggedIn();
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getRecentSearches() {
|
function getRecentSearches() {
|
||||||
try {
|
try {
|
||||||
var data = localStorage.getItem('yaktube_recent_searches');
|
var data = localStorage.getItem('yaktube_recent_searches');
|
||||||
@@ -1943,6 +1963,33 @@ try {
|
|||||||
return defaults;
|
return defaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isSyncingHistory = false;
|
||||||
|
function syncCloudSearchHistory(callback) {
|
||||||
|
if (!isAccountSyncEnabled() || isSyncingHistory) return;
|
||||||
|
isSyncingHistory = true;
|
||||||
|
|
||||||
|
var token = localStorage.getItem('access_token');
|
||||||
|
var headers = {};
|
||||||
|
if (token) headers['Authorization'] = 'Bearer ' + token;
|
||||||
|
|
||||||
|
fetch('/api-custom/search-history', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: headers,
|
||||||
|
credentials: 'include'
|
||||||
|
})
|
||||||
|
.then(function (res) { return res.json(); })
|
||||||
|
.then(function (data) {
|
||||||
|
isSyncingHistory = false;
|
||||||
|
if (data && data.status === 'success' && Array.isArray(data.history) && data.history.length > 0) {
|
||||||
|
localStorage.setItem('yaktube_recent_searches', JSON.stringify(data.history));
|
||||||
|
if (typeof callback === 'function') callback();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function () {
|
||||||
|
isSyncingHistory = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function saveRecentSearch(query) {
|
function saveRecentSearch(query) {
|
||||||
if (!query || query.trim().length < 2) return;
|
if (!query || query.trim().length < 2) return;
|
||||||
var q = query.trim();
|
var q = query.trim();
|
||||||
@@ -1952,15 +1999,42 @@ try {
|
|||||||
return item.toLowerCase() !== q.toLowerCase();
|
return item.toLowerCase() !== q.toLowerCase();
|
||||||
});
|
});
|
||||||
list.unshift(q);
|
list.unshift(q);
|
||||||
if (list.length > 8) list = list.slice(0, 8);
|
if (list.length > 12) list = list.slice(0, 12);
|
||||||
localStorage.setItem('yaktube_recent_searches', JSON.stringify(list));
|
localStorage.setItem('yaktube_recent_searches', JSON.stringify(list));
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
// If user is logged in and sync is active, sync with YakNet account
|
||||||
|
if (isAccountSyncEnabled()) {
|
||||||
|
var token = localStorage.getItem('access_token');
|
||||||
|
var headers = { 'Content-Type': 'application/json' };
|
||||||
|
if (token) headers['Authorization'] = 'Bearer ' + token;
|
||||||
|
|
||||||
|
fetch('/api-custom/search-history', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: headers,
|
||||||
|
credentials: 'include',
|
||||||
|
body: JSON.stringify({ query: q })
|
||||||
|
}).catch(function () {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearRecentSearches() {
|
function clearRecentSearches() {
|
||||||
try {
|
try {
|
||||||
localStorage.removeItem('yaktube_recent_searches');
|
localStorage.removeItem('yaktube_recent_searches');
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
if (isAccountSyncEnabled()) {
|
||||||
|
var token = localStorage.getItem('access_token');
|
||||||
|
var headers = { 'Content-Type': 'application/json' };
|
||||||
|
if (token) headers['Authorization'] = 'Bearer ' + token;
|
||||||
|
|
||||||
|
fetch('/api-custom/search-history', {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: headers,
|
||||||
|
credentials: 'include'
|
||||||
|
}).catch(function () {});
|
||||||
|
}
|
||||||
|
|
||||||
renderDynamicSearchChips();
|
renderDynamicSearchChips();
|
||||||
announce('Arama geçmişi temizlendi.');
|
announce('Arama geçmişi temizlendi.');
|
||||||
}
|
}
|
||||||
@@ -1998,17 +2072,49 @@ try {
|
|||||||
if (!container) return;
|
if (!container) return;
|
||||||
|
|
||||||
var recent = getRecentSearches();
|
var recent = getRecentSearches();
|
||||||
|
var loggedIn = isUserLoggedIn();
|
||||||
|
var syncEnabled = isAccountSyncEnabled();
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
// 1. Recent searches section (if any)
|
// 1. Recent searches section
|
||||||
|
html +=
|
||||||
|
'<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 8px;">' +
|
||||||
|
'<div class="yaktube-modal-section-title" style="margin-bottom: 0;">🕒 Son Aramalarınız</div>' +
|
||||||
|
'<div style="display: flex; align-items: center; gap: 8px;">';
|
||||||
|
|
||||||
|
if (loggedIn) {
|
||||||
|
var syncTitle = syncEnabled
|
||||||
|
? 'YakNet Bulut Eşitlemesi Aktif (Tüm cihazlarınızda senkronize edilir. Kapatmak için tıklayın.)'
|
||||||
|
: 'Eşitleme Kapalı (Aramalar sadece bu cihazda saklanır. Açmak için tıklayın.)';
|
||||||
|
var syncText = syncEnabled ? '☁️ Eşitleme: Açık' : '☁️ Eşitleme: Kapalı';
|
||||||
|
var syncBg = syncEnabled ? '#0f766e' : '#334155';
|
||||||
|
var syncColor = syncEnabled ? '#5eead4' : '#94a3b8';
|
||||||
|
html +=
|
||||||
|
'<button id="yaktube-sync-toggle-btn" style="background: ' +
|
||||||
|
syncBg +
|
||||||
|
'; border: 1px solid rgba(255,255,255,0.15); border-radius: 6px; padding: 2px 8px; color: ' +
|
||||||
|
syncColor +
|
||||||
|
'; font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.2s ease;" title="' +
|
||||||
|
syncTitle +
|
||||||
|
'" aria-label="' +
|
||||||
|
syncTitle +
|
||||||
|
'">' +
|
||||||
|
syncText +
|
||||||
|
'</button>';
|
||||||
|
} else {
|
||||||
|
html +=
|
||||||
|
'<span style="font-size: 11px; color: #94a3b8; background: #1e293b; border-radius: 6px; padding: 2px 8px;" title="Misafir modundasınız, aramalar sadece bu cihazda saklanır">🔒 Bu Cihazda</span>';
|
||||||
|
}
|
||||||
|
|
||||||
if (recent.length > 0) {
|
if (recent.length > 0) {
|
||||||
html +=
|
html +=
|
||||||
'<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">' +
|
'<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 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;">';
|
|
||||||
|
|
||||||
|
html += '</div></div>';
|
||||||
|
|
||||||
|
if (recent.length > 0) {
|
||||||
|
html += '<div class="yaktube-modal-chips-grid" style="margin-bottom: 18px;">';
|
||||||
recent.forEach(function (term) {
|
recent.forEach(function (term) {
|
||||||
var safeTerm = term.replace(/"/g, '"');
|
var safeTerm = term.replace(/"/g, '"');
|
||||||
html +=
|
html +=
|
||||||
@@ -2063,6 +2169,24 @@ try {
|
|||||||
clearRecentSearches();
|
clearRecentSearches();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var syncToggleBtn = container.querySelector('#yaktube-sync-toggle-btn');
|
||||||
|
if (syncToggleBtn) {
|
||||||
|
syncToggleBtn.addEventListener('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
var current = localStorage.getItem('yaktube_sync_search_history') !== 'false';
|
||||||
|
var next = !current;
|
||||||
|
localStorage.setItem('yaktube_sync_search_history', next ? 'true' : 'false');
|
||||||
|
if (next) {
|
||||||
|
announce('YakNet arama geçmişi eşitlemesi açıldı.');
|
||||||
|
syncCloudSearchHistory(renderDynamicSearchChips);
|
||||||
|
} else {
|
||||||
|
announce('Arama geçmişi eşitlemesi kapatıldı. Aramalar sadece bu cihazda saklanacak.');
|
||||||
|
}
|
||||||
|
renderDynamicSearchChips();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFullSearchModal() {
|
function createFullSearchModal() {
|
||||||
@@ -2191,6 +2315,7 @@ try {
|
|||||||
modal.classList.add('yaktube-modal-open');
|
modal.classList.add('yaktube-modal-open');
|
||||||
modal.style.display = 'flex';
|
modal.style.display = 'flex';
|
||||||
renderDynamicSearchChips();
|
renderDynamicSearchChips();
|
||||||
|
syncCloudSearchHistory(renderDynamicSearchChips);
|
||||||
|
|
||||||
var inp = modal.querySelector('#yaktube-modal-input');
|
var inp = modal.querySelector('#yaktube-modal-input');
|
||||||
var clearBtn = modal.querySelector('#yaktube-modal-clear-btn');
|
var clearBtn = modal.querySelector('#yaktube-modal-clear-btn');
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "peertube-plugin-yaktube-ondemand",
|
"name": "peertube-plugin-yaktube-ondemand",
|
||||||
"version": "1.4.21",
|
"version": "1.4.22",
|
||||||
"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