Compare commits

...

1 Commits
0.6.0 ... main

Author SHA1 Message Date
3d5675c7a1 correction et amélioration de la page diagnostic 2025-03-22 14:33:25 +01:00
3 changed files with 128 additions and 49 deletions

@ -173,10 +173,26 @@ $process_status = test_url($process_url);
if (isset($_SESSION['misskey_token'])) {
$token = $_SESSION['misskey_token'];
$masked_token = substr($token, 0, 4) . '...' . substr($token, -4);
echo '<code>' . htmlspecialchars($masked_token) . '</code>';
echo '<code>' . htmlspecialchars($masked_token) . '</code> (principal)';
} else {
echo '<span class="text-muted">Non défini</span>';
}
// Ajouter les tokens supplémentaires du mode filou
if (isset($_SESSION['additional_tokens']) && !empty($_SESSION['additional_tokens'])) {
echo '<br><strong>Tokens supplémentaires (mode filou):</strong><ul>';
foreach ($_SESSION['additional_tokens'] as $token_id => $token_data) {
$token = $token_data['token'];
$name = isset($token_data['name']) ? $token_data['name'] : 'Token sans nom';
$masked_token = substr($token, 0, 4) . '...' . substr($token, -4);
echo '<li><strong>' . htmlspecialchars($name) . ':</strong> <code>' .
htmlspecialchars($masked_token) . '</code></li>';
}
echo '</ul>';
}
?>
</dd>
@ -278,52 +294,6 @@ $process_status = test_url($process_url);
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
// Afficher les informations de localStorage
document.addEventListener('DOMContentLoaded', function() {
const localStorageInfo = document.getElementById('local-storage-info');
const clearLocalStorageBtn = document.getElementById('clear-localstorage');
function updateLocalStorageInfo() {
let html = '<ul class="list-unstyled mb-0">';
if (localStorage.getItem('favmastokey_favorites')) {
const favorites = JSON.parse(localStorage.getItem('favmastokey_favorites'));
html += '<li><strong>Favoris stockés:</strong> ' + favorites.length + ' URLs</li>';
} else {
html += '<li><strong>Favoris stockés:</strong> <span class="text-muted">Aucun</span></li>';
}
if (localStorage.getItem('favmastokey_migration')) {
const migration = JSON.parse(localStorage.getItem('favmastokey_migration'));
html += '<li><strong>État de la migration:</strong> ' + migration.status + '</li>';
html += '<li><strong>Progression:</strong> ' + migration.progress.current + '/' + migration.progress.total + ' (' + migration.progress.percentage.toFixed(1) + '%)</li>';
if (migration.lastUpdateTime) {
const date = new Date(migration.lastUpdateTime);
html += '<li><strong>Dernière mise à jour:</strong> ' + date.toLocaleString() + '</li>';
}
} else {
html += '<li><strong>État de la migration:</strong> <span class="text-muted">Aucune migration en cours</span></li>';
}
html += '</ul>';
localStorageInfo.innerHTML = html;
}
// Mettre à jour au chargement
updateLocalStorageInfo();
// Gérer le bouton d'effacement
clearLocalStorageBtn.addEventListener('click', function() {
if (confirm('Êtes-vous sûr de vouloir effacer toutes les données de migration stockées localement ?')) {
localStorage.removeItem('favmastokey_favorites');
localStorage.removeItem('favmastokey_migration');
updateLocalStorageInfo();
alert('Données localStorage effacées avec succès.');
}
});
});
</script>
<script src="js/diagnostic.js"></script>
</body>
</html>

@ -29,7 +29,7 @@ $config = [
// Informations de l'application
'app_name' => 'FavMasToKey',
'app_description' => 'Outil de transfert des favoris de Mastodon vers Misskey',
'app_version' => '0.6.0', // Mise à jour de la version pour les améliorations
'app_version' => '0.6.1', // Mise à jour de la version pour les améliorations
// URL de base - Utilisée pour les liens dans l'application
'app_url' => 'https://concepts.esenjin.xyz/favmastokey', // Remplacez par l'URL exacte de votre application

109
js/diagnostic.js Normal file

@ -0,0 +1,109 @@
// Gestion du localStorage pour la page de diagnostic
function initLocalStorageDiagnostic() {
const localStorageInfo = document.getElementById('local-storage-info');
const clearLocalStorageBtn = document.getElementById('clear-localstorage');
function updateLocalStorageInfo() {
let html = '<ul class="list-unstyled mb-0">';
// Vérifier les favoris
try {
const favoritesData = localStorage.getItem('favmastokey_favorites');
if (favoritesData) {
const favorites = JSON.parse(favoritesData);
html += '<li><strong>Favoris stockés:</strong> ' + (Array.isArray(favorites) ? favorites.length : '?') + ' URLs</li>';
} else {
html += '<li><strong>Favoris stockés:</strong> <span class="text-muted">Aucun</span></li>';
}
} catch (e) {
html += '<li><strong>Favoris stockés:</strong> <span class="text-danger">Erreur</span></li>';
}
// Vérifier la migration
try {
const migrationData = localStorage.getItem('favmastokey_migration');
if (migrationData) {
const migration = JSON.parse(migrationData);
html += '<li><strong>État de la migration:</strong> ' + (migration.status || 'Non défini') + '</li>';
if (migration.progress) {
html += '<li><strong>Progression:</strong> ' +
migration.progress.current + '/' +
migration.progress.total + ' (' +
(migration.progress.percentage || 0).toFixed(1) + '%)</li>';
}
if (migration.lastUpdateTime) {
const date = new Date(migration.lastUpdateTime);
html += '<li><strong>Dernière mise à jour:</strong> ' + date.toLocaleString() + '</li>';
}
} else {
html += '<li><strong>État de la migration:</strong> <span class="text-muted">Aucune migration en cours</span></li>';
}
} catch (e) {
html += '<li><strong>État de la migration:</strong> <span class="text-danger">Erreur</span></li>';
}
// Autres données
const additionalKeys = [
{key: 'favmastokey_federated_cache', label: 'Cache fédéré'},
{key: 'favmastokey_ratelimit_queue', label: 'File d\'attente rate-limit'},
{key: 'favmastokey_api_performance', label: 'Statistiques API'},
{key: 'favmastokey_multitoken_migration', label: 'Migration mode filou'}
];
for (const item of additionalKeys) {
try {
const dataStr = localStorage.getItem(item.key);
if (dataStr) {
const data = JSON.parse(dataStr);
const size = typeof data === 'object' ?
(Array.isArray(data) ? data.length : Object.keys(data).length) : 1;
html += `<li><strong>${item.label}:</strong> ${size} entrées</li>`;
}
} catch (e) {
// Ignorer les erreurs
}
}
html += '</ul>';
localStorageInfo.innerHTML = html;
}
// Mettre à jour au chargement
updateLocalStorageInfo();
// Gérer le bouton d'effacement
if (clearLocalStorageBtn) {
clearLocalStorageBtn.addEventListener('click', function() {
if (confirm('Êtes-vous sûr de vouloir effacer toutes les données de migration stockées localement ?')) {
// Liste des clés connues
const keysToRemove = [
'favmastokey_favorites',
'favmastokey_migration',
'favmastokey_federated_cache',
'favmastokey_ratelimit_queue',
'favmastokey_api_performance',
'favmastokey_multitoken_migration'
];
// Supprimer toutes les clés connues
keysToRemove.forEach(key => localStorage.removeItem(key));
// Rechercher d'autres clés potentielles
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
if (key && key.startsWith('favmastokey_')) {
localStorage.removeItem(key);
}
}
updateLocalStorageInfo();
alert('Données localStorage effacées avec succès.');
}
});
}
}
// Exécuter après chargement du DOM
document.addEventListener('DOMContentLoaded', initLocalStorageDiagnostic);