Compare commits
No commits in common. "65259ce6cd905ea2da5766c9297d60a4a16acd99" and "a89443a4c85c0cf0fbfffeab53eb0f6016cff264" have entirely different histories.
65259ce6cd
...
a89443a4c8
5 changed files with 19 additions and 84 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -358,7 +358,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bunbun"
|
name = "bunbun"
|
||||||
version = "0.1.1"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"actix-web 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"handlebars 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"handlebars 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "bunbun"
|
name = "bunbun"
|
||||||
version = "0.1.1"
|
version = "0.1.0"
|
||||||
authors = ["Edward Shen <code@eddie.sh>"]
|
authors = ["Edward Shen <code@eddie.sh>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Re-implementation of bunny1 in Rust"
|
description = "Re-implementation of bunny1 in Rust"
|
||||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -91,15 +91,7 @@ fn hop(data: Data<Arc<State>>, query: Query<SearchQuery>) -> impl Responder {
|
||||||
|
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
fn index(data: Data<Arc<State>>) -> impl Responder {
|
fn index(data: Data<Arc<State>>) -> impl Responder {
|
||||||
let mut template_args = HashMap::new();
|
HttpResponse::Ok().body(data.renderer.read().unwrap().render("index", &()).unwrap())
|
||||||
template_args.insert("hostname", &data.public_address);
|
|
||||||
HttpResponse::Ok().body(
|
|
||||||
data.renderer
|
|
||||||
.read()
|
|
||||||
.unwrap()
|
|
||||||
.render("index", &template_args)
|
|
||||||
.unwrap(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/bunbunsearch.xml")]
|
#[get("/bunbunsearch.xml")]
|
||||||
|
|
|
@ -1,52 +1,12 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Bunbun</title>
|
<link rel="search"
|
||||||
<style type="text/css">
|
type="application/opensearchdescription+xml"
|
||||||
body {
|
title="bunbun"
|
||||||
display: flex;
|
href="bunbunsearch.xml">
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
background-color: #212121;
|
|
||||||
color: #fff;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
|
||||||
}
|
|
||||||
h1, p { margin: 0; }
|
|
||||||
main { display: flex; }
|
|
||||||
a { color: white; }
|
|
||||||
</style>
|
|
||||||
<link rel="search"
|
|
||||||
type="application/opensearchdescription+xml"
|
|
||||||
title="bunbun"
|
|
||||||
href="bunbunsearch.xml">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Bunbun</h1>
|
hello world
|
||||||
<p>Thanks for installing bunbun! To setup bunbun for your web browser, follow these steps:</p>
|
|
||||||
<main>
|
|
||||||
<section>
|
|
||||||
<h2>Firefox</h2>
|
|
||||||
<ol>
|
|
||||||
<li>
|
|
||||||
Click the following button:
|
|
||||||
<button onclick="window.external.AddSearchProvider('http://{{hostname}}/bunbunsearch.xml')">
|
|
||||||
Add search engine
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
<li>Type in "about:preferences#search" in the address bar and hit Enter.</li>
|
|
||||||
<li>Set your default search engine to bunbun.</li>
|
|
||||||
</ol>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<h2>Chrome</h2>
|
|
||||||
<ol>
|
|
||||||
<li>Type in "chrome://settings/search" in the address bar and hit Enter.</li>
|
|
||||||
<li>Select "Manage search engines"</li>
|
|
||||||
<li>Search for "bunbun"</li>
|
|
||||||
<li>Select the three dots on the bunbun entry, and select "Make default"</li>
|
|
||||||
</ol>
|
|
||||||
</section>
|
|
||||||
</main>
|
|
||||||
<p>To view a full list of commands, check out the <a href="/ls">command list</a>.</p>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,31 +1,14 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<body>
|
||||||
<title>Bunbun Command List</title>
|
<table>
|
||||||
<style type="text/css">
|
<tr>
|
||||||
body {
|
<th>Shortcut</th>
|
||||||
display: flex;
|
<th>Target</th>
|
||||||
flex-direction: column;
|
</tr>
|
||||||
align-items: center;
|
{{#each this}}
|
||||||
background-color: #212121;
|
<tr><td>{{@key}}</td><td>{{this}}</td></tr>
|
||||||
color: #fff;
|
{{/each}}
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
</table>
|
||||||
}
|
</body>
|
||||||
h1, p { margin: 0; }
|
|
||||||
table { margin-top: 1em; }
|
|
||||||
td, th { padding: 0 0.5em; }
|
|
||||||
.shortcut { text-align: right; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Bunbun Command List</h1>
|
|
||||||
<p><em>To edit this list, edit your <code>bunbun.toml</code> file.</em></p>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>Shortcut</th>
|
|
||||||
<th>Target</th>
|
|
||||||
</tr>
|
|
||||||
{{#each this}}<tr><td class="shortcut">{{@key}}</td><td class="target">{{this}}</td></tr>{{/each}}
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue