Spaces:
Running
Running
AdsurKasur commited on
Commit ·
93d731d
1
Parent(s): 54bb0b3
Enhance Dockerfile by adding system dependencies for cairo and build tools; update app.js to improve clipboard copy functionality with error handling and visual feedback.
Browse files- Dockerfile +9 -0
- static/js/app.js +7 -4
Dockerfile
CHANGED
|
@@ -3,6 +3,15 @@ FROM python:3.9-slim
|
|
| 3 |
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
# Copy requirements first for better caching
|
| 7 |
COPY requirements.txt .
|
| 8 |
|
|
|
|
| 3 |
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
+
# Install system dependencies for cairo and build tools
|
| 7 |
+
RUN apt-get update && apt-get install -y \
|
| 8 |
+
gcc \
|
| 9 |
+
g++ \
|
| 10 |
+
libcairo2-dev \
|
| 11 |
+
pkg-config \
|
| 12 |
+
python3-dev \
|
| 13 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
+
|
| 15 |
# Copy requirements first for better caching
|
| 16 |
COPY requirements.txt .
|
| 17 |
|
static/js/app.js
CHANGED
|
@@ -157,19 +157,22 @@ async function copyToClipboard(text) {
|
|
| 157 |
} else {
|
| 158 |
const ta = document.createElement('textarea');
|
| 159 |
ta.value = text;
|
| 160 |
-
ta.style.cssText = 'position:fixed;left:-9999px';
|
| 161 |
document.body.appendChild(ta);
|
|
|
|
| 162 |
ta.select();
|
| 163 |
-
document.execCommand('copy');
|
| 164 |
document.body.removeChild(ta);
|
|
|
|
| 165 |
}
|
| 166 |
|
| 167 |
btn.innerHTML = `<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg> Copied`;
|
| 168 |
btn.style.background = 'var(--color-success)';
|
| 169 |
btn.style.color = 'white';
|
| 170 |
btn.style.border = 'none';
|
| 171 |
-
} catch {
|
| 172 |
-
|
|
|
|
| 173 |
btn.style.background = 'var(--color-error)';
|
| 174 |
btn.style.color = 'white';
|
| 175 |
btn.style.border = 'none';
|
|
|
|
| 157 |
} else {
|
| 158 |
const ta = document.createElement('textarea');
|
| 159 |
ta.value = text;
|
| 160 |
+
ta.style.cssText = 'position:fixed;left:-9999px;top:0';
|
| 161 |
document.body.appendChild(ta);
|
| 162 |
+
ta.focus();
|
| 163 |
ta.select();
|
| 164 |
+
const success = document.execCommand('copy');
|
| 165 |
document.body.removeChild(ta);
|
| 166 |
+
if (!success) throw new Error('Copy command failed');
|
| 167 |
}
|
| 168 |
|
| 169 |
btn.innerHTML = `<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg> Copied`;
|
| 170 |
btn.style.background = 'var(--color-success)';
|
| 171 |
btn.style.color = 'white';
|
| 172 |
btn.style.border = 'none';
|
| 173 |
+
} catch (err) {
|
| 174 |
+
console.error('Copy failed:', err);
|
| 175 |
+
btn.innerHTML = `<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg> Failed`;
|
| 176 |
btn.style.background = 'var(--color-error)';
|
| 177 |
btn.style.color = 'white';
|
| 178 |
btn.style.border = 'none';
|