hopefully fix 429s and the setDeleted error

This commit is contained in:
notfire 2025-09-07 19:17:17 -04:00
commit 4f402d43a4
No known key found for this signature in database
2 changed files with 20 additions and 11 deletions

View file

@ -58,6 +58,13 @@ const StillImage = {
}
},
detectAnimationWithFetch (image) {
if (!this.$store.fetchedimgs)
this.$store.fetchedimgs = []
else
if (this.$store.fetchedimgs.indexOf(image.src) === -1)
this.$store.fetchedimgs.push(image.src)
else
return
// Browser Cache should ensure image doesn't get loaded twice if cache exists
fetch(image.src, {
referrerPolicy: 'same-origin'
@ -110,7 +117,7 @@ const StillImage = {
// this.setLabel('PNG')
// return
// }
// Hail mary for extensionless
if (extension.includes('/')) {
// Don't mind the CORS error barrage
@ -170,14 +177,14 @@ const StillImage = {
drawThumbnail() {
const canvas = this.$refs.canvas;
if (!canvas) return;
const context = canvas.getContext('2d');
const image = this.$refs.src;
const parentElement = canvas.parentElement;
// Draw the quick, unscaled version first
context.drawImage(image, 0, 0, parentElement.clientWidth, parentElement.clientHeight);
// Use requestAnimationFrame to schedule the scaling to the next frame
requestAnimationFrame(() => {
// Compute scaling ratio between the natural dimensions of the image and its display dimensions
@ -191,13 +198,13 @@ const StillImage = {
canvas.style.width = `${parentElement.clientWidth}px`;
canvas.style.height = `${parentElement.clientHeight}px`;
context.scale(ratio, ratio);
// Maintain the aspect ratio of the image
const imgAspectRatio = image.naturalWidth / image.naturalHeight;
const canvasAspectRatio = parentElement.clientWidth / parentElement.clientHeight;
let drawWidth, drawHeight;
if (imgAspectRatio > canvasAspectRatio) {
drawWidth = parentElement.clientWidth;
drawHeight = parentElement.clientWidth / imgAspectRatio;
@ -205,7 +212,7 @@ const StillImage = {
drawHeight = parentElement.clientHeight;
drawWidth = parentElement.clientHeight * imgAspectRatio;
}
context.clearRect(0, 0, canvas.width, canvas.height); // Clear the previous unscaled image
context.imageSmoothingEnabled = true;
context.imageSmoothingQuality = 'high';
@ -215,7 +222,7 @@ const StillImage = {
const dy = (parentElement.clientHeight - drawHeight) / 2;
context.drawImage(image, dx, dy, drawWidth, drawHeight);
});
}
}
},
updated () {
// On computed animated change

View file

@ -467,8 +467,10 @@ export const mutations = {
newStatus.bookmarked = status.bookmarked
},
setDeleted (state, { status }) {
const newStatus = state.allStatusesObject[status.id]
if (newStatus) newStatus.deleted = true
if (status) {
const newStatus = state.allStatusesObject[status.id]
if (newStatus) newStatus.deleted = true
}
},
setManyDeleted (state, condition) {
Object.values(state.allStatusesObject).forEach(status => {