From ff53449515731193b43978ae4c0893acf807505a Mon Sep 17 00:00:00 2001 From: subnub Date: Fri, 21 Feb 2025 14:20:07 -0500 Subject: [PATCH] disabled pwa --- src/api/filesAPI.ts | 19 ++++++------------- vite.config.ts | 15 ++++++++------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/api/filesAPI.ts b/src/api/filesAPI.ts index 47fb64b..4c58e3a 100644 --- a/src/api/filesAPI.ts +++ b/src/api/filesAPI.ts @@ -72,19 +72,12 @@ export const downloadFileAPI = async (fileID: string) => { const url = `${getBackendURL()}/file-service/download/${fileID}`; - window.location.href = "https://www.google.com/"; - - // if (!isPwa()) { - // const link = document.createElement("a"); - // document.body.appendChild(link); - // link.href = url; - // link.setAttribute("type", "hidden"); - // link.setAttribute("download", "true"); - // link.click(); - // } else { - // alert("PWA"); - // window.open(url); - // } + const link = document.createElement("a"); + document.body.appendChild(link); + link.href = url; + link.setAttribute("type", "hidden"); + link.setAttribute("download", "true"); + link.click(); }; export const getVideoTokenAPI = async () => { diff --git a/vite.config.ts b/vite.config.ts index 9d5f519..ce5feb8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,6 @@ import { defineConfig, loadEnv } from "vite"; import react from "@vitejs/plugin-react"; import { visualizer } from "rollup-plugin-visualizer"; -import { VitePWA } from "vite-plugin-pwa"; export default defineConfig(({ mode }) => { const env = loadEnv(mode, "./src/config/"); @@ -14,12 +13,14 @@ export default defineConfig(({ mode }) => { plugins: [ react(), visualizer(), - VitePWA({ - registerType: "autoUpdate", - workbox: { - navigateFallbackDenylist: [/^\/file-service\/download\//], - }, - }), + // Perhaps will be used in the future, currently lots of issues + // With downloading files on safari iOS PWA (who would have guessed) + // VitePWA({ + // registerType: "autoUpdate", + // workbox: { + // navigateFallbackDenylist: [/^\/file-service\/download\//], + // }, + // }), ], build: { outDir: "dist-frontend",