Comments (19)
才看见你上面说的web安全域名,应该就是这个问题导致了只允许由安全域名发起的修改数据请求?可是你可以创建新纪录,这就奇怪了😂
from jekyll-text-theme.
配置看起来没有什么问题。浏览器控制台有报错吗,有的话能提供截图吗?电脑不在身边,没法去调试。
from jekyll-text-theme.
@kitian616 谢谢. chrome console只有这样一句话
The SSL certificate used to load resources from https://app-router.leancloud.cn will be distrusted in M70. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information.
[edit] 上面那句貌似是chrome相关的. 我在其他浏览器里尝试, view也都显示为0
from jekyll-text-theme.
看起来是 SSL 证书的问题,白天不方便,晚上我看看。你也可以搜索下看看有什么线索。
from jekyll-text-theme.
@kitian616 又研究了一下, 大概知道怎么看error了. 开着console的时候打开网页, 有如下错误
AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.
PUT https://pase2hy7.api.lncld.net/1.1/classes/counter/5a309896128fe10044550a12?new=true 403 (Forbidden)
The resource https://c.disquscdn.com/next/embed/common.bundle.8edffe1405dcc2d5eb5ee9d96a2866d1.js was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it wasn't preloaded for nothing
看来前两个跟Lean Cloud有关, 最后一个跟disqus有关. 我不太懂啊, 貌似是访问权限的关系? 我再研究一下Lean Cloud的设置
from jekyll-text-theme.
检查了一下. 首页的显示没有问题 -- 我手动在LeanCloud上改数据, 首页的view数就改变了.
上面的错误是在打开单篇文章的时候出现的. 也就是说更新class里key对应的数值失败. 所以一直显示为零.
from jekyll-text-theme.
多谢反馈,看起来是代码的 BUG。
from jekyll-text-theme.
@willguxy 你的lean cloud写入权限有问题
from jekyll-text-theme.
@WangQiru
app权限是默认全开的。难道是LeanCloudWeb 安全域名
的问题?我就加入一个url地址
from jekyll-text-theme.
@WangQiru 如果是写入权限的问题,应该连Key的创建不了吧。 我看LeanCloud上已经创建了很多key了,现在应该是更新的时候出错。上面说的那个错误PUT https://pase2hy7.api.lncld.net/1.1/classes/counter/5a309896128fe10044550a12?new=true 403 (Forbidden)
看来像是重复创建新的key失败。因为这个key 5a309896128fe10044550a12
已经存在了
from jekyll-text-theme.
@willguxy 检查下你counter的update权限?以及_layout/post.html下的lean cloud相关js代码。我看了下更新计数器的逻辑没看出错误来。我的网站也没遇到这个问题。
$(function() {
// 初始化
AV.init({
appId: '{{ site.leancloud.app_id }}',
appKey: '{{ site.leancloud.app_key }}'
});
// 查询
var query = new AV.Query('{{ site.leancloud.app_class }}');
query.equalTo('key', '{{ page.key }}');
query.first().then(function(result) {
if (result) {
addOne(result)
} else {
//新建
var Blog = AV.Object.extend('{{ site.leancloud.app_class }}');
var blog = new Blog();
blog.set('title', '{{ page.title }}');
blog.set('key', '{{ page.key }}');
blog.set('views', 0);
blog.save().then(function(page) {
addOne(page)
}, function(error) {
if (error) {
throw error;
}
});
}
function addOne(page) {
page.increment('views', 1);
page.fetchWhenSave(true);
page.save().then(function(page) {
$("#post-key-{{ page.key }}").text(page.attributes.views);
}, function(error) {
if (error) {
throw error;
}
});
}
}, function(error) {
if (error) {
throw error;
}
});
});
from jekyll-text-theme.
@WangQiru 代码是一样的. 我是pull了最新的代码. 权限问题跟上面图显示的一样, update没有限制
from jekyll-text-theme.
@willguxy 403八成就是写入权限有问题,或者lean cloud屏蔽了来自你服务器IP地址的PUT(貌似不可能)?你有没有fork新项目或者换个leancloud appid试试?
https://leancloud.cn/docs/error_code.html#hash1392106
from jekyll-text-theme.
@WangQiru 我也是觉得能创建不能修改hin奇怪。。。我的两个博客设置一样,不同的app id,都有这个问题。
from jekyll-text-theme.
@willguxy 我两个博客两个appid都没问题。你重新建一个repo跑一个fresh demo看看。也可以试试重新申请一个lean cloud账号,我怀疑是那边的问题。
from jekyll-text-theme.
发现了一个LeanCloud的设置问题。就是创建class的时候需要选择无限制
。可能是我的理解有问题,选择限制写入
的话,默认的ACL权限为
{"*":{"write":false,"read":true}}
那无限制
的话岂不是任何人都可以修改了?
总之使用无限制
之后,数据更新就没问题了。默认的ACL权限也变成
{"*":{"write":true,"read":true}}
from jekyll-text-theme.
对,确实是这样,如果 LeanCloud 应用有 url 白名单机制就非常好了。
from jekyll-text-theme.
thank you. please feel free to close this issue
from jekyll-text-theme.
@kitian616 应用设置下有一个 web 安全域名,就是白名单设置
from jekyll-text-theme.
Related Issues (20)
- Bug: Is MathJax 2.7.4 obsolete? It does not properly render equations anymore. HOT 5
- Site is down HOT 4
- 快速开始的链接挂了
- Feature request: mastodon support in social links
- Feature request: PWA支持?都9120年了,应该支持下PWA啊,然后最好还有个笔记功能
- Feature request: How config url and baseurl with github
- Bug: 安装错误 sass-embedded HOT 2
- Side-Menu Item Collapse
- Bug: [dev branch] A small typing error makes jekyll serve break down
- Feature request: Toggling between different skins
- Bug: ToC should be scrollable
- Feature request: sub-menus? HOT 1
- Feature request: Can jekyll encrypt articles like Hexo? Is it possible to add an article encryption function to the theme.
- Feature request:
- Feature request: Question: Text can support html in markdown ?
- Bug: Archive posts not showing up on mobile
- Feature request: callouts without border
- Bug: ffi gem not compatible anymore, icons not rendering HOT 1
- Bug: Mermaid labels were not displayed properly. HOT 2
- Nested list items not indented as is customary
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jekyll-text-theme.