Compare commits

..

No commits in common. "791988d1f901b46f511f51d05557f7eba43e7dd9" and "600a4a48b88638f5b1a81102e2b9e569d8f89183" have entirely different histories.

6 changed files with 5 additions and 9 deletions

View File

@ -1,7 +1,7 @@
<script lang="ts">
import {Button, Spinner} from 'flowbite-svelte';
import {Download} from 'carbon-icons-svelte';
import {api, download, rpc, token, workingWrapperR} from '../store';
import {api, rpc, token, workingWrapperR} from '../store';
import {onDestroy} from 'svelte';
export let node: api.Node;
@ -38,7 +38,7 @@
onDestroy(() => { if (src.startsWith('blob')) URL.revokeObjectURL(src); });
</script>
<Button class="w-full mb-6" on:click={() => download($token ?? '', [node])}><Download />Download</Button>
<Button class="w-full mb-6"><Download />Download</Button>
{#if can_display && !loading && src === ''}
<Button class="w-full" outline on:click={load}>Load</Button>
{:else if loading}

View File

@ -48,7 +48,7 @@ struct Token {
};
struct Config {
std::string smtp_host, smtp_user, smtp_pass, smtp_from, admin_mail;
std::string smtp_host, smtp_user, smtp_pass, smtp_from, admin_mail; // TODO: Send mail to admin on crash
std::uint16_t smtp_port, server_port;
};

View File

@ -17,6 +17,7 @@ SaveNode load_node(const rapidjson::Value &doc) {
ASSIGN_MEMBER(node->id, id, Uint64);
id = node->id;
data_logger->debug("Loading node {}", id);
ASSIGN_MEMBER(node->name, name, String);
ASSIGN_MEMBER(node->file, file, Bool);

View File

@ -21,7 +21,6 @@ void signal_shutdown(const int) {
}
int main() {
// TODO add current timestamp to log name
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>("log.txt");
spdlog::default_logger()->sinks().push_back(file_sink);
spdlog::set_level(spdlog::level::trace);

View File

@ -58,9 +58,7 @@ static const std::unordered_map<std::string, std::string> mime_type_map = {
static const std::string& get_mime_type(const std::filesystem::path &filename) {
static const std::string octet = "application/octet-stream";
std::string ext = filename.extension();
std::transform(ext.begin(), ext.end(), ext.begin(), [](auto c) { return std::tolower(c); });
const auto &entry = mime_type_map.find(ext);
const auto &entry = mime_type_map.find(filename.extension());
if (entry != mime_type_map.end())
return entry->second;
else

View File

@ -5,11 +5,9 @@
#include <spdlog/spdlog.h>
// TODO implement backtrace
// TODO Send mail to admin on crash
[[noreturn]]
static void crash(std::source_location loc = std::source_location::current()) {
spdlog::critical("crash called from: {}:{} `{}`", loc.file_name(), loc.line(), loc.function_name());
spdlog::details::registry::instance().flush_all();
spdlog::shutdown();
std::abort();
}