Compare commits
	
		
			2 Commits
		
	
	
		
			94848e505f
			...
			be331343e7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						be331343e7
	
				 | 
					
					
						|||
| 
						
						
							
						
						878aeff52d
	
				 | 
					
					
						
@@ -114,7 +114,6 @@ div:has(.placeholder){
 | 
			
		||||
        width: min(1000px, 100dvw);
 | 
			
		||||
  	height: max(60dvh,600px);
 | 
			
		||||
	overflow: hidden;
 | 
			
		||||
	cursor:zoom-in;
 | 
			
		||||
}
 | 
			
		||||
.unblur#image{
 | 
			
		||||
	filter: blur(0px) !important;
 | 
			
		||||
@@ -152,11 +151,14 @@ dialog button{
 | 
			
		||||
	top: -2rem;
 | 
			
		||||
	right: -2rem;
 | 
			
		||||
}
 | 
			
		||||
.zoom-in{
 | 
			
		||||
	cursor: zoom-in;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
<section class="section">
 | 
			
		||||
    <figure class="image-container">
 | 
			
		||||
	<!-- svelte-ignore a11y-click-events-have-key-events -->
 | 
			
		||||
    	<div on:click={show_dialog_img}>
 | 
			
		||||
    	<div class:zoom-in={isloaded} on:click={show_dialog_img}>
 | 
			
		||||
		<div class=placeholder style="background-image:url({placeholder_src})" >
 | 
			
		||||
			<div class=placeholder_blur>
 | 
			
		||||
			<img class:unblur={isloaded} id=image {src} on:load={() => {isloaded=true}}  alt=""/>
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ export const POST =  (async ({ request })  => {
 | 
			
		||||
    if(data.bearer === BEARER_TOKEN){
 | 
			
		||||
	[ "full", "thumb", "placeholder"].forEach((folder) => {
 | 
			
		||||
		unlink(path.join(IMAGE_DIR, "rezepte", folder, data.name + ".webp"), (e) => {
 | 
			
		||||
			if(e) throw error(500, "could not delete: " + folder + "/" + data.name + ".webp")
 | 
			
		||||
			if(e) error(404, "could not delete: " + folder + "/" + data.name + ".webp" + e)
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
	return new Response(JSON.stringify({msg: "Deleted image successfully"}),{
 | 
			
		||||
 
 | 
			
		||||
@@ -136,10 +136,12 @@
 | 
			
		||||
		// two cases:
 | 
			
		||||
		//new image uploaded (not implemented yet)
 | 
			
		||||
		// new short_name -> move images as well
 | 
			
		||||
 | 
			
		||||
		// if new image
 | 
			
		||||
		console.log("img_local", img_local)
 | 
			
		||||
		if(img_local != ""){
 | 
			
		||||
			async function delete_img(){
 | 
			
		||||
				const res_img = await fetch('/api/img/delete', {
 | 
			
		||||
				const res = await fetch('/api/img/delete', {
 | 
			
		||||
					method: 'POST',
 | 
			
		||||
					body: JSON.stringify({
 | 
			
		||||
						name: old_short_name,
 | 
			
		||||
@@ -150,8 +152,8 @@
 | 
			
		||||
						bearer: password
 | 
			
		||||
						}
 | 
			
		||||
				})
 | 
			
		||||
				if(!res_img.ok){
 | 
			
		||||
					const item = await res_img.json();
 | 
			
		||||
				if(!res.ok){
 | 
			
		||||
					const item = await res.json();
 | 
			
		||||
					alert(item.message)
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
@@ -171,7 +173,7 @@
 | 
			
		||||
        			    body: JSON.stringify(data)
 | 
			
		||||
        			});
 | 
			
		||||
				if(!res.ok){
 | 
			
		||||
					const item = await res_img.json();
 | 
			
		||||
					const item = await res.json();
 | 
			
		||||
					alert(item.message)
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user