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
perf(v1.1.1): replace polling intervals with debounced MutationObserver and accessible SSO live region
This commit is contained in:
@@ -8,6 +8,49 @@ async function register({ registerHook, peertubeHelpers }) {
|
||||
authBaseUrl: 'https://developer-console.yakhub.com.tr'
|
||||
};
|
||||
|
||||
function hasPendingReturnUrl() {
|
||||
try {
|
||||
return Boolean(
|
||||
localStorage.getItem('yaktube_return_url') ||
|
||||
sessionStorage.getItem('yaktube_return_url') ||
|
||||
sessionStorage.getItem('redirect-url-after-login')
|
||||
);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function announceSsoStatus(message) {
|
||||
try {
|
||||
var region = document.getElementById('yaknet-sso-live-region');
|
||||
if (!region && document.body) {
|
||||
region = document.createElement('div');
|
||||
region.id = 'yaknet-sso-live-region';
|
||||
region.setAttribute('role', 'status');
|
||||
region.setAttribute('aria-live', 'polite');
|
||||
region.setAttribute('aria-atomic', 'true');
|
||||
region.style.cssText =
|
||||
'position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;';
|
||||
document.body.appendChild(region);
|
||||
}
|
||||
if (region) {
|
||||
region.textContent = '';
|
||||
setTimeout(function () {
|
||||
region.textContent = message;
|
||||
}, 50);
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
var postLoginCheckTimer = null;
|
||||
|
||||
function stopPostLoginPolling() {
|
||||
if (postLoginCheckTimer) {
|
||||
clearInterval(postLoginCheckTimer);
|
||||
postLoginCheckTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
function saveReturnUrlBeforeLogin() {
|
||||
try {
|
||||
var currentPath = window.location.pathname + window.location.search + window.location.hash;
|
||||
@@ -22,6 +65,10 @@ async function register({ registerHook, peertubeHelpers }) {
|
||||
|
||||
function checkPendingPostLoginRedirect() {
|
||||
try {
|
||||
if (!hasPendingReturnUrl()) {
|
||||
stopPostLoginPolling();
|
||||
return;
|
||||
}
|
||||
if (window.location.pathname.includes('/login')) return;
|
||||
var token = localStorage.getItem('access_token');
|
||||
if (!token) return;
|
||||
@@ -29,13 +76,18 @@ async function register({ registerHook, peertubeHelpers }) {
|
||||
localStorage.getItem('yaktube_return_url') ||
|
||||
sessionStorage.getItem('yaktube_return_url') ||
|
||||
sessionStorage.getItem('redirect-url-after-login');
|
||||
if (!savedUrl) return;
|
||||
if (!savedUrl) {
|
||||
stopPostLoginPolling();
|
||||
return;
|
||||
}
|
||||
var savedTime = parseInt(localStorage.getItem('yaktube_return_url_time') || '0', 10);
|
||||
localStorage.removeItem('yaktube_return_url');
|
||||
localStorage.removeItem('yaktube_return_url_time');
|
||||
sessionStorage.removeItem('yaktube_return_url');
|
||||
sessionStorage.removeItem('redirect-url-after-login');
|
||||
stopPostLoginPolling();
|
||||
if (savedTime && Date.now() - savedTime > 15 * 60 * 1000) return;
|
||||
announceSsoStatus('YakNet hesabınızla oturum açıldı.');
|
||||
var currentFull = window.location.pathname + window.location.search + window.location.hash;
|
||||
if (
|
||||
typeof savedUrl === 'string' &&
|
||||
@@ -51,7 +103,9 @@ async function register({ registerHook, peertubeHelpers }) {
|
||||
|
||||
checkPendingPostLoginRedirect();
|
||||
window.addEventListener('popstate', checkPendingPostLoginRedirect);
|
||||
setInterval(checkPendingPostLoginRedirect, 800);
|
||||
if (hasPendingReturnUrl()) {
|
||||
postLoginCheckTimer = setInterval(checkPendingPostLoginRedirect, 800);
|
||||
}
|
||||
|
||||
// Left Menu Hook for "YakNet Hesabım" Link (Configurable from Settings)
|
||||
if (typeof registerHook === 'function') {
|
||||
@@ -135,7 +189,7 @@ async function register({ registerHook, peertubeHelpers }) {
|
||||
wrapper.className = 'yaknet-sso-login-wrapper';
|
||||
wrapper.innerHTML =
|
||||
'<a href="/plugins/auth-yaknet/router/auth" class="yaknet-sso-btn" role="button">' +
|
||||
'<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/></svg>' +
|
||||
'<svg aria-hidden="true" focusable="false" width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/></svg>' +
|
||||
'<span>YakNet ile Tek Tıkla Giriş Yap</span>' +
|
||||
'</a>' +
|
||||
'<div class="yaknet-divider"><span>veya yerel hesap şifresiyle</span></div>';
|
||||
@@ -160,7 +214,7 @@ async function register({ registerHook, peertubeHelpers }) {
|
||||
accountLink.target = '_blank';
|
||||
accountLink.rel = 'noopener noreferrer';
|
||||
accountLink.innerHTML =
|
||||
'<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:-2px;"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/></svg> ' +
|
||||
'<svg aria-hidden="true" focusable="false" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:-2px;"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/></svg> ' +
|
||||
'<span>YakNet Hesabımı Yönet ↗</span>';
|
||||
userMenu.appendChild(accountLink);
|
||||
}
|
||||
@@ -169,7 +223,20 @@ async function register({ registerHook, peertubeHelpers }) {
|
||||
} catch (uiErr) {}
|
||||
}
|
||||
|
||||
setInterval(injectYakNetUI, 1000);
|
||||
var uiInjectDebounce = null;
|
||||
function scheduleInjectYakNetUI() {
|
||||
if (uiInjectDebounce) return;
|
||||
uiInjectDebounce = setTimeout(function () {
|
||||
uiInjectDebounce = null;
|
||||
injectYakNetUI();
|
||||
}, 150);
|
||||
}
|
||||
|
||||
if (typeof MutationObserver === 'function' && document.body) {
|
||||
var yaknetDomObserver = new MutationObserver(scheduleInjectYakNetUI);
|
||||
yaknetDomObserver.observe(document.body, { childList: true, subtree: true });
|
||||
}
|
||||
setInterval(injectYakNetUI, 5000);
|
||||
document.addEventListener('DOMContentLoaded', injectYakNetUI);
|
||||
|
||||
// Fetch Plugin Configuration from Backend
|
||||
|
||||
Reference in New Issue
Block a user