diff --git a/boofilsic/settings.py b/boofilsic/settings.py index 862595c7..39f6e6fd 100644 --- a/boofilsic/settings.py +++ b/boofilsic/settings.py @@ -225,8 +225,8 @@ MEDIA_URL = "/media/" MEDIA_ROOT = os.path.join(BASE_DIR, "media/") SITE_INFO = { - "site_name": "NiceDB", - "site_url": "https://nicedb.org", + "site_name": os.environ.get("APP_NAME", "NiceDB"), + "site_url": os.environ.get("APP_URL", "https://nicedb.org"), "support_link": "https://github.com/doubaniux/boofilsic/issues", "social_link": "https://donotban.com/@testie", "donation_link": "https://patreon.com/tertius", @@ -235,12 +235,9 @@ SITE_INFO = { "sentry_dsn": None, } -# Mastodon configs -CLIENT_NAME = os.environ.get("APP_NAME", "NiceDB") -SITE_INFO["site_name"] = os.environ.get("APP_NAME", "NiceDB") -APP_WEBSITE = os.environ.get("APP_URL", "https://nicedb.org") -REDIRECT_URIS = APP_WEBSITE + "/users/OAuth2_login/" -SITE_INFO["site_url"] = APP_WEBSITE +REDIRECT_URIS = SITE_INFO["site_url"] + "/users/OAuth2_login/" +# if you are creating new site, use +# REDIRECT_URIS = SITE_INFO["site_url"] + "/account/login/oauth" # Path to save report related images, ends with slash diff --git a/catalog/common/models.py b/catalog/common/models.py index 73a43e61..8b8eb98d 100644 --- a/catalog/common/models.py +++ b/catalog/common/models.py @@ -392,7 +392,7 @@ class Item(SoftDeleteMixin, PolymorphicModel): @property def absolute_url(self): - return f"{settings.APP_WEBSITE}{self.url}" + return f"{settings.SITE_INFO['site_url']}{self.url}" @property def api_url(self): @@ -451,7 +451,7 @@ class Item(SoftDeleteMixin, PolymorphicModel): @property def cover_image_url(self): return ( - f"{settings.APP_WEBSITE}{self.cover.url}" + f"{settings.SITE_INFO['site_url']}{self.cover.url}" if self.cover and self.cover != DEFAULT_ITEM_COVER else None ) diff --git a/catalog/templates/search_results.html b/catalog/templates/search_results.html index 3b3a8a0f..42621785 100644 --- a/catalog/templates/search_results.html +++ b/catalog/templates/search_results.html @@ -77,7 +77,18 @@ {% for item in items %} {% include '_list_item.html' with show_tags=1 %} {% empty %} -

{% trans '无站内条目匹配' %}

+

+ 无站内条目匹配。 + {% if user.is_authenticated %}系统会尝试搜索其它网站的条目,点击标题可添加到本站。{% endif %} +

+

+ 如果你在 + {% for site in sites %} + {{ site }} + {% if not forloop.last %}/{% endif %} + {% endfor %} + 找到了相关条目,也可以把链接(如 https://movie.douban.com/subject/1309046/ )输入到搜索栏中提交保存到本站。 +

{% endfor %} {% if dup_items %} @@ -98,6 +109,8 @@ {% trans '正在实时搜索站外条目' %}

+ {% else %} + 登录用户可看到来自其它网站的搜索结果。 {% endif %} diff --git a/common/api.py b/common/api.py index 09b58b64..80bf5ced 100644 --- a/common/api.py +++ b/common/api.py @@ -70,5 +70,5 @@ api = NinjaAPI( auth=OAuthAccessTokenAuth(), title=settings.SITE_INFO["site_name"] + " API", version="1.0.0", - description=f"{settings.SITE_INFO['site_name']} API
Learn more", + description=f"{settings.SITE_INFO['site_name']} API
Learn more", ) diff --git a/common/templates/_header.html b/common/templates/_header.html index 7d4ed445..0ddaccbc 100644 --- a/common/templates/_header.html +++ b/common/templates/_header.html @@ -14,7 +14,7 @@