slotmap = { version = "0.4", features = ['serde'] }
strum = { version = "0.20", features = ['derive'] }
thiserror = "1"
+tempfile = "3"
toml = "0.5"
typetag = "0.1.6"
uds = "0"
--- /dev/null
+To: {{ player_email }}
+Subject: Game access link {}
+
+Hi. A user on this Otter game server, with account
+ {{ account }}
+has invited you to join the game
+ {}
+
+You can play, directly, by visiting this link
+ {{ token_url }}
+
+They have set for you the nickname, within the game, of
+ {{ nick }}
+If you want that changing, please contact them.
+
+Regards.
--- /dev/null
+From: Otter game server on behalf of <{{ unix_user }}}>
+To: {{ player_email }}
+Subject: Game access link {{ name }}
+
+Hi. I'm inviting you to join the game
+ {{ game_name }}
+on this Otter server.
+
+You can play, directly, by visiting this link
+ {{ token_url }}
+
+I have set for you the nickname, within the game, of
+ {{ nick }}
+If you want that changing, please contact me.
+
+Regards.
--- /dev/null
+// Copyright 2020 Ian Jackson
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// There is NO WARRANTY.
+
+use parking_lot::Mutex;
+
+static TERA : Mutex<Option<State>> = const_mutex(None);
+
+pub fn template_render(name: &str) {
+ let guard = TERA.lock();
+ let tera =
+}
+
+struct State {
+ tera: tera::Tera;
+}
+
+impl Default for State {
+ fn default() -> State { State {
+ tera: tera::new(
+ } }
+}
+
+type TeraWrapper = RwLock<Arc<State>>;
+
+impl State {
+
+}
pub const DEFAULT_CONFIG_DIR : &str = "/etc/otter";
pub const DEFAULT_CONFIG_LEAFNAME : &str = "server.toml";
+pub const DEFAULT_SENDMAIL_PROGRAM : &str = "/usr/sbin/sendmail";
+
#[derive(Deserialize,Debug,Clone)]
pub struct ServerConfigSpec {
pub base_dir: Option<String>,
pub log: Option<toml::Value>,
pub bundled_sources: Option<String>,
pub shapelibs: Option<Vec<shapelib::Config1>>,
+ pub sendmail: Option<String>,
}
#[derive(Debug,Clone)]
pub log: LogSpecification,
pub bundled_sources: String,
pub shapelibs: Vec<shapelib::Config1>,
+ pub sendmail: String,
}
impl TryFrom<ServerConfigSpec> for ServerConfig {
pub use rocket_contrib::helmet::*;
pub use rocket_contrib::json::Json;
pub use rocket_contrib::templates::Template;
+pub use rocket_contrib::templates::Engines;
+pub use rocket_contrib::templates::tera::{self, Value};
pub use serde::ser::SerializeTuple;
pub use serde::{Serialize, Deserialize, de::DeserializeOwned};
pub use serde::{Serializer, Deserializer};
pub use strum::EnumString;
pub use thiserror::Error;
pub use vecdeque_stableix::Deque as StableIndexVecDeque;
-
pub use zcoord::{self, ZCoord};
pub use crate::accounts::*;
#[derive(Debug,Serialize,Deserialize)]
pub struct FixedToken { pub token: RawToken }
+#[derive(Debug,Serialize,Deserialize)]
+pub struct TokenByEmail {
+ /// RFC822 recipient field syntax (therefore, ASCII)
+ pub addr: Sring,
+}
+
#[derive(Debug,Serialize,Deserialize)]
pub struct UrlOnStdout;
}
}
+ #[typetag::serde]
+ impl PlayerAccessSpec for TokenByEmail {
+ #[throws(TDE)]
+ fn deliver<'t>(&self,
+ g: &Instance,
+ gpl: &GPlayerState,
+ ipl: &IPlayerState,
+ token: AccessTokenInfo)
+ -> AccessTokenReport {
+ let message = tempfile::tempfile()?;
+ let gname = &g.name;
+
+ match &ipl.account {
+ AS::Unix { user } => {
+
+ write!(&mut message, r#"\
+"#,
+ &self.addr, &gname,
+ &ipl.account, &gname,
+
+
+ write!(&mut message, r#"\
+! "#,
+ &self.addr, &gname,
+ &ipl.account, &gname,
+ let command = Command::new(&config().sendmail)
+ .args(&["-oee","-odb","-oi","--"])
+ .stdin(
+
+
+ AccessTokenReport { lines: todo!() }
+ }
+ }
+
impl TryFrom<&ColourSpec> for Colour {
type Error = SpecError;
#[throws(SpecError)]