/* Create an interface for the rest of the library to use to fetch nessesary data. To do that, implement a termos config that will contain the table and db names, aswell as other relevant information - maybe a flag for headless mode (uses the built-in console frontend module - need to evaluate this idea more) */ export async function fetchFileSystem(ep: string = `/api/v1/filesystem`): Promise { // FUCK IT NO CACHE FOR NOW, IDB IS RETARDED const cacheETag = "suck my dick"; const cacheData = "no data here"; const headers: HeadersInit = {}; if (cacheETag) { headers["If-None-Match"] = cacheETag; } const response = await fetch(ep, { headers }); let json: string; if (response.status === 304 && cacheData) { json = cacheData; } else if (response.ok) { json = await response.text(); const newETag = response.headers.get("ETag"); // cache the json string here if (newETag) { // cache the new checksum (etag) here } } else { throw new Error(`Failed to load filesystem: ${response.status}`); } return json; } //export async function fetchUserGroups(ep: string = ): Promise {} //export async function fetchUsers(): Promise {}