From b5aa30d19dcab68bfc0c216a5f8634c4e6bc2715 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 21 Oct 2023 06:15:28 +0000 Subject: [PATCH] chore(deps): 4-4 bump github.com/ViBiOh/httputils/v4 from 4.66.6 to 4.66.8 Bumps [github.com/ViBiOh/httputils/v4](https://github.com/ViBiOh/httputils) from 4.66.6 to 4.66.8. - [Release notes](https://github.com/ViBiOh/httputils/releases) - [Commits](https://github.com/ViBiOh/httputils/compare/v4.66.6...v4.66.8) Co-authored-by: Vincent Boutour --- updated-dependencies: - dependency-name: github.com/ViBiOh/httputils/v4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: Vincent Boutour --- cmd/fibr/static/scripts/index.min.js | 2 +- cmd/fibr/static/styles/main.min.css | 2 +- go.mod | 10 +++++----- go.sum | 28 ++++++++++++++-------------- pkg/mocks/redis_client.go | 4 ++-- pkg/share/share.go | 10 +--------- pkg/webhook/webhook.go | 12 +----------- 7 files changed, 25 insertions(+), 43 deletions(-) diff --git a/cmd/fibr/static/scripts/index.min.js b/cmd/fibr/static/scripts/index.min.js index 52c9ef8d..014f2528 100644 --- a/cmd/fibr/static/scripts/index.min.js +++ b/cmd/fibr/static/scripts/index.min.js @@ -1 +1 @@ -function isWebPCompatible(){const e="UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA";return new Promise((t,n)=>{const s=new Image;s.onload=()=>{s.width>0&&s.height>0?t():n()},s.onerror=n.bind(null,!0),s.src=`data:image/webp;base64,${e}`})}function appendChunk(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function findIndexEscapeSequence(e,t){let n=0;for(let s=0;s=400)throw new Error("unable to load thumbnails");let t;typeof lazyLoadThumbnail!="undefined"&&lazyLoadThumbnail&&(t=new IntersectionObserver(async(e)=>{for(const s of e){if(!s.isIntersecting)continue;const n=s.target,o=n.parentElement.parentElement,i=generateThrobber(["throbber-white","throbber-overlay"]);if(o.appendChild(i),n.addEventListener("load",()=>o.removeChild(i),{once:!0}),window.webpHero){const t=await fetch(n.dataset.src,{credentials:"same-origin"}),s=await t.arrayBuffer(),e=new webpHero.WebpMachine;n.src=await e.decode(new Uint8Array(s)),e.clearCache()}else n.src=n.dataset.src;t.unobserve(n)}}));for await(let o of readChunk(n)){const i=o.findIndex(e=>e===44);if(i===-1){console.error("invalid line for thumbnail:",line);continue}const s=document.getElementById(`picture-${String.fromCharCode.apply(null,o.slice(0,i))}`);if(!s)continue;const e=new Image;e.src=`data:image/webp;base64,${encode(o.slice(i+1))}`,e.alt=s.dataset.alt,e.dataset.src=s.dataset.src,e.classList.add("thumbnail","full","block"),replaceContent(s,e),t!==void 0&&t.observe(e)}}document.addEventListener("readystatechange",async e=>{if(e.target.readyState!=="complete")return;let t=new Intl.DateTimeFormat(navigator.language,{dateStyle:"full",timeStyle:"long"});document.querySelectorAll(".date").forEach(e=>{e.innerHTML=t.format(new Date(e.innerHTML))})}),document.addEventListener("readystatechange",async e=>{if(e.target.readyState!=="complete")return;if(typeof hasThumbnail=="undefined"||!hasThumbnail)return;const t=document.querySelectorAll("[data-thumbnail]");if(!t)return;t.forEach(e=>{replaceContent(e,generateThrobber(["throbber-white"]))});try{await isWebPCompatible()}catch{await resolveScript("https://unpkg.com/webp-hero@0.0.2/dist-cjs/webp-hero.bundle.js","sha512-DA6h9H5Sqn55/uVn4JI4aSPFnAWoCQYYDXUnvjOAMNVx11///hX4QaFbQt5yWsrIm9hSI5fLJYfRWt3KXneSXQ==","anonymous")}try{await fetchThumbnail()}catch(e){console.error(e)}if(window.webpHero){const e=new webpHero.WebpMachine;e.polyfillDocument(),e.clearCache()}},!1),document.addEventListener("readystatechange",e=>{if(e.target.readyState!=="complete")return;document.querySelectorAll("[data-confirm]").forEach(e=>{e.addEventListener("click",t=>{confirm(`Are you sure you want to delete ${e.dataset.confirm}?`)||t.preventDefault()})})}),document.addEventListener("readystatechange",e=>{if(e.target.readyState!=="complete")return;const t=document.getElementById("go-back");t&&(t.setAttribute("href",document.referrer),t.addEventListener("click",e=>(e.preventDefault(),window.addEventListener("popstate",()=>{window.location.reload(!0)}),history.back(),!1)))});async function fetchGeoJSON(e){const t=await fetch(e,{credentials:"same-origin"});if(t.status>=400)throw new Error("unable to load geojson");return t.status===204?null:t.json()}async function addStyle(e,t,n){return new Promise(s=>{const o=document.createElement("link");o.rel="stylesheet",o.href=e,o.onload=s,t&&(o.integrity=t,o.crossOrigin=n),document.querySelector("head").appendChild(o)})}async function loadLeaflet(){const e="1.9.4";await addStyle(`https://unpkg.com/leaflet@${e}/dist/leaflet.css`,"sha512-Zcn6bjR/8RZbLEpLIeOwNtzREBAJnUKESxces60Mpoj+2okopSAcSUIUOseddDm0cxnGQzxIR7vJgsLZbdLE3w==","anonymous"),await addStyle("https://unpkg.com/leaflet.markercluster@1.5.1/dist/MarkerCluster.Default.css","sha512-6ZCLMiYwTeli2rVh3XAPxy3YoR5fVxGdH/pz+KMCzRY2M65Emgkw00Yqmhh8qLGeYQ3LbVZGdmOX9KUjSKr0TA==","anonymous"),await resolveScript(`https://unpkg.com/leaflet@${e}/dist/leaflet.js`,"sha512-BwHfrr4c9kmRkLw6iXFdzcdWV/PGkVgiIyIWLLlTSXzWQzxuSg4DiQUCpauz/EWjgk5TYQqX/kvn9pG1NpYfqg==","anonymous"),await resolveScript("https://unpkg.com/leaflet.markercluster@1.5.1/dist/leaflet.markercluster.js","sha512-+Zr0llcuE/Ho6wXRYtlWypMyWSEMxrWJxrYgeAMDRSf1FF46gQ3PAVOVp5RHdxdzikZXuHZ0soHpqRkkPkI3KA==","anonymous")}let map;async function renderMap(e){if(map){map.invalidateSize();return}const t=document.getElementById("map-container"),n=generateThrobber(["map-throbber","throbber-white"]);t&&t.appendChild(n),await loadLeaflet(),map=L.map("map-container",{center:[46.227638,2.213749],zoom:5}),L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{maxZoom:19,attribution:'© OpenStreetMap contributors'}).addTo(map);const s=await fetchGeoJSON(e);if(!s||!s.features)return;const o=L.markerClusterGroup({zoomToBoundsOnClick:!1}),i=[];s.features.map(e=>{const t=L.GeoJSON.coordsToLatLng(e.geometry.coordinates);i.push(t),o.addLayer(L.circleMarker(t).bindPopup(`Image thumbnail
${e.properties.date}`,{maxWidth:"auto",closeButton:!1,className:"thumbnail-popup"}))}),o.on("clusterclick",e=>{map.fitBounds(e.layer.getAllChildMarkers().map(e=>e.getLatLng()))}),i.length?(map.once("zoomend",()=>{t.removeChild(n)}),map.fitBounds(i)):t.removeChild(n),map.addLayer(o)}document.addEventListener("readystatechange",async e=>{if(e.target.readyState!=="complete")return;document.location.hash==="#map"?await renderMap(geoURL):window.addEventListener("popstate",async()=>{document.location.hash==="#map"&&await renderMap(geoURL)})});function resolveScript(e,t,n){return new Promise((s,o)=>{const i=document.createElement("script");i.type="text/javascript",i.src=e,i.async=!0,i.onload=s.bind(null,!0),i.onerror=o.bind(null,!0),t&&(i.integrity=t,i.crossOrigin=n),document.querySelector("head").appendChild(i)})}window.onkeyup=e=>{switch(e.key){case"ArrowLeft":goToPrevious();break;case"ArrowRight":goToNext();break;case"Escape":goBack(e);break}};function goBack(e){const t=document.location.hash;if(t){if(typeof abort=="function"&&typeof aborter!="undefined"){abort(e);return}document.location.hash="",/success$/gim.test(t)&&window.location.reload(!0);return}if(typeof parentPage=="undefined")return;window.location.href=parentPage}function goToPrevious(){if(typeof previousFile=="undefined")return;window.location.href=previousFile}function goToNext(){if(typeof nextFile=="undefined")return;window.location.href=nextFile}function replaceContent(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);t&&e.appendChild(t)}function generateThrobber(e=[]){const t=document.createElement("div");t.classList.add("throbber"),e.forEach(e=>t.classList.add(e));for(let e=1;e<4;e++){const n=document.createElement("div");n.classList.add("throbber-dot",`throbber-dot-${e}`),t.appendChild(n)}return t}let fileInput,uploadList,cancelButton;function eventNoop(e){e.preventDefault(),e.stopPropagation()}document.addEventListener("readystatechange",async e=>{if(e.target.readyState!=="complete")return;const t=document.getElementsByTagName("body")[0];t.addEventListener("dragover",eventNoop),t.addEventListener("dragleave",eventNoop),t.addEventListener("drop",e=>{eventNoop(e),window.location.hash="#upload-modal",fileInput&&(fileInput.files=e.dataTransfer.files,fileInput.dispatchEvent(new Event("change")))})});function bufferToHex(e){return Array.prototype.map.call(new Uint8Array(e),e=>`00${e.toString(16)}`.slice(-2)).join("")}async function sha(e){const t=await crypto.subtle.digest("SHA-256",new TextEncoder("utf-8").encode(e));return bufferToHex(t)}async function fileMessageId(e){const t=await sha(JSON.stringify({name:e.name,size:e.size,type:e.type,lastModified:e.lastModified}));return`upload-file-${t}`}function humanFileSize(e){return e<1024?e+"bytes":e<1048576?(e/1024).toFixed(0)+" KB":(e/1048576).toFixed(0)+" MB"}async function addUploadItem(e,t){const c=await fileMessageId(t),n=document.createElement("div");n.id=c,n.classList.add("flex","flex-center","margin");const o=document.createElement("div");o.classList.add("upload-item"),n.appendChild(o);const s=document.createElement("input");s.id=`${c}-filename`,s.classList.add("upload-name","full"),s.type="text",s.value=t.name,o.appendChild(s);const i=document.createElement("div");i.classList.add("full","flex","flex-center");const r=document.createElement("em");r.innerHTML=humanFileSize(t.size),r.style.width="8rem",i.appendChild(r);const a=document.createElement("progress");a.classList.add("flex-grow","margin-left"),a.max=100,a.value=0,i.appendChild(a),o.appendChild(i);const l=document.createElement("span");l.classList.add("upload-status"),n.appendChild(l),e.appendChild(n)}function getFiles(e){return[].filter.call(e.target,e=>e.nodeName.toLowerCase()==="input").reduce((e,t)=>(t.type==="file"?e.files=t.files:e[t.name]=t.value,e),{})}function getFilename(e,t){const n=document.getElementById(`${e}-filename`);return n&&n.value?n.value:t.name}function clearUploadStatus(e){if(!e)return;const t=e.querySelector(".upload-status");if(!t)return;t.classList.remove("danger"),t.classList.remove("success")}async function setUploadStatus(e,t,n,s){if(!e)return;const o=e.querySelector(".upload-status");if(!o)return;o.innerHTML=t,o.classList.add(n),s&&(o.title=s)}let uploadFile,aborter;const chunkSize=1024*1024;let currentUpload={};async function uploadFileByChunks(e,t,n,s){let i;if(e&&(i=e.querySelector("progress"),clearUploadStatus(e)),s.name!==currentUpload.filename){currentUpload.filename=s.name,currentUpload.chunks=[];for(let e=0;e=400)return Promise.reject(await a.text());currentUpload.chunks[e].done=!0,i&&(i.value=chunkSize*(e+1)/s.size*100)}const o=new FormData;o.append("method",t),o.append("filename",n),o.append("size",s.size);const a=await fetch("",{method:"POST",credentials:"same-origin",headers:{"X-Chunk-Upload":!0,Accept:"text/plain"},body:o}),r=await a.text();return a.status>=400?Promise.reject(r):(currentUpload={},Promise.resolve(r))}async function uploadFileByXHR(e,t,n,s){let o;e&&(o=e.querySelector("progress"),clearUploadStatus(e));const i=new FormData;return i.append("method",t),i.append("filename",n),i.append("size",s.size),i.append("file",s),new Promise((e,t)=>{let n=new XMLHttpRequest;aborter=n,o&&n.upload.addEventListener("progress",e=>o.value=parseInt(e.loaded/e.total*100,10),!1),n.addEventListener("readystatechange",s=>{if(n.readyState===XMLHttpRequest.UNSENT){t(new Error("request aborted")),n=void 0;return}if(n.readyState!==XMLHttpRequest.DONE)return;n.status>=200&&n.status<400?(o&&(o.value=100),e(n.responseText),n=void 0):(t(s),n=void 0)},!1),n.open("POST","",!0),n.setRequestHeader("Accept","text/plain"),n.send(i)})}function sliceFileList(e,t){const n=document.getElementById(e),s=new DataTransfer;for(;t{if(e.target.readyState!=="complete")return;if(typeof chunkUpload!="undefined"&&chunkUpload?uploadFile=uploadFileByChunks:uploadFile=uploadFileByXHR,fileInput=document.getElementById("file"),uploadList=document.getElementById("upload-list"),cancelButton=document.getElementById("upload-cancel"),fileInput){fileInput.classList.add("opacity"),fileInput.multiple=!0,fileInput.addEventListener("change",()=>{window.location.hash="#upload-modal",replaceContent(uploadList);for(const e of fileInput.files)addUploadItem(uploadList,e)});const e=document.getElementById("upload-button-link");e&&e.addEventListener("click",e=>{eventNoop(e),fileInput.click()})}const t=document.getElementById("file-label");t&&(t.classList.remove("hidden"),t.innerHTML="Choose files..."),uploadList&&uploadList.classList.remove("hidden"),cancelButton&&cancelButton.addEventListener("click",goBack);const n=document.getElementById("upload-form");n&&n.addEventListener("submit",upload)}),document.addEventListener("readystatechange",e=>{if(e.target.readyState!=="complete")return;const t=document.getElementById("webhook-url-label");if(!t)return;const n=document.getElementById("webhook-url"),s=document.getElementById("telegram-chat-id");document.getElementById("webhook-kind-raw").addEventListener("change",e=>{e.target.value==="raw"&&(n.placeholder="https://website.com/fibr",t.innerHTML="URL",s.classList.add("hidden"))}),document.getElementById("webhook-kind-discord").addEventListener("change",e=>{e.target.value==="discord"&&(n.placeholder="https://discord.com/api/webhooks/...",t.innerHTML="URL",s.classList.add("hidden"))}),document.getElementById("webhook-kind-slack").addEventListener("change",e=>{e.target.value==="slack"&&(n.placeholder="https://hooks.slack.com/services/...",t.innerHTML="URL",s.classList.add("hidden"))}),document.getElementById("webhook-kind-telegram").addEventListener("change",e=>{e.target.value==="telegram"&&(t.innerHTML="Token",n.placeholder="Bot token",s.classList.remove("hidden"))})}) \ No newline at end of file +function isWebPCompatible(){const e="UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA";return new Promise((t,n)=>{const s=new Image;s.onload=()=>{s.width>0&&s.height>0?t():n()},s.onerror=n.bind(null,!0),s.src=`data:image/webp;base64,${e}`})}function appendChunk(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function findIndexEscapeSequence(e,t){let n=0;for(let s=0;s=400)throw new Error("unable to load thumbnails");let t;typeof lazyLoadThumbnail!="undefined"&&lazyLoadThumbnail&&(t=new IntersectionObserver(async(e)=>{for(const s of e){if(!s.isIntersecting)continue;const n=s.target,o=n.parentElement.parentElement,i=generateThrobber(["throbber-white","throbber-overlay"]);if(o.appendChild(i),n.addEventListener("load",()=>o.removeChild(i),{once:!0}),window.webpHero){const t=await fetch(n.dataset.src,{credentials:"same-origin"}),s=await t.arrayBuffer(),e=new webpHero.WebpMachine;n.src=await e.decode(new Uint8Array(s)),e.clearCache()}else n.src=n.dataset.src;t.unobserve(n)}}));for await(let o of readChunk(n)){const i=o.findIndex(e=>e===44);if(i===-1){console.error("invalid line for thumbnail:",line);continue}const s=document.getElementById(`picture-${String.fromCharCode.apply(null,o.slice(0,i))}`);if(!s)continue;const e=new Image;e.src=`data:image/webp;base64,${encode(o.slice(i+1))}`,e.alt=s.dataset.alt,e.dataset.src=s.dataset.src,e.classList.add("thumbnail","full","block"),replaceContent(s,e),t!==void 0&&t.observe(e)}}document.addEventListener("readystatechange",async e=>{if(e.target.readyState!=="complete")return;let t=new Intl.DateTimeFormat(navigator.language,{dateStyle:"full",timeStyle:"long"});document.querySelectorAll(".date").forEach(e=>{e.innerHTML=t.format(new Date(e.innerHTML))})}),document.addEventListener("readystatechange",async e=>{if(e.target.readyState!=="complete")return;if(typeof hasThumbnail=="undefined"||!hasThumbnail)return;const t=document.querySelectorAll("[data-thumbnail]");if(!t)return;t.forEach(e=>{replaceContent(e,generateThrobber(["throbber-white"]))});try{await isWebPCompatible()}catch{await resolveScript("https://unpkg.com/webp-hero@0.0.2/dist-cjs/webp-hero.bundle.js","sha512-DA6h9H5Sqn55/uVn4JI4aSPFnAWoCQYYDXUnvjOAMNVx11///hX4QaFbQt5yWsrIm9hSI5fLJYfRWt3KXneSXQ==","anonymous")}try{await fetchThumbnail()}catch(e){console.error(e)}if(window.webpHero){const e=new webpHero.WebpMachine;e.polyfillDocument(),e.clearCache()}},!1),document.addEventListener("readystatechange",e=>{if(e.target.readyState!=="complete")return;document.querySelectorAll("[data-confirm]").forEach(e=>{e.addEventListener("click",t=>{confirm(`Are you sure you want to delete ${e.dataset.confirm}?`)||t.preventDefault()})})}),document.addEventListener("readystatechange",e=>{if(e.target.readyState!=="complete")return;const t=document.getElementById("go-back");t&&(t.setAttribute("href",document.referrer),t.addEventListener("click",e=>(e.preventDefault(),window.addEventListener("popstate",()=>{window.location.reload(!0)}),history.back(),!1)))});async function fetchGeoJSON(e){const t=await fetch(e,{credentials:"same-origin"});if(t.status>=400)throw new Error("unable to load geojson");return t.status===204?null:t.json()}async function addStyle(e,t,n){return new Promise(s=>{const o=document.createElement("link");o.rel="stylesheet",o.href=e,o.onload=s,t&&(o.integrity=t,o.crossOrigin=n),document.querySelector("head").appendChild(o)})}async function loadLeaflet(){const e="1.9.4";await addStyle(`https://unpkg.com/leaflet@${e}/dist/leaflet.css`,"sha512-Zcn6bjR/8RZbLEpLIeOwNtzREBAJnUKESxces60Mpoj+2okopSAcSUIUOseddDm0cxnGQzxIR7vJgsLZbdLE3w==","anonymous"),await addStyle("https://unpkg.com/leaflet.markercluster@1.5.1/dist/MarkerCluster.Default.css","sha512-6ZCLMiYwTeli2rVh3XAPxy3YoR5fVxGdH/pz+KMCzRY2M65Emgkw00Yqmhh8qLGeYQ3LbVZGdmOX9KUjSKr0TA==","anonymous"),await resolveScript(`https://unpkg.com/leaflet@${e}/dist/leaflet.js`,"sha512-BwHfrr4c9kmRkLw6iXFdzcdWV/PGkVgiIyIWLLlTSXzWQzxuSg4DiQUCpauz/EWjgk5TYQqX/kvn9pG1NpYfqg==","anonymous"),await resolveScript("https://unpkg.com/leaflet.markercluster@1.5.1/dist/leaflet.markercluster.js","sha512-+Zr0llcuE/Ho6wXRYtlWypMyWSEMxrWJxrYgeAMDRSf1FF46gQ3PAVOVp5RHdxdzikZXuHZ0soHpqRkkPkI3KA==","anonymous")}let map;async function renderMap(e){if(map){map.invalidateSize();return}const t=document.getElementById("map-container"),n=generateThrobber(["map-throbber","throbber-white"]);t&&t.appendChild(n),await loadLeaflet(),map=L.map("map-container",{center:[46.227638,2.213749],zoom:5}),L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{maxZoom:19,attribution:'© OpenStreetMap contributors'}).addTo(map);const s=await fetchGeoJSON(e);if(!s||!s.features)return;const o=L.markerClusterGroup({zoomToBoundsOnClick:!1}),i=[];s.features.map(e=>{const t=L.GeoJSON.coordsToLatLng(e.geometry.coordinates);i.push(t),o.addLayer(L.circleMarker(t).bindPopup(`Image thumbnail
${e.properties.date}`,{maxWidth:"auto",closeButton:!1,className:"thumbnail-popup"}))}),o.on("clusterclick",e=>{map.fitBounds(e.layer.getAllChildMarkers().map(e=>e.getLatLng()))}),i.length?(map.once("zoomend",()=>{t.removeChild(n)}),map.fitBounds(i)):t.removeChild(n),map.addLayer(o)}document.addEventListener("readystatechange",async e=>{if(e.target.readyState!=="complete")return;document.location.hash==="#map"?await renderMap(geoURL):window.addEventListener("popstate",async()=>{document.location.hash==="#map"&&await renderMap(geoURL)})}) \ No newline at end of file diff --git a/cmd/fibr/static/styles/main.min.css b/cmd/fibr/static/styles/main.min.css index 80f22db0..ba476baf 100644 --- a/cmd/fibr/static/styles/main.min.css +++ b/cmd/fibr/static/styles/main.min.css @@ -1 +1 @@ -.thumbnail{max-height:100%;vertical-align:middle;width:100%}.exif-button{bottom:1rem;position:absolute;right:1rem}#exif-modal:target{display:flex;z-index:5}#exif-modal:target~.content{pointer-events:none}.breakable{word-break:break-word}.top-shadow{box-shadow:0 -.5em .5em -.5em var(--white)}:root{--primary:royalblue;--success:limegreen;--danger:crimson;--dark:#272727;--grey:#3b3b3b;--white:aliceblue;--icon-size:2.4rem;--icon-large:4.8rem}*{box-sizing:border-box}html{font-size:62.5%}body{-webkit-overflow-scrolling:touch;background-color:var(--dark);height:100vh}body,button,input{color:var(--white);font-family:-apple-system,segoe ui,roboto,oxygen-sans,ubuntu,cantarell,helvetica nue,sans-serif;font-size:1.6rem;font-style:normal;font-weight:400}input{color:var(--dark)}input[type=file]{color:var(--white)}a{color:var(--white);text-decoration:none}a:hover{color:var(--primary);text-decoration:underline}.primary{color:var(--primary)}.success{color:var(--success)}.danger{color:var(--danger)}.grey{color:var(--grey)}.white{color:var(--white)}.bg-primary,.bg-primary:hover{background-color:var(--primary);color:var(--white);text-decoration:none}.bg-success,.bg-success:hover{background-color:var(--success);color:var(--dark);text-decoration:none}.bg-danger,.bg-danger:hover{background-color:var(--danger);color:var(--white);text-decoration:none}.bg-grey,.bg-grey:hover{background-color:var(--grey);color:var(--white);text-decoration:none}.button{border-radius:4px;border:0;cursor:pointer;display:inline-block;margin:0;padding:1rem;text-decoration:none}.button-icon{background-color:initial}.icon{background-position:50%;background-repeat:no-repeat;color:var(--white);display:inline-block;height:var(--icon-size);text-decoration:none;vertical-align:middle}.icon-square{width:var(--icon-size)}.icon-large{height:var(--icon-large);width:var(--icon-large)}.icon-overlay{background-color:var(--white);border-radius:50%;height:var(--icon-large);left:calc((100% - var(--icon-large))/2);padding-left:1rem;pointer-events:none;position:absolute;top:calc((100% - var(--icon-large))/2);width:var(--icon-large)}.icon-overlay-small{bottom:1rem;height:var(--icon-size);position:absolute;right:1rem;width:var(--icon-size)}.clickable{cursor:pointer}.modal{align-items:flex-start;background-color:rgba(84,84,84,.75);display:none;height:100vh;justify-content:center;left:0;padding-top:5rem;pointer-events:none;position:fixed;top:0;width:100vw}.modal-content{background-color:var(--dark);display:flex;flex-direction:column;max-height:80%;max-width:90%;pointer-events:auto}.header{background-color:var(--grey);margin-top:0;padding:.5rem 1rem;text-align:left}.center{text-align:center}.padding{padding:1rem}.no-padding{padding:0}.margin{margin:1rem}.margin-left{margin-left:1rem}.no-margin{margin:0}.no-background{background-color:initial}.hidden{display:none}@media print{body::before{content:'Save ink, share link.'}body>*{display:none}}.flex{display:flex}.flex-center{align-items:center;justify-content:center}.flex-grow{flex:1 1}.flex-column{flex-direction:column}.full{width:100%}.full-screen{max-width:100vw}.medium{font-size:2.4rem}.small{font-size:1.6rem}.scrollable{overflow-y:auto}.padding-left{padding-left:1rem}.padding-right{padding-right:1rem}.ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.flex-ellipsis{min-width:0}.relative{position:relative}.block{display:block}@media screen and (max-width:374px){.hide-xs{display:none}}@media screen and (max-width:599px){.hide-s{display:none}}#map:target{display:flex;z-index:5}#map:target~.content{pointer-events:none}#map-container{background-color:var(--grey);color:var(--dark);height:80vh;width:80vw}.thumbnail-img{height:15rem}.thumbnail-popup{bottom:55px!important;height:15rem;width:19rem}.map-throbber{z-index:500}.map-throbber .throbber-dot{height:3.2rem;width:3.2rem}#search:target{display:flex;z-index:5}#search:target~.content{pointer-events:none}#size,#since{width:7rem}.share-form-modal:target{display:flex;z-index:5}.share-form-modal:target~.content{pointer-events:none}.share-list-modal:target{display:flex;z-index:5}.share-list-modal:target~.content{pointer-events:none}#shares{border-spacing:0;display:block;overflow-x:hidden;overflow-y:auto}#shares th,#shares td{padding:1rem}.share-link{color:var(--success)}.share-content:hover{background-color:var(--grey)}.path{max-width:30rem;text-align:left}@media screen and (max-width:485px){#shares th,#shares td{padding:.5rem}.path{max-width:20rem}}@media screen and (max-width:430px){.path{max-width:16rem}}@media screen and (max-width:375px){.path{max-width:12rem}}@media screen and (max-width:320px){.path{max-width:8rem}}.stats{margin:0 auto;width:30rem}.key{display:inline-block;width:10rem}.throbber{margin:auto;text-align:center}.throbber-dot{animation:throbber-dot 1.4s infinite ease-in-out both;background-color:var(--dark);border-radius:100%;display:inline-block;height:1rem;width:1rem}.throbber-white .throbber-dot{background-color:var(--white)}.throbber-dot-1{animation-delay:-.32s}.throbber-dot-2{animation-delay:-.16s}@keyframes throbber-dot{0%,80%,100%{transform:scale(0)}40%{transform:scale(1)}}.upload-modal:target,.upload-success:target{display:flex;z-index:5}.upload-modal:target~.content,.upload-success:target~.content{pointer-events:none}.upload-width{max-width:30rem}.upload-item{display:inline-block;width:calc(100% - 2rem)}.upload-name{text-align:left}.opacity{flex:0 0;opacity:0}.upload-status{margin-left:.5rem;text-align:right;width:2rem}#webhook-form:target{display:flex;z-index:5}#webhook-form:target~.content{pointer-events:none}#webhook-list:target{display:flex;z-index:5}#webhook-list:target~.content{pointer-events:none}#webhooks{border-spacing:0;display:block;overflow:auto}#webhooks th,#webhooks td{padding:1rem}.webhook-content:hover{background-color:var(--grey)}.url{max-width:30rem;text-align:left}@media screen and (max-width:485px){.url{max-width:20rem}}@media screen and (max-width:430px){.url{max-width:16rem}}@media screen and (max-width:375px){.url{max-width:12rem}}@media screen and (max-width:320px){.url{max-width:8rem}} \ No newline at end of file +.thumbnail{max-height:100%;vertical-align:middle;width:100%}.exif-button{bottom:1rem;position:absolute;right:1rem}#exif-modal:target{display:flex;z-index:5}#exif-modal:target~.content{pointer-events:none}.breakable{word-break:break-word}.top-shadow{box-shadow:0 -.5em .5em -.5em var(--white)}:root{--primary:royalblue;--success:limegreen;--danger:crimson;--dark:#272727;--grey:#3b3b3b;--white:aliceblue;--icon-size:2.4rem;--icon-large:4.8rem}*{box-sizing:border-box}html{font-size:62.5%}body{-webkit-overflow-scrolling:touch;background-color:var(--dark);height:100vh}body,button,input{color:var(--white);font-family:-apple-system,segoe ui,roboto,oxygen-sans,ubuntu,cantarell,helvetica nue,sans-serif;font-size:1.6rem;font-style:normal;font-weight:400}input{color:var(--dark)}input[type=file]{color:var(--white)}a{color:var(--white);text-decoration:none}a:hover{color:var(--primary);text-decoration:underline}.primary{color:var(--primary)}.success{color:var(--success)}.danger{color:var(--danger)}.grey{color:var(--grey)}.white{color:var(--white)}.bg-primary,.bg-primary:hover{background-color:var(--primary);color:var(--white);text-decoration:none}.bg-success,.bg-success:hover{background-color:var(--success);color:var(--dark);text-decoration:none}.bg-danger,.bg-danger:hover{background-color:var(--danger);color:var(--white);text-decoration:none}.bg-grey,.bg-grey:hover{background-color:var(--grey);color:var(--white);text-decoration:none}.button{border-radius:4px;border:0;cursor:pointer;display:inline-block;margin:0;padding:1rem;text-decoration:none}.button-icon{background-color:initial}.icon{background-position:50%;background-repeat:no-repeat;color:var(--white);display:inline-block;height:var(--icon-size);text-decoration:none;vertical-align:middle}.icon-square{width:var(--icon-size)}.icon-large{height:var(--icon-large);width:var(--icon-large)}.icon-overlay{background-color:var(--white);border-radius:50%;height:var(--icon-large);left:calc((100% - var(--icon-large))/2);padding-left:1rem;pointer-events:none;position:absolute;top:calc((100% - var(--icon-large))/2);width:var(--icon-large)}.icon-overlay-small{bottom:1rem;height:var(--icon-size);position:absolute;right:1rem;width:var(--icon-size)}.clickable{cursor:pointer}.modal{align-items:flex-start;background-color:rgba(84,84,84,.75);display:none;height:100vh;justify-content:center;left:0;padding-top:5rem;pointer-events:none;position:fixed;top:0;width:100vw}.modal-content{background-color:var(--dark);display:flex;flex-direction:column;max-height:80%;max-width:90%;pointer-events:auto}.header{background-color:var(--grey);margin-top:0;padding:.5rem 1rem;text-align:left}.center{text-align:center}.padding{padding:1rem}.no-padding{padding:0}.margin{margin:1rem}.margin-left{margin-left:1rem}.no-margin{margin:0}.no-background{background-color:initial}.hidden{display:none}@media print{body::before{content:'Save ink, share link.'}body>*{display:none}}.flex{display:flex}.flex-center{align-items:center;justify-content:center}.flex-grow{flex:1 1}.flex-column{flex-direction:column}.full{width:100%}.full-screen{max-width:100vw}.medium{font-size:2.4rem}.small{font-size:1.6rem}.scrollable{overflow-y:auto}.padding-left{padding-left:1rem}.padding-right{padding-right:1rem}.ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.flex-ellipsis{min-width:0}.relative{position:relative}.block{display:block}@media screen and (max-width:374px){.hide-xs{display:none}}@media screen and (max-width:599px){.hide-s{display:none}} \ No newline at end of file diff --git a/go.mod b/go.mod index f37d43bf..317f69d3 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/ViBiOh/auth/v2 v2.16.1 github.com/ViBiOh/exas v0.7.1 github.com/ViBiOh/flags v1.4.1 - github.com/ViBiOh/httputils/v4 v4.66.6 + github.com/ViBiOh/httputils/v4 v4.66.8 github.com/ViBiOh/vith v0.6.0 github.com/rabbitmq/amqp091-go v1.9.0 github.com/redis/go-redis/v9 v9.2.1 @@ -46,7 +46,7 @@ require ( github.com/redis/go-redis/extra/rediscmd/v9 v9.0.5 // indirect github.com/redis/go-redis/extra/redisotel/v9 v9.0.5 // indirect github.com/sirupsen/logrus v1.9.3 // indirect - github.com/tdewolff/minify/v2 v2.12.9 // indirect + github.com/tdewolff/minify/v2 v2.19.10 // indirect github.com/tdewolff/parse/v2 v2.6.8 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect go.opentelemetry.io/contrib/instrumentation/runtime v0.45.0 // indirect @@ -60,9 +60,9 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/term v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231009173412-8bfb1ae86b6c // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c // indirect - google.golang.org/grpc v1.58.3 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect ) diff --git a/go.sum b/go.sum index bcb600a1..8e1e3002 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ github.com/ViBiOh/exas v0.7.1 h1:nzh6E1668OFRgoTIJZJa1RybCW64Gd918qi0Z+0Q4WA= github.com/ViBiOh/exas v0.7.1/go.mod h1:MvIWQZXpWgg45Vsde9bMV48Kb0J8frya8vimmrkQ04E= github.com/ViBiOh/flags v1.4.1 h1:qEAO70rWTYcVlU9BgCuz0SgMjth12oi502cq3SHDudg= github.com/ViBiOh/flags v1.4.1/go.mod h1:Ocgx/QhY7WYNfGokFT3kw5C05pDooQyLbI/9ZWwylI4= -github.com/ViBiOh/httputils/v4 v4.66.6 h1:3z0MrNNNCBq3Ka4JEJi0tSMiKSDCYv8gcv74TxYLvz4= -github.com/ViBiOh/httputils/v4 v4.66.6/go.mod h1:DMjgz2/jp2IQc+EB9CiAZFAAq9v1Oo+rb8UcA7nPxSI= +github.com/ViBiOh/httputils/v4 v4.66.8 h1:a5UQCVgUB0iAwkR5B9fbvx9OLC2OHJuNwpalAs9YKR0= +github.com/ViBiOh/httputils/v4 v4.66.8/go.mod h1:7KTWHkVw50L+UG7XHK9mtPQpTHMPdDyWV0MY+cCNpqw= github.com/ViBiOh/vith v0.6.0 h1:bdLmwgqUEWi3ivShtAhtM9gOZlWQzvZi2Z5b0BRSB1U= github.com/ViBiOh/vith v0.6.0/go.mod h1:eRqtDU2uB8g85vll4spbnCV93DHyHNAYwXCMIBH1GuQ= github.com/bsm/ginkgo/v2 v2.7.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w= @@ -36,8 +36,8 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -99,8 +99,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/tdewolff/minify/v2 v2.12.9 h1:dvn5MtmuQ/DFMwqf5j8QhEVpPX6fi3WGImhv8RUB4zA= -github.com/tdewolff/minify/v2 v2.12.9/go.mod h1:qOqdlDfL+7v0/fyymB+OP497nIxJYSvX4MQWA8OoiXU= +github.com/tdewolff/minify/v2 v2.19.10 h1:79Z2DJ9p0zSBj2BxD5fyLkIwhhRZnWSOeK3C52ljAu4= +github.com/tdewolff/minify/v2 v2.19.10/go.mod h1:IX+vt5HNKc+RFIQj7aI4D6RQ9p41vjay9lGorpHNC34= github.com/tdewolff/parse/v2 v2.6.8 h1:mhNZXYCx//xG7Yq2e/kVLNZw4YfYmeHbhx+Zc0OvFMA= github.com/tdewolff/parse/v2 v2.6.8/go.mod h1:XHDhaU6IBgsryfdnpzUXBlT6leW/l25yrFBTEb4eIyM= github.com/tdewolff/test v1.0.9 h1:SswqJCmeN4B+9gEAi/5uqT0qpi1y2/2O47V/1hhGZT0= @@ -150,14 +150,14 @@ golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqvce95G3hIDCT5FeO3YUc6Q4Oe24L/+rNMxRk= -google.golang.org/genproto/googleapis/api v0.0.0-20231009173412-8bfb1ae86b6c h1:0RtEmmHjemvUXloH7+RuBSIw7n+GEHMOMY1CkGYnWq4= -google.golang.org/genproto/googleapis/api v0.0.0-20231009173412-8bfb1ae86b6c/go.mod h1:Wth13BrWMRN/G+guBLupKa6fslcWZv14R0ZKDRkNfY8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c h1:jHkCUWkseRf+W+edG5hMzr/Uh1xkDREY4caybAq4dpY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c/go.mod h1:4cYg8o5yUbm77w8ZX00LhMVNl/YVBFJRYWDc0uYWMs0= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a h1:fwgW9j3vHirt4ObdHoYNwuO24BEZjSzbh+zPaNWoiY8= +google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:EMfReVxb80Dq1hhioy0sOsY9jCE46YDgHlJ7fWVUWRE= +google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b h1:CIC2YMXmIhYw6evmhPxBKJ4fmLbOFtXQN/GV3XOZR8k= +google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:IBQ646DjkDkvUIsVq/cc03FUFQ9wbZu7yE396YcL870= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b h1:ZlWIi1wSK56/8hn4QcBp/j9M7Gt3U/3hZw3mC7vDICo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/pkg/mocks/redis_client.go b/pkg/mocks/redis_client.go index 7aae25ad..b50261ff 100644 --- a/pkg/mocks/redis_client.go +++ b/pkg/mocks/redis_client.go @@ -307,11 +307,11 @@ func (mr *RedisClientMockRecorder) StoreMany(arg0, arg1, arg2 any) *gomock.Call } // Subscribe mocks base method. -func (m *RedisClient) Subscribe(arg0 context.Context, arg1 string) (<-chan *redis.Message, func(context.Context) error) { +func (m *RedisClient) Subscribe(arg0 context.Context, arg1 string) (<-chan *redis.Message, func(context.Context)) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Subscribe", arg0, arg1) ret0, _ := ret[0].(<-chan *redis.Message) - ret1, _ := ret[1].(func(context.Context) error) + ret1, _ := ret[1].(func(context.Context)) return ret0, ret1 } diff --git a/pkg/share/share.go b/pkg/share/share.go index 45f9fdef..f6bbbacd 100644 --- a/pkg/share/share.go +++ b/pkg/share/share.go @@ -14,7 +14,6 @@ import ( "github.com/ViBiOh/fibr/pkg/exclusive" "github.com/ViBiOh/fibr/pkg/provider" "github.com/ViBiOh/flags" - "github.com/ViBiOh/httputils/v4/pkg/cntxt" "github.com/ViBiOh/httputils/v4/pkg/cron" "github.com/ViBiOh/httputils/v4/pkg/redis" ) @@ -98,14 +97,7 @@ func (s *Service) Start(ctx context.Context) { return } - unsubscribe := redis.SubscribeFor(ctx, s.redisClient, s.pubsubChannel, s.PubSubHandle) - defer func() { - slog.Info("Unsubscribing Share's PubSub...") - - if unsubscribeErr := unsubscribe(cntxt.WithoutDeadline(ctx)); unsubscribeErr != nil { - slog.Error("Share's unsubscribe", "err", unsubscribeErr) - } - }() + go redis.SubscribeFor(ctx, s.redisClient, s.pubsubChannel, s.PubSubHandle) purgeCron := cron.New().Each(time.Hour).OnError(func(err error) { slog.Error("purge shares", "err", err) diff --git a/pkg/webhook/webhook.go b/pkg/webhook/webhook.go index 17045964..a55e44a5 100644 --- a/pkg/webhook/webhook.go +++ b/pkg/webhook/webhook.go @@ -12,7 +12,6 @@ import ( "github.com/ViBiOh/fibr/pkg/provider" "github.com/ViBiOh/fibr/pkg/thumbnail" "github.com/ViBiOh/flags" - "github.com/ViBiOh/httputils/v4/pkg/cntxt" "github.com/ViBiOh/httputils/v4/pkg/redis" "github.com/ViBiOh/httputils/v4/pkg/renderer" "go.opentelemetry.io/otel/metric" @@ -97,16 +96,7 @@ func (s *Service) Start(ctx context.Context) { return } - unsubscribe := redis.SubscribeFor(ctx, s.redisClient, s.pubsubChannel, s.PubSubHandle) - defer func() { - slog.Info("Unsubscribing Webhook's PubSub...") - - if unsubscribeErr := unsubscribe(cntxt.WithoutDeadline(ctx)); unsubscribeErr != nil { - slog.Error("Webhook's unsubscribe", "err", unsubscribeErr) - } - }() - - <-ctx.Done() + redis.SubscribeFor(ctx, s.redisClient, s.pubsubChannel, s.PubSubHandle) } func (s *Service) loadWebhooks(ctx context.Context) error {