mirror of
https://github.com/Tim-Paik/srv.git
synced 2024-10-13 00:29:43 +00:00
Compare commits
3 Commits
v0.8.1-bet
...
v1.0.0-rc.
Author | SHA1 | Date | |
---|---|---|---|
d59a3fc4a5 | |||
8db0f82d08 | |||
e407395080 |
36
.github/workflows/release.yml
vendored
36
.github/workflows/release.yml
vendored
@ -14,8 +14,14 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
upload-assets-linux:
|
upload-assets:
|
||||||
runs-on: ubuntu-latest
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- macos-latest
|
||||||
|
- windows-latest
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: taiki-e/upload-rust-binary-action@v1
|
- uses: taiki-e/upload-rust-binary-action@v1
|
||||||
@ -25,29 +31,3 @@ jobs:
|
|||||||
zip: windows
|
zip: windows
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
upload-assets-macos:
|
|
||||||
runs-on: macos-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: taiki-e/upload-rust-binary-action@v1
|
|
||||||
with:
|
|
||||||
bin: web
|
|
||||||
tar: unix
|
|
||||||
zip: windows
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
upload-assets-windows:
|
|
||||||
runs-on: windows-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
# - run: vcpkg integrate install
|
|
||||||
# - run: vcpkg install openssl:x64-windows-static-md
|
|
||||||
- uses: taiki-e/upload-rust-binary-action@v1
|
|
||||||
with:
|
|
||||||
bin: web
|
|
||||||
tar: unix
|
|
||||||
zip: windows
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2488,7 +2488,7 @@ checksum = "acdb075a845574a1fa5f09fd77e43f7747599301ea3417a9fbffdeedfc1f4a29"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web"
|
name = "web"
|
||||||
version = "0.8.1-beta"
|
version = "1.0.0-rc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-files",
|
"actix-files",
|
||||||
"actix-http",
|
"actix-http",
|
||||||
|
@ -3,7 +3,7 @@ authors = ["Tim_Paik <timpaikc@outlook.com>"]
|
|||||||
description = "simple http server written in rust"
|
description = "simple http server written in rust"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
name = "web"
|
name = "web"
|
||||||
version = "0.8.1-beta"
|
version = "1.0.0-rc"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-files = "0.5"
|
actix-files = "0.5"
|
||||||
|
14
src/main.rs
14
src/main.rs
@ -492,7 +492,13 @@ async fn main() -> std::io::Result<()> {
|
|||||||
std::process::Command::new("explorer").arg(url).spawn().ok();
|
std::process::Command::new("explorer").arg(url).spawn().ok();
|
||||||
} else if cfg!(target_os = "macos") {
|
} else if cfg!(target_os = "macos") {
|
||||||
std::process::Command::new("open").arg(url).spawn().ok();
|
std::process::Command::new("open").arg(url).spawn().ok();
|
||||||
} else if cfg!(target_os = "linux") {
|
} else if cfg!(target_os = "linux")
|
||||||
|
|| cfg!(target_os = "android")
|
||||||
|
|| cfg!(target_os = "freebsd")
|
||||||
|
|| cfg!(target_os = "dragonfly")
|
||||||
|
|| cfg!(target_os = "openbsd")
|
||||||
|
|| cfg!(target_os = "netbsd")
|
||||||
|
{
|
||||||
std::process::Command::new("xdg-open").arg(url).spawn().ok();
|
std::process::Command::new("xdg-open").arg(url).spawn().ok();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -572,7 +578,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if data.starts_with("[ERROR]") {
|
if data.starts_with("[ERROR]") || data.starts_with("TLS alert") {
|
||||||
writeln!(buf, "\r{}", red.value(data))
|
writeln!(buf, "\r{}", red.value(data))
|
||||||
} else {
|
} else {
|
||||||
writeln!(buf, "\r{}", green.value(data))
|
writeln!(buf, "\r{}", green.value(data))
|
||||||
@ -581,7 +587,6 @@ async fn main() -> std::io::Result<()> {
|
|||||||
.init();
|
.init();
|
||||||
|
|
||||||
let addr = if let Some(matches) = matches.subcommand_matches("doc") {
|
let addr = if let Some(matches) = matches.subcommand_matches("doc") {
|
||||||
info!("[INFO] Generating document (may take a while)");
|
|
||||||
let mut cargo_toml = match std::fs::File::open("./Cargo.toml") {
|
let mut cargo_toml = match std::fs::File::open("./Cargo.toml") {
|
||||||
Ok(file) => file,
|
Ok(file) => file,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
@ -605,6 +610,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
let crate_name = contents.package.name;
|
let crate_name = contents.package.name;
|
||||||
|
info!("[INFO] Generating document (may take a while)");
|
||||||
match std::process::Command::new("cargo").arg("doc").output() {
|
match std::process::Command::new("cargo").arg("doc").output() {
|
||||||
Ok(output) => {
|
Ok(output) => {
|
||||||
let output = std::str::from_utf8(&output.stderr).unwrap_or("");
|
let output = std::str::from_utf8(&output.stderr).unwrap_or("");
|
||||||
@ -745,7 +751,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
);
|
);
|
||||||
let mut config = rustls::ServerConfig::new(rustls::NoClientAuth::new());
|
let mut config = rustls::ServerConfig::new(rustls::NoClientAuth::new());
|
||||||
let cert_chain = rustls::internal::pemfile::certs(cert).unwrap();
|
let cert_chain = rustls::internal::pemfile::certs(cert).unwrap();
|
||||||
let mut keys = rustls::internal::pemfile::rsa_private_keys(key).unwrap();
|
let mut keys = rustls::internal::pemfile::pkcs8_private_keys(key).unwrap();
|
||||||
config.set_single_cert(cert_chain, keys.remove(0)).unwrap();
|
config.set_single_cert(cert_chain, keys.remove(0)).unwrap();
|
||||||
server.bind_rustls(addr, config)
|
server.bind_rustls(addr, config)
|
||||||
} else {
|
} else {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#header,
|
#header,
|
||||||
#meta,
|
#meta,
|
||||||
#listing {
|
#listing {
|
||||||
|
font-family: sans-serif;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
@ -131,22 +132,37 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
html {
|
|
||||||
color: #444444;
|
html,
|
||||||
filter: invert(1);
|
body,
|
||||||
|
#header,
|
||||||
|
#meta,
|
||||||
|
#listing {
|
||||||
|
color: #cacaca;
|
||||||
|
background: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
#listing a span {
|
#header nav span a {
|
||||||
filter: invert(1);
|
color: #cacaca;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header {
|
||||||
|
padding: 1.5rem 5% 1rem;
|
||||||
|
background-color: #0e0e0e;
|
||||||
|
}
|
||||||
|
|
||||||
|
#listing table {
|
||||||
|
border-top: 1px dashed #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
#listing th,
|
||||||
|
#listing td {
|
||||||
|
border-bottom: 1px dashed #999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
#listing .goup svg,
|
#listing .goup svg,
|
||||||
#listing .file svg {
|
#listing .file svg {
|
||||||
fill: #444444;
|
fill: #cacaca;
|
||||||
}
|
|
||||||
|
|
||||||
#listing .dir svg {
|
|
||||||
filter: invert(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#header a,
|
#header a,
|
||||||
|
Reference in New Issue
Block a user