]> Untitled Git - lemmy.git/commitdiff
Merge branch 'master' into use-pictrs-1
authorDessalines <tyhou13@gmx.com>
Fri, 12 Jun 2020 21:51:37 +0000 (17:51 -0400)
committerDessalines <tyhou13@gmx.com>
Fri, 12 Jun 2020 21:51:37 +0000 (17:51 -0400)
1  2 
server/src/lib.rs
ui/src/components/user.tsx
ui/src/utils.ts

index 9b73caa8de391fa7024dc82bae57425723261eb3,23d6a87a6cffca79a12db0799c0dbbadb34b8782..49971cfa0f9a0e5c591e23d8056ce941a1be488f
@@@ -203,19 -197,15 +203,19 @@@ pub fn fetch_pictrs(image_url: &str) -
    is_image_content_type(image_url)?;
  
    let fetch_url = format!(
 -    "http://pictshare/api/geturl.php?url={}",
 -    utf8_percent_encode(image_url, NON_ALPHANUMERIC)
 +    "http://pictrs:8080/image/download?url={}",
 +    utf8_percent_encode(image_url, NON_ALPHANUMERIC) // TODO this might not be needed
    );
-   let text = isahc::get(&fetch_url)?.text()?;
+   let text = attohttpc::get(&fetch_url).send()?.text()?;
 -  let res: PictshareResponse = serde_json::from_str(&text)?;
 -  Ok(res)
 +  let res: PictrsResponse = serde_json::from_str(&text)?;
 +  if res.msg == "ok" {
 +    Ok(res)
 +  } else {
 +    Err(format_err!("{}", &res.msg))
 +  }
  }
  
 -fn fetch_iframely_and_pictshare_data(
 +fn fetch_iframely_and_pictrs_data(
    url: Option<String>,
  ) -> (
    Option<String>,
Simple merge
diff --cc ui/src/utils.ts
index 570ea48cdbc074b79f4713c511fb3de0d92588d0,93b9cab08bdae41b3c0caa57bc6e55a9301a9251..500992d7c3e5149c68de3f1107b8cc5ba90db2ff
@@@ -413,10 -413,19 +413,23 @@@ export function setTheme(theme: string 
      }
    }
  
-   // Load the theme dynamically
-   let cssLoc = `/static/assets/css/themes/${theme}.min.css`;
-   loadCss(theme, cssLoc);
-   document.getElementById(theme).removeAttribute('disabled');
+   // if the user is not logged in, we load the default themes and let the browser decide
 -  if(!loggedIn) {
 -    document.getElementById("default-light").removeAttribute('disabled')
 -    document.getElementById("default-dark").removeAttribute('disabled')
++  if (!loggedIn) {
++    document.getElementById('default-light').removeAttribute('disabled');
++    document.getElementById('default-dark').removeAttribute('disabled');
+   } else {
 -    document.getElementById("default-light").setAttribute('disabled', 'disabled');
 -    document.getElementById("default-dark").setAttribute('disabled', 'disabled');
++    document
++      .getElementById('default-light')
++      .setAttribute('disabled', 'disabled');
++    document
++      .getElementById('default-dark')
++      .setAttribute('disabled', 'disabled');
+     // Load the theme dynamically
+     let cssLoc = `/static/assets/css/themes/${theme}.min.css`;
+     loadCss(theme, cssLoc);
+     document.getElementById(theme).removeAttribute('disabled');
+   }
  }
  
  export function loadCss(id: string, loc: string) {