Final push before rewrite

This commit is contained in:
Jai A
2020-06-28 13:53:03 -07:00
parent d1efd62e7b
commit 1ff2a08d19
5 changed files with 34 additions and 28 deletions

View File

@@ -1,6 +1,5 @@
# Fabricate
# Labrinth
Welcome to Fabricate (the temporary name I'm calling this until I come up with a good one)! This is an open source work
in progress mod distribution site.
This is the API backend for Modrinth!
More information coming soon.
Documentation coming soon.

View File

@@ -1,5 +1,13 @@
use actix_web::{get, web, HttpResponse};
use actix_web::{get, post, web, HttpResponse};
use handlebars::*;
use serde::Deserialize;
#[derive(Deserialize)]
struct CreatedMod {
name: String,
description: String,
body: String,
}
#[get("createmod")]
pub async fn mod_create_get(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
@@ -8,5 +16,15 @@ pub async fn mod_create_get(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
});
let body = hb.render("mod-create", &data).unwrap();
HttpResponse::Ok().body(body)
}
#[post("createmod")]
pub async fn mod_create_post(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
let data = json!({
"name": "Handlebars"
});
let body = hb.render("mod-create", &data).unwrap();
HttpResponse::Ok().body(body)
}

View File

@@ -57,31 +57,11 @@
@media (prefers-color-scheme: dark) {
[data-theme="light"] {
--background: #f3f2f0;
--highlight: #0b75d8;
--border: #a9a9a9;
--mod-bar: #fefefe;
--content-background: white;
--nav-background: #dfdfdf;
--content-text: black;
--header-text: black;
--white-text: white;
--muted: gray;
--forge-color: #1e2d44;
}
:root, [data-theme="dark"] {
--background: #1b1b1b;
--highlight: #0b75d8;
--border: #1d1d1d;
--mod-bar: #222222;
--content-background: rgb(34, 34, 34);
--nav-background: #252525;
--content-text: rgb(241, 241, 241);
--header-text: rgb(241, 241, 241);
--white-text: white;
--muted: gray;
--forge-color: white;
}
}

View File

@@ -4,6 +4,13 @@ window.onload = function () {
}
}
function switchThemes() {
let switchTheme = localStorage.getItem("data-theme") === "light" ? "dark" : "light";
localStorage.setItem("data-theme", switchTheme);
document.documentElement.setAttribute("data-theme", switchTheme);
}
function closePopup(e) {
e.parentElement.outerHTML = "";
}

View File

@@ -26,6 +26,7 @@
<a href="mods">mods</a>
<a href="modpacks">modpacks</a>
<a href="about">about</a>
<input type="checkbox" onchange="switchThemes()">
</div>
</header>
@@ -150,7 +151,8 @@
<div class="version-scroll" id="releases" style="display: none">
</div>
</div>
</div> <script src="/static/js/main.js"></script>
<div class="version-type">
<p class="version-type-label" onclick="toggleVisibility(this)">[+] Snapshots</p>