update dependencies and add license
This commit is contained in:
parent
bc6cb56261
commit
e7d7e545a2
6 changed files with 42 additions and 42 deletions
|
@ -8,7 +8,7 @@ edition = "2021"
|
|||
[dependencies]
|
||||
dotenv = "0.15.0"
|
||||
rocket = { version = "0.5.0-rc.2", features = ["json", "secrets"] }
|
||||
rocket_cors = "0.5.2"
|
||||
rocket_cors = "0.6.0"
|
||||
rpassword = "7.2.0"
|
||||
serde = "1.0.152"
|
||||
serde_json = "1.0.93"
|
||||
|
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 unurled
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
21
README.MD
21
README.MD
|
@ -1,21 +0,0 @@
|
|||
# Text-display :)
|
||||
|
||||
havn't throught of any better name sooo...
|
||||
|
||||
making it working :
|
||||
- download nodejs
|
||||
- download or setup on cloud a mongodb database
|
||||
- add to mongodb an entry: (will be making a proper way to do it in the future maybe not so sure)
|
||||
```
|
||||
{
|
||||
"_id": {
|
||||
"$oid": "id generated uhm google it"
|
||||
},
|
||||
"name": "Username",
|
||||
"pass": "Password",
|
||||
"text": "text"
|
||||
}
|
||||
```
|
||||
- `cp .env.example .env` and change the values like you need.
|
||||
- `npm i`
|
||||
- `npm start`
|
8
README.md
Normal file
8
README.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Text-display :)
|
||||
|
||||
making it working :
|
||||
|
||||
- download [rust](https://www.rust-lang.org/)
|
||||
- modify `Rocket.toml` release section if you need
|
||||
- `cargo build --release`
|
||||
- launch target/release/text-display
|
|
@ -1,16 +1,16 @@
|
|||
use rocket;
|
||||
use rocket::fs::{relative, FileServer, NamedFile};
|
||||
use rocket::http::{Cookie, CookieJar, Status};
|
||||
use rocket::request::{FromRequest, Outcome};
|
||||
use rocket::serde::json::Json;
|
||||
use rocket::{routes, uri, Request};
|
||||
use rocket_cors::{AllowedHeaders, AllowedOrigins, Cors};
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use rocket;
|
||||
use rocket::fs::{FileServer, NamedFile, relative};
|
||||
use rocket::http::{CookieJar, Cookie, Status};
|
||||
use rocket::request::{FromRequest, Outcome};
|
||||
use rocket::{Request, routes, uri};
|
||||
use rocket_cors::{AllowedHeaders, AllowedOrigins, Cors};
|
||||
use rocket::serde::json::Json;
|
||||
|
||||
use crate::{data, file};
|
||||
use crate::data::deserialize;
|
||||
use crate::file::PATH;
|
||||
use crate::{data, file};
|
||||
|
||||
struct Token(String);
|
||||
|
||||
|
@ -36,7 +36,7 @@ impl<'r> FromRequest<'r> for Token {
|
|||
// check validity
|
||||
Outcome::Success(Token(token.to_string()))
|
||||
}
|
||||
None => Outcome::Failure((Status::Unauthorized, ApiTokenError::Missing)),
|
||||
None => Outcome::Error((Status::Unauthorized, ApiTokenError::Missing)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -1,19 +1,11 @@
|
|||
use dotenv::dotenv;
|
||||
use std::env;
|
||||
|
||||
mod data;
|
||||
mod file;
|
||||
pub mod hash;
|
||||
mod http_server;
|
||||
mod data;
|
||||
|
||||
use file::get_file;
|
||||
|
||||
fn main() {
|
||||
dotenv().ok();
|
||||
if env::var("URL").is_err() || env::var("PORT").is_err() {
|
||||
println!("Please set .env file, you can see an example in the file .env.example");
|
||||
return;
|
||||
}
|
||||
let _file = get_file();
|
||||
let res = http_server::main();
|
||||
if res.is_err() {
|
||||
|
|
Loading…
Reference in a new issue