remembered that versioning exist
All checks were successful
build_test / build (push) Successful in 2m30s

This commit is contained in:
PoliEcho 2025-06-03 13:52:32 +02:00
parent 00f261696f
commit e6961d6d6d
3 changed files with 42 additions and 30 deletions

View File

@ -3,7 +3,7 @@
#ifndef NAME #ifndef NAME
#define NAME "ParaDocs" #define NAME "ParaDocs"
#define VERSION "0.0.1" #define VERSION "1.0.0"
inline constexpr auto hash_djb2a(const std::string_view sv) { inline constexpr auto hash_djb2a(const std::string_view sv) {
unsigned long hash{5381}; unsigned long hash{5381};

View File

@ -27,7 +27,7 @@ void PrintHelp() {
} }
void PrintVersion() { void PrintVersion() {
std::cout << NAME << loc_strings->version << ": " << VERSION << "\n"; std::cout << NAME << " " << loc_strings->version << ": " << VERSION << "\n";
exit(0); exit(0);
} }

View File

@ -19,7 +19,6 @@
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <limits>
#include <menu.h> #include <menu.h>
#include <ncurses.h> #include <ncurses.h>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
@ -84,12 +83,14 @@ void reload_menu_from_directory(complete_menu &main_menu) {
for (uint8_t i = 0; i < ARRAY_SIZE(name_date); i++) { for (uint8_t i = 0; i < ARRAY_SIZE(name_date); i++) {
std::getline(ssfn, name_date[i], '_'); std::getline(ssfn, name_date[i], '_');
} }
try {
json complaint_json = json::parse(file); json complaint_json = json::parse(file);
if (complaint_json["status"].is_null() || if (complaint_json["status"].is_null() ||
complaint_json["status"].get<uint8_t>() >= STATUS_COUNT) { complaint_json["status"].get<uint8_t>() >= STATUS_COUNT) {
std::cerr << "Invalid status in file: " std::cerr << "Invalid status in file: "
<< directroy_entry.path().filename().string() << std::endl; << directroy_entry.path().filename().string()
<< std::endl;
safe_exit(EINVAL); safe_exit(EINVAL);
} }
@ -97,6 +98,9 @@ void reload_menu_from_directory(complete_menu &main_menu) {
name_date[1].append( name_date[1].append(
loc_strings loc_strings
->status_strings[complaint_json["status"].get<uint8_t>()]); ->status_strings[complaint_json["status"].get<uint8_t>()]);
} catch (...) {
continue;
}
char *name = new char[name_date[0].length() + 1]; char *name = new char[name_date[0].length() + 1];
main_menu_allocated.push_back({GENERIC_TYPE, name, 1}); main_menu_allocated.push_back({GENERIC_TYPE, name, 1});
@ -162,6 +166,7 @@ void menu() {
for (uint8_t i = 0; i < ARRAY_SIZE(name_date); i++) { for (uint8_t i = 0; i < ARRAY_SIZE(name_date); i++) {
std::getline(ssfn, name_date[i], '_'); std::getline(ssfn, name_date[i], '_');
} }
try {
json complaint_json = json::parse(file); json complaint_json = json::parse(file);
if (complaint_json["status"].is_null() || if (complaint_json["status"].is_null() ||
complaint_json["status"].get<size_t>() >= STATUS_COUNT) { complaint_json["status"].get<size_t>() >= STATUS_COUNT) {
@ -174,6 +179,9 @@ void menu() {
name_date[1].append( name_date[1].append(
loc_strings loc_strings
->status_strings[complaint_json["status"].get<uint8_t>()]); ->status_strings[complaint_json["status"].get<uint8_t>()]);
} catch (...) {
continue;
}
char *name = new char[name_date[0].length() + 1]; char *name = new char[name_date[0].length() + 1];
main_menu_allocated.push_back({GENERIC_TYPE, name, 1}); main_menu_allocated.push_back({GENERIC_TYPE, name, 1});
@ -252,11 +260,15 @@ void menu() {
<< "\n"; << "\n";
exit(EINVAL); exit(EINVAL);
} }
try {
json selected_file_json = json::parse(selected_file); json selected_file_json = json::parse(selected_file);
printDocument(selected_file_json["complaint_text"].get<std::string>()); printDocument(
selected_file_json["complaint_text"].get<std::string>());
current_allocated = &main_menu_allocated; current_allocated = &main_menu_allocated;
} catch (...) {
safe_exit(EINVAL);
}
break; break;
} }
case "easy_edit"_sh: case "easy_edit"_sh: