App_Git pusher avec license

Pushed by: unknown_user
Timestamp: 2026-01-25T21:50:10.850484
masterdev
Splunk Git Pusher 3 months ago
parent 2f38991bc4
commit 6524e4f8c4

@ -13,12 +13,103 @@ function initializeLicense() {
if (storedLicense) {
// Valider la licence stockée
validateStoredLicense(storedLicense);
// Afficher les infos de licence
displayLicenseInfo(storedLicense);
} else {
// Afficher la page de licence
showLicenseModal();
}
}
function displayLicenseInfo(license) {
console.log("Displaying license info...");
// Chercher le container du badge
const container = document.getElementById('license-badge-container');
if (!container) {
console.error("license-badge-container not found");
return;
}
// Créer le badge
const badge = document.createElement('div');
badge.id = 'license-badge';
badge.style.cssText = `
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 12px 20px;
border-radius: 8px;
font-size: 12px;
font-weight: 600;
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
cursor: pointer;
transition: all 0.3s ease;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
text-align: center;
min-width: 200px;
`;
let badgeText = '✓ Licence Activée';
// Si c'est une licence d'essai
if (license.startsWith('TRIAL-')) {
const daysRemaining = getTrialDaysRemaining(license);
if (daysRemaining <= 0) {
badgeText = '⏱️ Essai expiré';
badge.style.background = 'linear-gradient(135deg, #f44336 0%, #da190b 100%)';
} else if (daysRemaining <= 2) {
badgeText = `⚠️ ${daysRemaining} jour${daysRemaining > 1 ? 's' : ''} restant${daysRemaining > 1 ? 's' : ''}`;
badge.style.background = 'linear-gradient(135deg, #ff9800 0%, #f57c00 100%)';
} else {
badgeText = `⏱️ Essai: ${daysRemaining} jours`;
}
}
badge.textContent = badgeText;
badge.onclick = function() {
alert('Licence: ' + license.substring(0, 50) + '...\n\nClique sur le logo pour gérer ta licence.');
};
container.appendChild(badge);
// Ajouter un hover effect
badge.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-3px)';
this.style.boxShadow = '0 6px 25px rgba(102, 126, 234, 0.5)';
});
badge.addEventListener('mouseleave', function() {
this.style.transform = 'translateY(0)';
this.style.boxShadow = '0 4px 15px rgba(102, 126, 234, 0.3)';
});
}
function getTrialDaysRemaining(trialLicense) {
// Extraire le timestamp du license (format: TRIAL-timestamp)
const parts = trialLicense.split('-');
if (parts.length !== 2) return 0;
const timestamp = parseInt(parts[1]);
if (isNaN(timestamp)) return 0;
// Créer la date de création
const createdDate = new Date(timestamp);
// Ajouter 7 jours
const expirationDate = new Date(createdDate.getTime() + (7 * 24 * 60 * 60 * 1000));
// Calculer les jours restants
const now = new Date();
const daysRemaining = Math.ceil((expirationDate - now) / (1000 * 60 * 60 * 24));
console.log("Trial created:", createdDate);
console.log("Trial expires:", expirationDate);
console.log("Days remaining:", daysRemaining);
return Math.max(0, daysRemaining);
}
function showLicenseModal() {
console.log("Showing license modal");
@ -161,6 +252,8 @@ function validateLicenseInput() {
setTimeout(() => {
closeLicenseModal();
// Afficher les infos de licence
displayLicenseInfo(licenseInput);
}, 1500);
} else {
showLicenseMessage('Format de licence invalide', 'error');
@ -168,7 +261,7 @@ function validateLicenseInput() {
}
function skipLicense() {
// Créer une licence d'essai valide 7 jours
// Créer une licence d'essai avec timestamp (format: TRIAL-timestamp)
const trialLicense = 'TRIAL-' + Date.now();
setCookie(LICENSE_STORAGE_KEY, trialLicense, 7);
@ -181,6 +274,8 @@ function skipLicense() {
setTimeout(() => {
closeLicenseModal();
// Afficher les infos de licence
displayLicenseInfo(trialLicense);
}, 1500);
}

@ -3,6 +3,15 @@
<label>🚀 Git Pusher - Deploy Applications</label>
<description>Modern interface to push Splunk applications to Git repository</description>
<!-- BADGE DE LICENCE -->
<row>
<panel>
<html>
<div id="license-badge-container" style="position: absolute; top: 20px; right: 20px; z-index: 1000;"></div>
</html>
</panel>
</row>
<search id="dsearch">
<query>| rest /services/apps/local | search disabled=0 | fields name, label, description | sort label</query>
<earliest>-4h@h</earliest>

@ -23,4 +23,4 @@ access = read : [ * ], write : [ * ]
export = none
owner = admin
version = 10.0.2
modtime = 1769372397.743890000
modtime = 1769373002.573917000

Loading…
Cancel
Save