diff --git a/src/lib/sdk/project.ts b/src/lib/sdk/project.ts
new file mode 100644
index 000000000..35a5ac9fe
--- /dev/null
+++ b/src/lib/sdk/project.ts
@@ -0,0 +1,31 @@
+import type { Models, Payload } from '@aw-labs/appwrite-console';
+import { Service } from './service';
+
+export class Project extends Service {
+ /**
+ * Get usage stats for a project
+ *
+ *
+ * @param {string} range
+ * @throws {AppwriteException}
+ * @returns {Promise}
+ */
+ async getUsage(range?: string): Promise
{
+ const path = '/project/usage';
+ const payload: Payload = {};
+
+ if (typeof range !== 'undefined') {
+ payload['range'] = range;
+ }
+
+ const uri = new URL(this.client.config.endpoint + path);
+ return await this.client.call(
+ 'get',
+ uri,
+ {
+ 'content-type': 'application/json'
+ },
+ payload
+ );
+ }
+}
diff --git a/src/lib/sdk/service.ts b/src/lib/sdk/service.ts
new file mode 100644
index 000000000..eb63e5771
--- /dev/null
+++ b/src/lib/sdk/service.ts
@@ -0,0 +1,28 @@
+import type { Client, Payload } from '@aw-labs/appwrite-console';
+
+export class Service {
+ static CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
+
+ client: Client;
+
+ constructor(client: Client) {
+ this.client = client;
+ }
+
+ static flatten(data: Payload, prefix = ''): Payload {
+ let output: Payload = {};
+
+ for (const key in data) {
+ const value = data[key];
+ const finalKey = prefix ? `${prefix}[${key}]` : key;
+
+ if (Array.isArray(value)) {
+ output = Object.assign(output, this.flatten(value, finalKey));
+ } else {
+ output[finalKey] = value;
+ }
+ }
+
+ return output;
+ }
+}
diff --git a/src/lib/stores/sdk.ts b/src/lib/stores/sdk.ts
index ec05508fc..e01f0d655 100644
--- a/src/lib/stores/sdk.ts
+++ b/src/lib/stores/sdk.ts
@@ -1,3 +1,4 @@
+import { Project } from '$lib/sdk/project';
import { VARS } from '$lib/system';
import {
Account,
@@ -42,10 +43,10 @@ const sdkForProject = {
functions: new Functions(clientProject),
health: new Health(clientProject),
locale: new Locale(clientProject),
- projects: new Projects(clientProject),
+ project: new Project(clientProject),
storage: new Storage(clientProject),
teams: new Teams(clientProject),
users: new Users(clientProject)
};
-export { sdkForConsole, sdkForProject, setProject };
+export { sdkForConsole, sdkForProject, setProject, endpoint };
diff --git a/src/lib/system.ts b/src/lib/system.ts
index fc00cbd8e..596e4faca 100644
--- a/src/lib/system.ts
+++ b/src/lib/system.ts
@@ -21,3 +21,5 @@ export const ENV = {
};
export const MODE = VARS.CONSOLE_MODE === Mode.CLOUD ? Mode.CLOUD : Mode.SELF_HOSTED;
+export const isCloud = MODE === Mode.CLOUD;
+export const isSelfHosted = MODE === Mode.SELF_HOSTED;
diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte
new file mode 100644
index 000000000..4e9d8e540
--- /dev/null
+++ b/src/routes/+error.svelte
@@ -0,0 +1,12 @@
+
+
+
+ {$page.status}
+ {$page.error.message}
+ Back to the console
+
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 97d2b07a7..73031b18a 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -59,7 +59,7 @@
}
loading.set(false);
} else {
- if (acceptedRoutes.includes($page.url.pathname)) {
+ if (acceptedRoutes.some((n) => $page.url.pathname.startsWith(n))) {
await goto(`${base}${$page.url.pathname}${$page.url.search}`);
} else {
await goto(`${base}/login`, {
diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts
index e8ec15b77..aad16fd59 100644
--- a/src/routes/+layout.ts
+++ b/src/routes/+layout.ts
@@ -28,7 +28,7 @@ export const load: LayoutLoad = async ({ depends, url }) => {
'/auth/oauth2/failure'
];
- if (!acceptedRoutes.includes(url.pathname)) {
+ if (!acceptedRoutes.some((n) => url.pathname.startsWith(n))) {
throw redirect(303, '/login');
}
}
diff --git a/src/routes/console/project-[project]/functions/function-[function]/usage/[[period]]/+page.svelte b/src/routes/console/project-[project]/functions/function-[function]/usage/[[period]]/+page.svelte
index 98d3effb8..3ab991246 100644
--- a/src/routes/console/project-[project]/functions/function-[function]/usage/[[period]]/+page.svelte
+++ b/src/routes/console/project-[project]/functions/function-[function]/usage/[[period]]/+page.svelte
@@ -1,7 +1,7 @@
+
+
+ Sign up - Appwrite
+
+
+
+ {title}
+
+
+
+
+
+
+ Already got an account? Sign in
+
+
+
+
diff --git a/src/routes/register/invite/[slug]/mlh-dark.svg b/src/routes/register/invite/[slug]/mlh-dark.svg
new file mode 100644
index 000000000..4ad7517de
--- /dev/null
+++ b/src/routes/register/invite/[slug]/mlh-dark.svg
@@ -0,0 +1,293 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/routes/register/invite/[slug]/mlh-light.svg b/src/routes/register/invite/[slug]/mlh-light.svg
new file mode 100644
index 000000000..2b6aab33b
--- /dev/null
+++ b/src/routes/register/invite/[slug]/mlh-light.svg
@@ -0,0 +1,284 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file