mirror of
https://github.com/lifegpc/pixiv_downloader.git
synced 2026-07-08 01:32:41 +08:00
Update
This commit is contained in:
@@ -26,8 +26,16 @@ impl AuthUserContext {
|
||||
}
|
||||
|
||||
async fn handle(&self, mut req: Request<Body>) -> JSONResult {
|
||||
let root_user = self.ctx.db.get_user(0).await?;
|
||||
let params = req.get_params().await?;
|
||||
let root_user = self
|
||||
.ctx
|
||||
.db
|
||||
.get_user(0)
|
||||
.await
|
||||
.try_err3(-1001, gettext("Failed to operate database:"))?;
|
||||
let params = req
|
||||
.get_params()
|
||||
.await
|
||||
.try_err3(-1002, gettext("Failed to get parameters:"))?;
|
||||
if root_user.is_some() {
|
||||
// # TODO auth
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use crate::ext::json::ToJson2;
|
||||
#[cfg(test)]
|
||||
use crate::ext::json::{FromJson, ToJson};
|
||||
use crate::gettext;
|
||||
use json::JsonValue;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -85,22 +84,6 @@ impl From<(i32, String, String)> for JSONError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crate::db::PixivDownloaderDbError> for JSONError {
|
||||
fn from(e: crate::db::PixivDownloaderDbError) -> Self {
|
||||
Self::from((
|
||||
-1001,
|
||||
format!("{} {}", gettext("Failed to operate the database:"), e),
|
||||
format!("{:?}", e),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crate::error::PixivDownloaderError> for JSONError {
|
||||
fn from(e: crate::error::PixivDownloaderError) -> Self {
|
||||
Self::from((-500, format!("{}", e), format!("{:?}", e)))
|
||||
}
|
||||
}
|
||||
|
||||
pub type JSONResult = Result<JsonValue, JSONError>;
|
||||
|
||||
impl ToJson2 for JSONResult {
|
||||
|
||||
Reference in New Issue
Block a user