mirror of
https://github.com/ivabus/hlssimple
synced 2024-11-21 23:55:08 +03:00
Include index.html in compile-time
This commit is contained in:
parent
acdf0d39f2
commit
df3e437b78
1 changed files with 3 additions and 4 deletions
|
@ -31,6 +31,8 @@ use rocket::response::content::RawHtml;
|
||||||
use std::fs::read_dir;
|
use std::fs::read_dir;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
const INDEX: &'static str = include_str!("../index.html");
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[command(author, version, about, long_about = None)]
|
#[command(author, version, about, long_about = None)]
|
||||||
struct Args {
|
struct Args {
|
||||||
|
@ -57,10 +59,7 @@ struct StreamURL {
|
||||||
fn index() -> RawHtml<String> {
|
fn index() -> RawHtml<String> {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
let dir = read_dir(args.streams_dir).unwrap();
|
let dir = read_dir(args.streams_dir).unwrap();
|
||||||
let mut res = match smurf::io::read_file_to_str(&PathBuf::from("./index.html")) {
|
let mut res = INDEX.to_string();
|
||||||
Some(s) => s,
|
|
||||||
None => String::new(),
|
|
||||||
};
|
|
||||||
let mut m3u8: Vec<StreamURL> = vec![];
|
let mut m3u8: Vec<StreamURL> = vec![];
|
||||||
for i in dir {
|
for i in dir {
|
||||||
let path = i.unwrap().path();
|
let path = i.unwrap().path();
|
||||||
|
|
Loading…
Reference in a new issue