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(auth): preserve and restore last visited page URL after YakNet SSO login (v1.0.12)
This commit is contained in:
@@ -1,5 +1,50 @@
|
|||||||
async function register({ registerHook, peertubeHelpers }) {
|
async function register({ registerHook, peertubeHelpers }) {
|
||||||
try {
|
try {
|
||||||
|
function saveReturnUrlBeforeLogin() {
|
||||||
|
try {
|
||||||
|
var currentPath = window.location.pathname + window.location.search + window.location.hash;
|
||||||
|
if (currentPath && !window.location.pathname.includes('/login')) {
|
||||||
|
localStorage.setItem('yaktube_return_url', currentPath);
|
||||||
|
localStorage.setItem('yaktube_return_url_time', String(Date.now()));
|
||||||
|
sessionStorage.setItem('yaktube_return_url', currentPath);
|
||||||
|
sessionStorage.setItem('redirect-url-after-login', currentPath);
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkPendingPostLoginRedirect() {
|
||||||
|
try {
|
||||||
|
if (window.location.pathname.includes('/login')) return;
|
||||||
|
var token = localStorage.getItem('access_token');
|
||||||
|
if (!token) return;
|
||||||
|
var savedUrl =
|
||||||
|
localStorage.getItem('yaktube_return_url') ||
|
||||||
|
sessionStorage.getItem('yaktube_return_url') ||
|
||||||
|
sessionStorage.getItem('redirect-url-after-login');
|
||||||
|
if (!savedUrl) 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');
|
||||||
|
if (savedTime && Date.now() - savedTime > 15 * 60 * 1000) return;
|
||||||
|
var currentFull = window.location.pathname + window.location.search + window.location.hash;
|
||||||
|
if (
|
||||||
|
typeof savedUrl === 'string' &&
|
||||||
|
savedUrl.startsWith('/') &&
|
||||||
|
!savedUrl.startsWith('//') &&
|
||||||
|
!savedUrl.startsWith('/login') &&
|
||||||
|
savedUrl !== currentFull
|
||||||
|
) {
|
||||||
|
window.location.replace(savedUrl);
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkPendingPostLoginRedirect();
|
||||||
|
window.addEventListener('popstate', checkPendingPostLoginRedirect);
|
||||||
|
setInterval(checkPendingPostLoginRedirect, 800);
|
||||||
|
|
||||||
fetch('/plugins/auth-yaknet/router/status')
|
fetch('/plugins/auth-yaknet/router/status')
|
||||||
.then(function (r) {
|
.then(function (r) {
|
||||||
return r.json();
|
return r.json();
|
||||||
@@ -36,6 +81,7 @@ async function register({ registerHook, peertubeHelpers }) {
|
|||||||
) {
|
) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
saveReturnUrlBeforeLogin();
|
||||||
window.location.href = '/plugins/auth-yaknet/router/auth';
|
window.location.href = '/plugins/auth-yaknet/router/auth';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "peertube-plugin-auth-yaknet",
|
"name": "peertube-plugin-auth-yaknet",
|
||||||
"version": "1.0.11",
|
"version": "1.0.12",
|
||||||
"description": "YakNet SSO & OAuth2 Single Sign-On Authentication Plugin for PeerTube",
|
"description": "YakNet SSO & OAuth2 Single Sign-On Authentication Plugin for PeerTube",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"library": "./main.js",
|
"library": "./main.js",
|
||||||
|
|||||||
Reference in New Issue
Block a user