소스 검색

add support for remote favicons #125

Falko Schindler 2 년 전
부모
커밋
8a46d821da
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      nicegui/page.py

+ 6 - 1
nicegui/page.py

@@ -65,7 +65,12 @@ class Page(jp.QuasarPage):
         self.view.add_page(self)
         self.view.add_page(self)
 
 
     def set_favicon(self, favicon: Optional[str]) -> None:
     def set_favicon(self, favicon: Optional[str]) -> None:
-        self.favicon = f'_favicon/{favicon}' if favicon else 'favicon.ico'
+        if not favicon:
+            self.favicon = 'favicon.ico'
+        elif favicon.startswith('http://') or favicon.startswith('https://'):
+            self.favicon = favicon
+        else:
+            self.favicon = f'_favicon/{favicon}'
 
 
     async def _route_function(self, request: Request) -> Page:
     async def _route_function(self, request: Request) -> Page:
         with globals.within_view(self.view):
         with globals.within_view(self.view):