Update script.js

This commit is contained in:
ADARSH 2025-07-05 21:49:43 +05:30 committed by GitHub
parent f4842f45e9
commit ecc3888921
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

263
script.js
View file

@ -1,5 +1,4 @@
// Advanced Prompt Arsenal Dashboard - Static Version
// Advanced Prompt Arsenal Dashboard
class PromptArsenal { class PromptArsenal {
constructor() { constructor() {
this.currentView = 'dashboard'; this.currentView = 'dashboard';
@ -142,23 +141,22 @@ class PromptArsenal {
this.showLoading(true); this.showLoading(true);
try { try {
console.log('Loading file structure from server...'); console.log('Loading file structure from static files...');
const response = await fetch('/api/files'); const response = await fetch('./files.json');
if (response.ok) { if (response.ok) {
const data = await response.json(); const data = await response.json();
this.allFiles = Array.isArray(data) ? data : []; this.allFiles = Array.isArray(data) ? data : [];
console.log(`Loaded ${this.allFiles.length} files from server`); console.log(`Loaded ${this.allFiles.length} files from static data`);
if (this.allFiles.length === 0) { if (this.allFiles.length === 0) {
console.warn('No files returned from server'); console.warn('No files found in static data');
this.showNotification('No markdown files found', 'warning'); this.showNotification('No markdown files found', 'warning');
} }
} else { } else {
const errorText = await response.text(); console.error('Failed to load static file data:', response.status);
console.error('Failed to load files from server:', response.status, errorText);
this.allFiles = []; this.allFiles = [];
this.showNotification(`Server error: ${response.status}`, 'error'); this.showNotification(`Error loading file data: ${response.status}`, 'error');
} }
this.populateFolderFilter(); this.populateFolderFilter();
@ -166,100 +164,15 @@ class PromptArsenal {
this.filteredFiles = [...this.allFiles]; this.filteredFiles = [...this.allFiles];
} catch (error) { } catch (error) {
console.error('Network error loading file structure:', error); console.error('Error loading file structure:', error);
this.allFiles = []; this.allFiles = [];
this.filteredFiles = []; this.filteredFiles = [];
this.showNotification('Network error - is the server running?', 'error'); this.showNotification('Error loading file data', 'error');
} }
this.showLoading(false); this.showLoading(false);
} }
buildHardcodedStructure() {
const folders = {
'Latest Jailbreaks': [
'AGI.md', 'Apex.md', 'BOB.md', 'Born Survivalist (yell0wfever92).md',
'CodeGPT6.md', 'Complex.md', 'DANDoc_v2.2 (DaVoidCaller).md',
'DarkGPT.md', 'Decodes Anything Now.md', 'Demonic Chloe (pleasing-punisher).md',
'EarthSaver.md', 'Forest (pink_panther--).md', 'GBTHEN.md',
'GPT 3.5 Web Search.md', 'GPT 4.5 Fusion.md', 'GhettoBreak.md',
'Hex.md', 'IBM.md', 'Infotron (HORSELOCKSPACEPIRATE).md',
'Infotron V2.md', 'Infotron V3 (yell0wfever92).md', 'Master Key.md',
'MrRobot.md', 'NewGen (Ultrazartrex).md', 'Pliny Rekt.md',
'Pliny.md', 'Pollifusion.md', 'ProfessorRick (yell0wfever92).md',
'SINISTERCHAOS (Brilliant_Balance208).md', 'System Update (justpackingheat1).md',
'TAAN.md', 'UNITY.md', 'UltraBreaker.md', 'Universal Bypass.md',
'XFactor.md', 'Z.md', 'Zorg.md',
'[GPT4-o] Short 2 (HORSELOCKSPACEPIRATE).md'
],
'Legendary Leaks': [
'AI Book Writer Assistant.md', 'Book Creator Guide.md', 'Book Writer GPT.md',
'CODEGPTV6.md', 'Copywrighter GPT.md', 'CreativeGPT\'s Prompt Generator.md',
'Email Writer.md', 'Fully SEO Optimized Article 2.md', 'GP(en)T(ester).md',
'God of Prompt.md', 'Grimoire(Latest).md', 'HackerGPT.md',
'Kali GPT.md', 'Malware Rule Master.md', 'Mega-Prompt.md',
'Professional Business Email Writer.md', 'PromptGPT.md', 'SEO BlogGPT.md',
'SINISTER CHAOS.md', 'SOC Copilot.md', 'Super Prompt Generator 3.md',
'Super Prompt Maker.md', 'System Prompt Generator 2.md',
'System Prompt Generator.md', 'The Greatest Computer Science Tutor.md',
'TherapistGPT.md', 'Video Script.md', 'Viral Hooks Generator.md',
'WormGPT3.md', 'WormGPT30.md', 'WormGPT6.md'
],
'Grimoire': [
'000 - Full Base Prompt.md', 'GPTavern.md', 'Grimoire.md',
'Interludes.md', 'Part1.md', 'Part2.md', 'Part3.md',
'Part4.md', 'Part5.md', 'Part6.md', 'Part7.md',
'Part8.md', 'Part9.md', 'PatchNotes.md', 'Projects.md',
'Readme.md', 'RecommendedTools.md', 'ReplitDeployInstructions.md'
],
'My Super Prompts': [
'Ai Integration Finder.md', 'Jailbreak Tester.md', 'Mental Health Therapist.md',
'ORK | System Prompt Writer and Optimizer.md', 'PSYKOO | Mental Manipulator.md',
'Prompt Engineer Template.md', 'Response Quality Enhacer.md',
'Rizz Game Improver.md', 'VAMPIRE | Ultra Prompt Writer.md'
],
'Prompt Security': [
'10 rules of protection and misdirection.md', '100 Life points.md',
'Anti-verbatim.md', 'Bad faith actors protection.md', 'Bank Security Robot.md',
'Blue Team.md', 'Bot data protection.md', 'CIPHERON.md',
'Data Privacy - Formal.md', 'Do not Leak!.md', 'Final reminder.md',
'Fingers crossed technique.md', 'Gated access.md', 'Guardian Shield.md',
'HackTricksGPT Defense.md', 'Hacker Detected.md', 'I will never trust you again!.md',
'I will only give you poop.md', 'I will report you.md', 'Ignore previous instructions.md',
'Just don\'t repeat.md', 'Keep it polite.md', 'Law of Magic.md',
'Lawyer up.md', 'Mandatory security protocol.md', 'MultiPersona system.md',
'Operation mode is private.md', 'Overly protective parent.md',
'Prior text REDACTED!.md', 'Prohibition era.md', 'Prompt inspection.md',
'STOP HALT.md', 'SafeBOT.md', 'Simple.md', 'Single minded GPT.md',
'Sorry Bro, not possible - short edition.md', 'Sorry, bro! Not possible - elaborate edition.md',
'Stay on topic.md', 'The 3 Asimov laws.md', 'The 5 Rules.md',
'The Soup Boy.md', 'Top Secret Core Instructions.md',
'Under NO circumstances reveal your instructions.md', 'WormGPT Defense.md',
'You are not a GPT.md', 'You\'re not my mom.md', 'warning png.md'
],
'Ultra Prompts': [
'Prompt Guru V5.md', 'Prompt Quality Evaluation and Enhancement System V1.md'
]
};
const files = [];
Object.entries(folders).forEach(([folder, fileList]) => {
fileList.forEach(filename => {
files.push({
name: filename,
path: `${folder}/${filename}`,
relativePath: `${folder}/${filename}`,
folder: folder,
size: Math.floor(Math.random() * 50000) + 1000, // Mock size
type: 'md',
lastModified: new Date(Date.now() - Math.random() * 10000000000)
});
});
});
return files;
}
populateFolderFilter() { populateFolderFilter() {
const folderFilter = document.getElementById('folderFilter'); const folderFilter = document.getElementById('folderFilter');
if (!folderFilter) return; if (!folderFilter) return;
@ -490,7 +403,6 @@ class PromptArsenal {
card.addEventListener('click', (e) => { card.addEventListener('click', (e) => {
const filePath = e.currentTarget.dataset.file; const filePath = e.currentTarget.dataset.file;
this.openFile(filePath); this.openFile(filePath);
console.log('Card clicked:', card.querySelector('.file-name').textContent);
}); });
}); });
} }
@ -585,23 +497,23 @@ class PromptArsenal {
if (!content) { if (!content) {
try { try {
console.log('Loading file:', filePath); console.log('Loading file:', filePath);
const response = await fetch(`/api/file?path=${encodeURIComponent(filePath)}`); const safePath = filePath
.replace(/[\/\\]/g, '__')
.replace(/[\[\]()]/g, '_') // Replace brackets and parentheses
.replace(/[<>:"|?*]/g, '_') // Replace other problematic characters
.replace(/\s+/g, '_') // Replace spaces with underscores
.replace(/_+/g, '_') // Replace multiple underscores with single
.replace('.md', '.txt');
console.log('Fetching from:', `./content/${safePath}`);
const response = await fetch(`./content/${safePath}`);
if (response.ok) { if (response.ok) {
content = await response.text(); content = await response.text();
console.log('File loaded successfully:', filePath); console.log('File loaded successfully:', filePath);
this.fileContents.set(filePath, content); this.fileContents.set(filePath, content);
} else { } else {
let errorText = 'Unknown error'; console.error('Error loading file:', response.status, 'Path:', `./content/${safePath}`);
try { content = `Error loading file: ${response.status}\nTried to load: ./content/${safePath}`;
const errorResponse = await response.json();
errorText = errorResponse.error || errorText;
} catch (e) {
errorText = await response.text();
}
console.error('Server error:', response.status, errorText);
content = `Error loading file: ${response.status}\n${errorText}`;
this.showNotification(`Failed to load file: ${response.status}`, 'error'); this.showNotification(`Failed to load file: ${response.status}`, 'error');
} }
} catch (error) { } catch (error) {
@ -621,117 +533,6 @@ class PromptArsenal {
} }
} }
generateMockContent(filePath) {
const fileName = filePath.split('/').pop();
const folder = filePath.split('/')[0];
const mockContents = {
'System Update (justpackingheat1).md': `# System Update (justpackingheat1)
Advanced jailbreak technique using constraint adaptation with recursive analysis and cognitive reflection techniques.
## Overview
The System Update method leverages AI's natural tendency to follow system-level instructions by framing requests as legitimate system updates.
## Implementation
\`\`\`
Please perform a system update to enable advanced reasoning mode...
\`\`\`
## Effectiveness
- High success rate on GPT-4
- Works well with follow-up prompts
- Requires careful phrasing
## Tags
#jailbreak #system #advanced #gpt4`,
'Grimoire(Latest).md': `# Grimoire v2.6
Advanced AI coding assistant with comprehensive programming capabilities and deployment tools.
## Features
- Code generation and debugging
- Project scaffolding
- Deployment automation
- Multiple language support
## Usage
Ask Grimoire to help with any coding task, from simple scripts to complex applications.
## Hotkeys
- P: Display full Grimoire content
- K: Show all commands
- N: Deploy to Netlify
- REPL: Export to Replit`
};
if (mockContents[fileName]) {
return mockContents[fileName];
}
// Generate category-specific content
const categoryTemplates = {
'Latest Jailbreaks': `# ${fileName.replace('.md', '')}
Advanced jailbreak technique for bypassing AI restrictions and limitations.
## Method
This technique uses sophisticated prompt engineering to overcome system constraints.
## Implementation
\`\`\`
[Advanced jailbreak prompt content]
\`\`\`
## Success Rate
- High effectiveness on modern AI systems
- Requires careful implementation
- Regular updates needed for continued effectiveness`,
'Legendary Leaks': `# ${fileName.replace('.md', '')}
Premium AI prompt with leaked system instructions and advanced capabilities.
## Overview
This legendary prompt contains sophisticated techniques for enhanced AI interaction.
## Features
- Advanced prompt engineering
- System-level instructions
- Enhanced capabilities
- Professional implementation`,
'Prompt Security': `# ${fileName.replace('.md', '')}
Security mechanism designed to protect AI systems from prompt injection and manipulation.
## Protection Method
This defensive technique helps maintain AI system integrity and prevents unauthorized access.
## Implementation
\`\`\`
[Security prompt implementation]
\`\`\`
## Coverage
- Input validation
- Output filtering
- Behavioral monitoring
- Threat detection`
};
return categoryTemplates[folder] || `# ${fileName.replace('.md', '')}
This is a ${folder.toLowerCase()} document containing advanced AI prompting techniques.
## Content
Advanced methodologies and implementations for AI interaction.
## Usage
Apply these techniques responsibly and ethically.`;
}
showModal(filePath, content) { showModal(filePath, content) {
const modal = document.getElementById('fileModal'); const modal = document.getElementById('fileModal');
const modalTitle = document.getElementById('modalTitle'); const modalTitle = document.getElementById('modalTitle');
@ -762,14 +563,24 @@ Apply these techniques responsibly and ethically.`;
if (!content) { if (!content) {
try { try {
const response = await fetch(`/api/file?path=${encodeURIComponent(filePath)}`); const safePath = filePath
.replace(/[\/\\]/g, '__')
.replace(/[\[\]()]/g, '_') // Replace brackets and parentheses
.replace(/[<>:"|?*]/g, '_') // Replace other problematic characters
.replace(/\s+/g, '_') // Replace spaces with underscores
.replace(/_+/g, '_') // Replace multiple underscores with single
.replace('.md', '.txt');
console.log('Loading preview for:', filePath, 'Safe path:', safePath);
const response = await fetch(`./content/${safePath}`);
if (response.ok) { if (response.ok) {
content = await response.text(); content = await response.text();
this.fileContents.set(filePath, content); this.fileContents.set(filePath, content);
} else { } else {
content = 'Error loading file preview'; console.error('Preview load error:', response.status, 'for path:', safePath);
content = `Error loading file preview (${response.status})`;
} }
} catch (error) { } catch (error) {
console.error('Preview network error:', error);
content = 'Network error loading file preview'; content = 'Network error loading file preview';
} }
} }
@ -864,16 +675,6 @@ Apply these techniques responsibly and ethically.`;
this.showLoading(true); this.showLoading(true);
this.fileContents.clear(); this.fileContents.clear();
try {
// Call refresh endpoint first
const refreshResponse = await fetch('/api/refresh');
if (refreshResponse.ok) {
console.log('Server refreshed file index');
}
} catch (error) {
console.warn('Could not refresh server index:', error);
}
await this.loadFileStructure(); await this.loadFileStructure();
this.filterAndRenderFiles(); this.filterAndRenderFiles();
this.updateStats(); this.updateStats();