clearance
This commit is contained in:
parent
a2571d6e6f
commit
8c97b4f989
@ -1,40 +0,0 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
console.log("favorites.js ejecutado correctamente");
|
||||
|
||||
const favoriteButton = document.getElementById('favorite-button');
|
||||
if (!favoriteButton) {
|
||||
console.warn("Botón de favoritos no encontrado. ¿El usuario está autenticado?");
|
||||
return;
|
||||
}
|
||||
|
||||
// Obtener el pasteId desde el atributo del <body>
|
||||
const pasteId = document.body.dataset.pasteId;
|
||||
if (!pasteId) {
|
||||
console.error("Error: pasteId no está definido en el <body>.");
|
||||
return;
|
||||
}
|
||||
|
||||
favoriteButton.addEventListener('click', function () {
|
||||
fetch(`/paste/${pasteId}/favorite`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + (document.body.dataset.authToken || '')
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to toggle favorite');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
const message = data.message || 'Action completed!';
|
||||
showToast(message, 'bg-success');
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
showToast('Error adding to favorites.', 'bg-danger');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,88 +0,0 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: pastebin-app
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: pastebin
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: pastebin
|
||||
spec:
|
||||
# InitContainers para ajustar permisos de ambos volúmenes
|
||||
initContainers:
|
||||
- name: fix-permissions-database
|
||||
image: busybox
|
||||
command: ["sh", "-c", "chown -R 1000:1000 /app/database"]
|
||||
volumeMounts:
|
||||
- name: database
|
||||
mountPath: /app/database
|
||||
- name: fix-permissions-uploads
|
||||
image: busybox
|
||||
command: ["sh", "-c", "chown -R 1000:1000 /app/uploads"]
|
||||
volumeMounts:
|
||||
- name: uploads
|
||||
mountPath: /app/uploads
|
||||
# Contenedor principal
|
||||
containers:
|
||||
- name: pastebin-container
|
||||
image: prietus/pastebin-app:1.4
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
env:
|
||||
# Variables de entorno para configuración SMTP
|
||||
- name: SMTP_SERVER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: pastebin-config
|
||||
key: SMTP_SERVER
|
||||
- name: SMTP_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: pastebin-config
|
||||
key: SMTP_PORT
|
||||
- name: SMTP_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: pastebin-secret
|
||||
key: SMTP_USERNAME
|
||||
- name: SMTP_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: pastebin-secret
|
||||
key: SMTP_PASSWORD
|
||||
# Variables adicionales
|
||||
- name: VALID_USER
|
||||
value: "admin"
|
||||
- name: VALID_PASS
|
||||
value: "wasamasa123"
|
||||
- name: SECRET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: pastebin-secret
|
||||
key: SECRET_KEY
|
||||
- name: JWT_EXP_DELTA_SECONDS
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: pastebin-config
|
||||
key: JWT_EXP_DELTA_SECONDS
|
||||
volumeMounts:
|
||||
- name: database
|
||||
mountPath: /app/database
|
||||
- name: uploads
|
||||
mountPath: /app/uploads
|
||||
# Declaración de volúmenes
|
||||
volumes:
|
||||
- name: database
|
||||
persistentVolumeClaim:
|
||||
claimName: database-pvc
|
||||
- name: uploads
|
||||
persistentVolumeClaim:
|
||||
claimName: uploads-pvc
|
||||
|
@ -1,40 +0,0 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
console.log("favorites.js ejecutado correctamente");
|
||||
|
||||
const favoriteButton = document.getElementById('favorite-button');
|
||||
if (!favoriteButton) {
|
||||
console.warn("Botón de favoritos no encontrado. ¿El usuario está autenticado?");
|
||||
return;
|
||||
}
|
||||
|
||||
// Obtener el pasteId desde el atributo del <body>
|
||||
const pasteId = document.body.dataset.pasteId;
|
||||
if (!pasteId) {
|
||||
console.error("Error: pasteId no está definido en el <body>.");
|
||||
return;
|
||||
}
|
||||
|
||||
favoriteButton.addEventListener('click', function () {
|
||||
fetch(`/paste/${pasteId}/favorite`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + (document.body.dataset.authToken || '')
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to toggle favorite');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
const message = data.message || 'Action completed!';
|
||||
showToast(message, 'bg-success');
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
showToast('Error adding to favorites.', 'bg-danger');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user