Compare commits
2 Commits
52c949e396
...
60c24e3ee4
Author | SHA1 | Date | |
---|---|---|---|
|
60c24e3ee4 | ||
|
486001b584 |
@ -74,13 +74,16 @@ pub async fn connect_db() -> Result<SqlitePool, SetupError> {
|
|||||||
async fn setup(app: &mut App) -> Result<(), Box<dyn Error>> {
|
async fn setup(app: &mut App) -> Result<(), Box<dyn Error>> {
|
||||||
APP.set(app.handle()).unwrap();
|
APP.set(app.handle()).unwrap();
|
||||||
|
|
||||||
|
let is_first_launch = config::get_or_create_db_path()?.exists();
|
||||||
|
|
||||||
let pool = connect_db().await?;
|
let pool = connect_db().await?;
|
||||||
let conf = AppConfig::load(&pool).await?;
|
let conf = AppConfig::load(&pool).await?;
|
||||||
let session = Session::load(&pool).await?;
|
let session = Session::load(&pool).await?;
|
||||||
let srv = Server::new(conf.listen_addr, conf.listen_port, app.handle()).await?;
|
let srv = Server::new(conf.listen_addr, conf.listen_port, app.handle()).await?;
|
||||||
|
|
||||||
config::set_auto_launch(conf.start_on_login)?;
|
config::set_auto_launch(conf.start_on_login)?;
|
||||||
if !conf.start_minimized {
|
// if session is empty, this is probably the first launch, so don't autohide
|
||||||
|
if !conf.start_minimized || is_first_launch {
|
||||||
app.get_window("main")
|
app.get_window("main")
|
||||||
.ok_or(HandlerError::NoMainWindow)?
|
.ok_or(HandlerError::NoMainWindow)?
|
||||||
.show()?;
|
.show()?;
|
||||||
|
@ -57,8 +57,12 @@ where
|
|||||||
E: Error,
|
E: Error,
|
||||||
M: serde::ser::SerializeMap,
|
M: serde::ser::SerializeMap,
|
||||||
{
|
{
|
||||||
let src = err.source().map(|s| format!("{s}"));
|
let msg = err.source().map(|s| format!("{s}"));
|
||||||
map.serialize_entry("source", &src)
|
map.serialize_entry("msg", &msg)?;
|
||||||
|
map.serialize_entry("code", &None::<&str>)?;
|
||||||
|
map.serialize_entry("source", &None::<&str>)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,14 +39,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (e.code === "GetSession") {
|
window.error = e;
|
||||||
let root = getRootCause(e);
|
const root = getRootCause(e);
|
||||||
|
if (e.code === 'GetSession' && root.code) {
|
||||||
errorMsg = `Error response from AWS (${root.code}): ${root.msg}`;
|
errorMsg = `Error response from AWS (${root.code}): ${root.msg}`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
errorMsg = e.msg;
|
errorMsg = e.msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the alert already existed, shake it
|
||||||
if (alert) {
|
if (alert) {
|
||||||
alert.shake();
|
alert.shake();
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (e.code === 'GetSession') {
|
const root = getRootCause(e);
|
||||||
let root = getRootCause(e);
|
if (e.code === 'GetSession' && root.code) {
|
||||||
errorMsg = `Error response from AWS (${root.code}): ${root.msg}`;
|
errorMsg = `Error response from AWS (${root.code}): ${root.msg}`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user