add rewriting
This commit is contained in:
parent
2dd59bed81
commit
f9894e18f6
3 changed files with 6 additions and 2 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -218,7 +218,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "starfig"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"native-tls",
|
||||
"packeteer",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "starfig"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
|
|
@ -4,6 +4,7 @@ use std::io::{BufRead, BufReader, Write};
|
|||
use std::net::{TcpListener, TcpStream};
|
||||
use std::string::{String};
|
||||
use std::io::{Read};
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use std::fs::File;
|
||||
use std::fs;
|
||||
|
@ -22,6 +23,9 @@ fn load_page(segments: Vec<String>) -> String {
|
|||
for v in segments {
|
||||
m = format!("{}/{}", m, v);
|
||||
}
|
||||
if Path::new(&m).is_dir() == true {
|
||||
m = format!("{}/index.gmi", m);
|
||||
}
|
||||
let page = fs::read_to_string(m);
|
||||
match page {
|
||||
Ok(i) => i.to_string(),
|
||||
|
|
Loading…
Reference in a new issue