chore: some upgrade
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Deploy to SFTP Server / build (push) Successful in 22m39s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Deploy to SFTP Server / build (push) Successful in 22m39s
				
			This commit is contained in:
		| @@ -23,27 +23,33 @@ export type MemoriumEntry = MemoriumFile | MemoriumDir; | ||||
| const SERVER_URL = "https://marka.max-richter.dev"; | ||||
| //const SERVER_URL = "http://localhost:8080"; | ||||
|  | ||||
| const cache = {}; | ||||
|  | ||||
| export async function listResource( | ||||
|   id: string, | ||||
| ): Promise<MemoriumEntry | undefined> { | ||||
|   const url = `${SERVER_URL}/resources/${id}`; | ||||
|   console.log(url); | ||||
|   if (cache[url]) return cache[url]; | ||||
|   try { | ||||
|     const response = await fetch(url, { signal: AbortSignal.timeout(5000) }); | ||||
|     if (response.ok) { | ||||
|       const json = await response.json(); | ||||
|       if (json.type == "dir") { | ||||
|         return { | ||||
|         const res = { | ||||
|           ...json, | ||||
|           content: json.content.filter((res: MemoriumEntry) => | ||||
|             res.mime === "application/markdown" | ||||
|           ), | ||||
|         }; | ||||
|         cache[url] = res; | ||||
|         return res; | ||||
|       } | ||||
|       cache[url] = json; | ||||
|       return json; | ||||
|     } | ||||
|   } catch (_e) { | ||||
|     console.log("Failed to get: ", url); | ||||
|     cache[url] = undefined; | ||||
|     return; | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user