feat: api data layer

This commit is contained in:
Ax333l
2022-10-29 19:32:04 +02:00
parent b71f722d66
commit b23e84043d
14 changed files with 283 additions and 65 deletions

View File

@ -1,10 +1,11 @@
<script>
import RouterEvents from '../../../data/RouterEvents';
export let href = '/';
export let is_selected = target_url => href === target_url;
</script>
<a data-sveltekit-prefetch {href}>
<li class:selected={href === $RouterEvents.target_url.pathname}>
<li class:selected={is_selected($RouterEvents.target_url.pathname)}>
<slot />
</li>
</a>

View File

@ -33,6 +33,7 @@
<Navigation href="/docs/">Docs</Navigation>
<Navigation href="/patches/">Patches</Navigation>
<Navigation href="/credits/">Credits</Navigation>
<Navigation href="/api-settings/">API Settings</Navigation>
</ul>
<div class="menu-btn" class:open={menuOpen} bind:this={menuBtn}>
<div class="menu-btn__burger" />

View File

@ -1,16 +1,8 @@
import { prerendering } from "$app/environment";
import { dev } from "$app/environment";
export function api_url(endpoint: string): string {
let url = `https://releases.revanced.app/${endpoint}`;
if (prerendering) {
url += '?cacheBypass=';
// Just add some random stuff to the string. Doesn't really matter what we add.
// This is here to make sure we bypass the cache while prerendering.
for (let i = 0; i < 6; i++) {
url += Math.floor(Math.random() * 10).toString();
}
// console.log, but only if in dev environment.
export function dev_log(part: string, ...args) {
if (dev) {
console.log(`[${part}]:`, ...args);
}
return url;
}