-- Leo's gemini proxy
-- Connecting to typed-hole.org:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
commit e0159f7a47c0851474923bca14bc5a43726e6b78
Author: Julien Blanchard <julien@typed-hole.org>
Date: Tue Apr 21 10:11:48 2020 +0200
Add start_url setting
diff --git a/README.md b/README.md
index 3c23ee5..7d59d30 100644
--- a/README.md
+++ b/README.md
@@ -47,13 +47,16 @@ You will need some development libraries:
- Open Castor and visit gemini://gemini.circumlunar.space and enjoy your trip!
-## Changing colors
+## Changing settings
-You can change colors and delimiters for Headers, Lists, Text and Background.
+You can change some settings like initial URL, colors and delimiters for Headers, Lists, Text and Background.
Edit `~/.local/share/castor_settings.toml` and add the values you need.
These are the keys currently supported, you can use hex codes, plain colors names or even emojis!
```
+[general]
+start_url = "gemini://gemini.circumlunar.space/capcom"
+
[colors]
h1 = "red"
h2 = "#FF6347"
diff --git a/data/castor_settings.toml.example b/data/castor_settings.toml.example
index efe6473..f77fc3e 100644
--- a/data/castor_settings.toml.example
+++ b/data/castor_settings.toml.example
@@ -1,3 +1,6 @@
+[general]
+start_url = "gemini://gemini.circumlunar.space/capcom"
+
[colors]
h1 = "red"
h2 = "#FF6347"
diff --git a/src/main.rs b/src/main.rs
index a9d44a7..dcf84f0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,7 +4,6 @@ extern crate gtk;
extern crate lazy_static;
-use std::env;
use std::str::FromStr;
use std::sync::Arc;
@@ -85,11 +84,10 @@ fn main() {
});
}
- // Visit URL if one was provided
- let args: Vec<String> = env::args().collect();
- if args.len() > 1 {
- let url = String::from(&args[1]);
- route_url(&gui, url)
+ // Visit start URL setting if provided
+ match settings::start_url() {
+ Some(url) => route_url(&gui, url),
+ None => ()
}
gui.start();
diff --git a/src/settings.rs b/src/settings.rs
index 4b395c0..aecddac 100644
--- a/src/settings.rs
+++ b/src/settings.rs
@@ -8,11 +8,17 @@ use serde_derive::Deserialize;
struct Settings {
+ general: Option<General>,
colors: Option<Color>,
characters: Option<Character>,
}
+struct General {
+ start_url: Option<String>,
+}
+
+#[derive(Deserialize)]
struct Color {
h1: Option<String>,
h2: Option<String>,
@@ -30,6 +36,13 @@ struct Character {
list: Option<String>,
}
+pub fn start_url() -> Option<String> {
+ match read().general {
+ Some(general) => general.start_url,
+ None => None
+ }
+}
+
pub fn h1_color() -> String {
match read().colors {
Some(colors) => match colors.h1 {
---
Served by Pollux Gemini Server.
-- Response ended
-- Page fetched on Mon May 27 20:27:39 2024