Fix serverURLs of Valine

This commit is contained in:
Mimi 2020-09-27 01:35:40 +08:00
parent d51ca0e2e8
commit 9919fb5c49
4 changed files with 6 additions and 8 deletions

View File

@ -1,5 +1,5 @@
# ===============================================================
# It's recommended to use Alternate Theme Config to configure the theme
# It's recommended to use Alternate Theme Config to configure NexT
# Modifying this file may result in merge conflict
# See: https://theme-next.js.org/docs/getting-started/configuration
# ===============================================================
@ -608,6 +608,7 @@ valine:
enable: false
appId: # Your leancloud application appid
appKey: # Your leancloud application appkey
serverURLs: # When the custom domain name is enabled, fill it in here
placeholder: Just go go # Comment box placeholder
avatar: mm # Gravatar style
meta: [nick, mail, link] # Custom comment header
@ -616,7 +617,6 @@ valine:
visitor: false # Article reading statistic
comment_count: true # If false, comment count will only be displayed in post page, not in home page
recordIP: false # Whether to record the commenter IP
serverURLs: # When the custom domain name is enabled, fill it in here (it will be detected automatically by default, no need to fill in)
enableQQ: false # Whether to enable the Nickname box to automatically get QQ Nickname and QQ Avatar
requiredFields: [] # Set required fields: [nick] | [nick, mail]

View File

@ -76,10 +76,7 @@
{%- if theme.footer.powered %}
<div class="powered-by">
{%- set next_site = 'https://theme-next.js.org' %}
{%- if theme.scheme !== 'Gemini' %}
{%- set next_site = 'https://theme-next.js.org/' + theme.scheme | lower + '/' %}
{%- endif %}
{%- set next_site = 'https://theme-next.js.org' if theme.scheme === 'Gemini' else 'https://theme-next.js.org/' + theme.scheme | lower + '/' %}
{{- __('footer.powered', next_url('https://hexo.io', 'Hexo', {class: 'theme-link'}) + ' & ' + next_url(next_site, 'NexT.' + theme.scheme, {class: 'theme-link'})) }}
</div>
{%- endif %}

View File

@ -2,8 +2,9 @@
NexT.utils.loadComments('#valine-comments', () => {
NexT.utils.getScript('{{ theme.vendors.valine }}', () => {
new Valine(Object.assign({
el : '#valine-comments',
el: '#valine-comments',
path: {{ url_for(page.path) | replace(r/index\.html$/, '') | safedump }},
serverURLs: 'https://{{ theme.valine.appId.slice(0, 8) | lower }}.api.lncldglobal.com'
}, {{ theme.valine | safedump }}
));
}, window.Valine);

View File

@ -82,7 +82,7 @@
}
}
const api_server = app_id.slice(-9) !== '-MdYXbMMI' ? server_url : `https://${app_id.slice(0, 8).toLowerCase()}.api.lncldglobal.com`;
const api_server = app_id.slice(-9) === '-MdYXbMMI' ? `https://${app_id.slice(0, 8).toLowerCase()}.api.lncldglobal.com` : server_url;
if (api_server) {
fetchData(api_server);