-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
273 lines (234 loc) · 11.7 KB
/
Copy pathindex.php
File metadata and controls
273 lines (234 loc) · 11.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"> -->
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@tabler/core@1.4.0/dist/css/tabler.min.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css">
<script defer src="https://code.jquery.com/jquery-4.0.0.min.js"
integrity="sha256-OaVG6prZf4v69dPg6PhVattBXkcOWQB62pdZ3ORyrao=" crossorigin="anonymous"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script> -->
<script defer
src="https://cdn.jsdelivr.net/npm/@tabler/core@1.4.0/dist/js/tabler.min.js">
</script>
<!-- Marked / Highlight.js (e.g. markdown) are loaded on demand in js/rand.js -->
<!-- Axios for AJAX requests -->
<script defer src="js/axios.min.js"></script>
<link rel="stylesheet" href="style.css">
<!--In the <head>-->
<title>Rand</title>
<body class="theme-dark">
<script src="js/rand_ui_boot.js"></script>
<?php
require_once("includes/_includes.php");
require_once("includes/navbar.php");
?>
<br>
<div class="container pt-5">
<!-------------------------------------------------------------------------------->
<?php
include_once("modules/dashboard.php");
?>
<!-------------------------------------------------------------------------------->
</div>
</div> <!-- CONTAINER END -->
<div class="modal fade" tabindex="-1" id="aboutModal" aria-labelledby="aboutModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable" role="document">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title h4 mb-0" id="aboutModalLabel"><?= icon("info-circle") ?> About php-rand</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body p-0">
<ul class="nav nav-tabs px-3 pt-2" id="aboutModalTabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="aboutTabBtn" data-bs-toggle="tab" data-bs-target="#aboutTabPane" type="button" role="tab" aria-controls="aboutTabPane" aria-selected="true">About</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="changelogTabBtn" data-bs-toggle="tab" data-bs-target="#changelogTabPane" type="button" role="tab" aria-controls="changelogTabPane" aria-selected="false">Changelog</button>
</li>
</ul>
<div class="tab-content p-3 about-modal-tab-content" id="aboutModalTabContent">
<div class="tab-pane fade show active" id="aboutTabPane" role="tabpanel" aria-labelledby="aboutTabBtn" tabindex="0">
<div id="aboutInfoPanel">
<div class="tool-loading">
<div class="spinner-border text-primary tool-loading-spinner" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<p class="tool-loading-text">Loading environment details...</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="changelogTabPane" role="tabpanel" aria-labelledby="changelogTabBtn" tabindex="0">
<div id="changelogMarkdown">
<div class="tool-loading">
<div class="spinner-border text-primary tool-loading-spinner" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<p class="tool-loading-text">Loading changelog...</p>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" tabindex="-1" id="privacyModal" aria-labelledby="privacyModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-scrollable" role="document">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title h4 mb-0" id="privacyModalLabel"><?= icon("shield-lock") ?> Privacy & Data Flow</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p class="mb-3">
Inputs are submitted to the server for processing in most tools, but this app does not persist submitted input data in its own database, files, or sessions.
</p>
<h4 class="h6">Processed on server (submitted to <code>gen.php</code>)</h4>
<p class="text-muted small mb-3">
Most tools (generators, crypto, encoding, text & data, math, and misc tools) send input to the server and return results immediately.
</p>
<h4 class="h6">Client-side only</h4>
<ul class="mb-3">
<li><code>dashboard</code> (display only)</li>
<li><code>markdown</code> (rendered in browser with JS)</li>
<li><code>gen_image</code> (opens external image generator page)</li>
</ul>
<h4 class="h6">Important note</h4>
<p class="mb-0">
Server/proxy logs may still retain request metadata depending on infrastructure configuration. This modal describes app-level behavior.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div id="error"></div>
<footer>Made with ❤️ by <a href="https://github.com/Darknetzz" target="_blank" style="color:grey;">Darknetzz</a>
</footer>
</body>
<script defer src="js/rand.js"></script>
<script>
const COPY_UNAVAILABLE_TITLE =
"Copy to clipboard is not available in this browser or page context. Use HTTPS (or localhost), or select the text and copy manually.";
function canUseClipboardCopy() {
if (window._copyUiForceUnavailable) {
return false;
}
const hasModernClipboard = !!(navigator.clipboard && navigator.clipboard.writeText);
const hasExecCommand = typeof document.queryCommandSupported === "function"
? document.queryCommandSupported("copy")
: typeof document.execCommand === "function";
return hasModernClipboard || hasExecCommand;
}
function findCopyButtons(root) {
return root.querySelectorAll(
'button[onclick*="copyToClipboard"], button.copyOutput, button.copyText'
);
}
function setCopyButtonEnabled(btn, enabled) {
const wrapClass = "copy-btn-tooltip-wrap";
let wrap = btn.closest("." + wrapClass);
if (enabled) {
btn.disabled = false;
btn.removeAttribute("aria-disabled");
btn.classList.remove("btn-copy-unavailable");
if (wrap && wrap.parentNode) {
wrap.parentNode.insertBefore(btn, wrap);
wrap.remove();
}
return;
}
if (!wrap) {
wrap = document.createElement("span");
wrap.className = wrapClass;
btn.parentNode.insertBefore(wrap, btn);
wrap.appendChild(btn);
}
wrap.title = COPY_UNAVAILABLE_TITLE;
btn.disabled = true;
btn.setAttribute("aria-disabled", "true");
btn.classList.add("btn-copy-unavailable");
}
function refreshCopyUiAvailability(scope) {
const root = scope || document;
const canCopy = canUseClipboardCopy();
findCopyButtons(root).forEach((btn) => setCopyButtonEnabled(btn, canCopy));
}
/** Dev/test: pass true to simulate unavailable clipboard, false to restore detection. */
function setCopyUiTestMode(unavailable) {
window._copyUiForceUnavailable = !!unavailable;
refreshCopyUiAvailability(document);
}
window.canUseClipboardCopy = canUseClipboardCopy;
window.refreshCopyUiAvailability = refreshCopyUiAvailability;
window.setCopyUiTestMode = setCopyUiTestMode;
// Copy to clipboard function with fallback and explicit button target
function copyToClipboard(elementId, btnEl) {
if (!canUseClipboardCopy()) {
return;
}
const element = document.getElementById(elementId);
if (!element) return;
const text = (element.textContent || "").trim();
const btn = btnEl || (document.activeElement?.closest && document.activeElement.closest('button')) || null;
const setFeedback = (ok) => {
if (!btn) return;
const originalText = btn.getAttribute('data-original-text') || btn.innerHTML;
btn.setAttribute('data-original-text', originalText);
if (ok) {
btn.innerHTML = '<i class="bi bi-check"></i> Copied!';
btn.classList.add('btn-success');
btn.classList.remove('btn-outline-light');
} else {
btn.innerHTML = '<i class="bi bi-exclamation-triangle"></i> Failed';
btn.classList.add('btn-danger');
btn.classList.remove('btn-outline-light');
}
setTimeout(() => {
btn.innerHTML = originalText;
btn.classList.remove('btn-success', 'btn-danger');
btn.classList.add('btn-outline-light');
}, 1600);
};
// Modern API path
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(text).then(() => setFeedback(true)).catch(() => {
// Fallback if HTTPS or permissions blocked
fallbackCopy(text, setFeedback);
});
return;
}
// Fallback for older browsers or non-secure origins
fallbackCopy(text, setFeedback);
}
function fallbackCopy(text, setFeedback) {
const ta = document.createElement('textarea');
ta.value = text;
ta.style.position = 'fixed';
ta.style.top = '-1000px';
ta.style.left = '-1000px';
document.body.appendChild(ta);
ta.select();
try {
const ok = document.execCommand('copy');
setFeedback(ok);
} catch (e) {
setFeedback(false);
}
document.body.removeChild(ta);
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", () => refreshCopyUiAvailability(document));
} else {
refreshCopyUiAvailability(document);
}
</script>
</html>