Compare commits
3 Commits
29fd7567e8
...
1.0.3
Author | SHA1 | Date | |
---|---|---|---|
1781318fdf | |||
2560962684 | |||
dc3704f13b |
@@ -30,7 +30,7 @@ pub async fn create_bucket_if_required() -> anyhow::Result<()> {
|
|||||||
log::warn!("The bucket does not seem to exists, trying to create it!")
|
log::warn!("The bucket does not seem to exists, trying to create it!")
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::error!("Got unexpected error when querying bucket info: {}", e);
|
log::error!("Got unexpected error when querying bucket info: {e}");
|
||||||
return Err(BucketServiceError::FailedFetchBucketInfo.into());
|
return Err(BucketServiceError::FailedFetchBucketInfo.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,7 @@ impl FromRequest for AccountInPath {
|
|||||||
Self::load_account_from_path(&auth, account_id)
|
Self::load_account_from_path(&auth, account_id)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
log::error!("Failed to extract account ID from URL! {}", e);
|
log::error!("Failed to extract account ID from URL! {e}");
|
||||||
actix_web::error::ErrorNotFound("Could not fetch account information!")
|
actix_web::error::ErrorNotFound("Could not fetch account information!")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@@ -165,13 +165,13 @@ impl FromRequest for AuthExtractor {
|
|||||||
// Update last use (if needed)
|
// Update last use (if needed)
|
||||||
if token.shall_update_time_used() {
|
if token.shall_update_time_used() {
|
||||||
if let Err(e) = tokens_service::update_time_used(&token).await {
|
if let Err(e) = tokens_service::update_time_used(&token).await {
|
||||||
log::error!("Failed to refresh last usage of token! {}", e);
|
log::error!("Failed to refresh last usage of token! {e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle tokens expiration
|
// Handle tokens expiration
|
||||||
if token.is_expired() {
|
if token.is_expired() {
|
||||||
log::error!("Attempted to use expired token! {:?}", token);
|
log::error!("Attempted to use expired token! {token:?}");
|
||||||
return Err(actix_web::error::ErrorBadRequest("Token has expired!"));
|
return Err(actix_web::error::ErrorBadRequest("Token has expired!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@ impl FromRequest for FileIdExtractor {
|
|||||||
Self::load_file_from_path(&auth, file_id)
|
Self::load_file_from_path(&auth, file_id)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
log::error!("Failed to extract file ID from URL! {}", e);
|
log::error!("Failed to extract file ID from URL! {e}");
|
||||||
actix_web::error::ErrorNotFound("Could not fetch file information!")
|
actix_web::error::ErrorNotFound("Could not fetch file information!")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@@ -50,7 +50,7 @@ impl FromRequest for InboxEntryInPath {
|
|||||||
Self::load_inbox_entry_from_path(&auth, entry_id)
|
Self::load_inbox_entry_from_path(&auth, entry_id)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
log::error!("Failed to extract inbox entry ID from URL! {}", e);
|
log::error!("Failed to extract inbox entry ID from URL! {e}");
|
||||||
actix_web::error::ErrorNotFound("Could not fetch inbox entry information!")
|
actix_web::error::ErrorNotFound("Could not fetch inbox entry information!")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@@ -57,7 +57,7 @@ impl FromRequest for MovementInPath {
|
|||||||
Self::load_movement_from_path(&auth, account_id)
|
Self::load_movement_from_path(&auth, account_id)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
log::error!("Failed to extract movement ID from URL! {}", e);
|
log::error!("Failed to extract movement ID from URL! {e}");
|
||||||
actix_web::error::ErrorNotFound("Could not fetch movement information!")
|
actix_web::error::ErrorNotFound("Could not fetch movement information!")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
8
moneymgr_web/package-lock.json
generated
8
moneymgr_web/package-lock.json
generated
@@ -39,7 +39,7 @@
|
|||||||
"eslint-plugin-react-hooks": "^5.2.0",
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"eslint-plugin-react-refresh": "^00.4.20",
|
"eslint-plugin-react-refresh": "^00.4.20",
|
||||||
"eslint-plugin-react-x": "^1.52.2",
|
"eslint-plugin-react-x": "^1.52.2",
|
||||||
"globals": "^16.1.0",
|
"globals": "^16.2.0",
|
||||||
"typescript": "~5.8.3",
|
"typescript": "~5.8.3",
|
||||||
"typescript-eslint": "^8.32.1",
|
"typescript-eslint": "^8.32.1",
|
||||||
"vite": "^6.3.5"
|
"vite": "^6.3.5"
|
||||||
@@ -4265,9 +4265,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/globals": {
|
"node_modules/globals": {
|
||||||
"version": "16.1.0",
|
"version": "16.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/globals/-/globals-16.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/globals/-/globals-16.2.0.tgz",
|
||||||
"integrity": "sha512-aibexHNbb/jiUSObBgpHLj+sIuUmJnYcgXBlrfsiDZ9rt4aF2TFRbyLgZ2iFQuVZ1K5Mx3FVkbKRSgKrbK3K2g==",
|
"integrity": "sha512-O+7l9tPdHCU320IigZZPj5zmRCFG9xHmx9cU8FqU2Rp+JN714seHV+2S9+JslCpY4gJwU2vOGox0wzgae/MCEg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
"eslint-plugin-react-hooks": "^5.2.0",
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"eslint-plugin-react-refresh": "^00.4.20",
|
"eslint-plugin-react-refresh": "^00.4.20",
|
||||||
"eslint-plugin-react-x": "^1.52.2",
|
"eslint-plugin-react-x": "^1.52.2",
|
||||||
"globals": "^16.1.0",
|
"globals": "^16.2.0",
|
||||||
"typescript": "~5.8.3",
|
"typescript": "~5.8.3",
|
||||||
"typescript-eslint": "^8.32.1",
|
"typescript-eslint": "^8.32.1",
|
||||||
"vite": "^6.3.5"
|
"vite": "^6.3.5"
|
||||||
|
@@ -31,12 +31,21 @@ export class APIClient {
|
|||||||
return URL;
|
return URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the full URL at which the backend can be contacted
|
||||||
|
*/
|
||||||
|
static ActualBackendURL(): string {
|
||||||
|
const backendURL = this.backendURL();
|
||||||
|
if (backendURL.startsWith("/")) return `${location.origin}${backendURL}`;
|
||||||
|
else return backendURL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check out whether the backend is accessed through
|
* Check out whether the backend is accessed through
|
||||||
* HTTPS or not
|
* HTTPS or not
|
||||||
*/
|
*/
|
||||||
static IsBackendSecure(): boolean {
|
static IsBackendSecure(): boolean {
|
||||||
return this.backendURL().startsWith("https");
|
return this.ActualBackendURL().startsWith("https");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -268,7 +268,7 @@ function CreatedToken(p: { token: TokenWithSecret }): React.ReactElement {
|
|||||||
<div style={{ padding: "15px", backgroundColor: "white" }}>
|
<div style={{ padding: "15px", backgroundColor: "white" }}>
|
||||||
<QRCodeCanvas
|
<QRCodeCanvas
|
||||||
value={`moneymgr://api=${encodeURIComponent(
|
value={`moneymgr://api=${encodeURIComponent(
|
||||||
APIClient.backendURL()
|
APIClient.ActualBackendURL()
|
||||||
)}&id=${p.token.id}&secret=${p.token.token}`}
|
)}&id=${p.token.id}&secret=${p.token.token}`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user