steemblog -- browsing your steem posts faster

steemblog -- browsing your steem posts faster

steemblog – mirror your steem posts to blog hosts such as GitHub pages, Netlify, etc., and help you organize and search your posts faster.

  • This is my first submission for @utopian-io project
  • 本文用于首次尝试向 utopian-io 提交开源项目

Repository

  • https://github.com/steemblog/blog (blog builder)
  • https://github.com/steemblog/hexo-theme-icarus (blog theme)

steemblog

blog.png Image Source: Pixabay

Introduction

steemblog is a blog service and tool built by myself that synchronize your steem blogs into GitHub pages or other static site hosts, e.g. https://steemblog.github.io/@utopian-io/,
https://steemblog.github.io/@robertyan/

The blog service has recently served around 20 users mainly in Steem Chinese community who have provided very positive feedback to the steemblog project.

Features

  1. Convert all the posts of one or multiple steem accounts with Hexo into static pages, and publish them onto GitHub page or Netlify;
  2. Provide smooth user experience to browse, classify and organize one’s blogs with the blog themes;
  3. Make the posts updated daily with Travis CI or cron jobs to keep the blogs synchronized from Steem.

1. Example

By using steemblog, we could easily mirror @utopian-io’s posts into https://steemblog.github.io/@utopian-io/, where you could look at @utopian-io’s posts in the history, and search through all the posts, with better experience.

Comparing to Steemit, this looks to be a “real blog” and is cleaner and more responsive.

(1) The home page of the blog

image.png

(2) Tag cloud:

tag-cloud

(3) Archives:

archives

(4) Recent posts:

recent-posts

(5) Search:

search

(6) Post: https://steemblog.github.io/@utopian-io/what-is-utopian-state-of-the-art-forever-stored-in-the-blockchain-107-days-since-the-beginning/

image.png

screenshots from: https://steemblog.github.io/@utopian-io/

2. How to Use

To deploy the project for yourself, you could fork https://github.com/steemblog/blog to your account, and setup the blog with travis-ci, by updating the environment viariables in travis project with your accounts.

  • GIT_USERNAME: your GitHub account
  • GIT_EMAIL: your GitHub account
  • GITHUB_PAT: your GitHub token
  • BLOG_REPO: the repo to deploy your GitHub pages
  • STEEM_ACCOUNTS: the steem accounts to synchronize the posts, separate by comma. e.g. utopian-io,robertyan

Or you can also contact me (@robertyan) to help setup one synchronized blog for your steem account at https://steemblog.github.io, e.g. https://steemblog.github.io/@robertyan/

Technology Stack

This is a Python + JavaScript project.

  1. steemblog extended and enhanced the steem blog mirroring tool project by myself
  2. The interaction with Steem blockchain is built with beem project.
  3. The blog generation is built with hexo blog framework.
  4. The blog service by default used an customized hexo theme: steemblog/hexo-theme-icarus. The theme has good user experience, but the build speed is terrible. We did intensive enhancements to hexo-theme-icarus to increase the build speed by 20~100 times.
  5. invoke for task management.

1. Build the Blog

To build the blog, we need to construct the front-matter for markdown, by retrieving data from steem, and then use Hexo to generate the static pages.

blog/message.py: the front matter template

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
MESSAGES["blog"] = """
---
title: '{title}'
permlink: {permlink}
catalog: true
toc_nav_num: true
toc: true
position: {position}
date: {date}
categories:
- {category}
tags:
{tags}
thumbnail: {thumbnail}
sidebar:
right:
sticky: true
widgets:
-
type: toc
position: right
---

{body}
"""

blog/builder.py: fetch metadata from steem

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
def _write_content(self, post):
folder = self._get_content_folder()
c = SteemComment(comment=post)

# retrieve necessary data from steem
title = post.title.replace("'", "''")
permlink = post["permlink"]
body = c.get_compatible_markdown()
position = self._get_position(body)
date_str = post.json()["created"]
date = date_str.replace('T', ' ')
tags = "\n".join(["- {}".format(tag) for tag in c.get_tags()])
category = c.get_tags()[0]
thumbnail = c.get_pic_url() or ''
url = c.get_url()

# build content with template
template = get_message("blog", footer=True)
content = template.format(title=title, permlink=permlink,
position=position, date=date,
tags=tags, category=category,
thumbnail=thumbnail, body=body, url=url)

blog/command.py: build static pages with hexo

1
2
3
4
5
6
7
8
9
10
11
12
@task(help={
'debug': 'enable the debug mode',
})
def build(ctx, debug=False):
""" build the static pages from steem posts """

configure()
os.system("hexo clean")
build_cmd = "hexo generate"
if debug:
build_cmd += " --debug"
os.system(build_cmd)

2. Make Build Faster

However, the builds for some accounts with 1000+ posts and 200+ tags are extremely to build (take > 1 hour). In order to serve more accounts, we have to increase the build speed.

We used below strategies to accelerate the build process by 20~100x.

  1. build a customized theme: steemblog/hexo-theme-icarus
  2. use cache in rendering intensively
  3. implement incremental build in hexo
  4. put widgets into standalone html pages and load with ajax
  5. use more efficient layout (timeline)
  6. reduce total page numbers

themes/icarus/layout/layout.ejs: Use fragment cache as much as possible:

1
2
3
4
5
6
<%- partial('common/footer', {}, {cache: true}) %>
<%- partial('common/scripts', {}, {cache: true}) %>

<% if (has_config('search.type')) { %>
<%- partial('search/' + get_config('search.type'), {}, {cache: true}) %>
<% } %>

themes/icarus/layout/layout.ejs: Generate widget page with hexo generators:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
* Widget page generator
*/
module.exports = function (hexo) {
hexo.extend.generator.register('widget', function (locals) {
const widgets = hexo.extend.helper.get('get_config').bind(this)('widgets');
const component_widgets = widgets.filter((w) => (w.component))

return component_widgets.map(function(widget){
return {
path: `widgets/${widget.type}.html`,
layout: 'component/pjax_widget_src',
data: {
widget: widget,
__widget: true
}
};
});
});
}

themes/icarus/layout/component/pjax_widget_ref.ejs Use reference to page instead build the page itself, which is critical to make incremental build possible.

1
2
3
4
5
<div class="card widget">
<div class="card-content">
<div id="widget-<%= widget.type %>" data-pjax="<%= `${get_config("root")}widgets/${widget.type}` %>.html" style="position: relative; width: 100%; display: block;"></div>
</div>
</div>

themes/icarus/includes/generators/category.js: only the affected category pages will be built in hexo generators

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function needs_update(category) {
if (config.incremental) {
// in incremental mode, update the affected category pages only
const updated_categories = list_updated_categories();
if (updated_categories &amp;&amp; updated_categories.length > 0 &amp;&amp;
updated_categories.indexOf(category['name']) != -1) {
return true;
}
return false;
}
return true;
}

return locals.categories.reduce(function(result, category){
if (! needs_update(category)) {
return result;
}

const posts = category.posts.sort('-date');
const data = pagination(category.path, posts, {
perPage: perPage,
layout: ['category', 'archive', 'index'],
format: paginationDir + '/%d/',
data: {
category: category.name,
parents: findParent(category)
}
});

return result.concat(data);
}, []);

We cannot show all the details of the implementation here, but how to build the blog from steem data, and how to make the build faster are the key efforts here to build a robust and efficient blog service.

Roadmap

While the steemblog service is easy to use for some users, it requires more enhancements.

  1. Switch languages and themes easily;
  2. Improve search performance; add search functionality by adding Google / Baidu search;
  3. Support write back to Steem blockchain when neeeded.
  4. Connect with steem-engine / SCOT, and help more Hexo users to post on steem
  5. Promote the project to help more people who wants a better blog user experience.

How to Contribute

For anyone who wants to contribute to this project, feel free to fork https://github.com/steemblog/blog or https://github.com/steemblog/hexo-theme-icarus , and submit Pull Requests.

Or please directly contact me (@robertyan) on Steem if you have any questions to discuss.

Github Account

  • my personal account: https://github.com/think-in-universe (can be verified with the links in the profile)
  • the steemblog organization account: https://github.com/steemblog

This page is synchronized from the post: steemblog – browsing your steem posts faster

网络钓鱼的安全威胁,请中文区用户警惕 | Phishing Warning

网络钓鱼的安全威胁,请中文区用户警惕 | Phishing Warning

本文是 @steemcleaners 近日的文章Phishing Warning的中文翻译。

中文版声明

近期Steem发生较多的安全威胁。由于目前骇客主要针对英文用户发起网络钓鱼(Phishing)攻击,中文的受害者预计较少。但最近Steem上网络钓鱼事件高发,大家应当引起重视,并警惕此类安全隐患。保护好自己的账户和资金安全。

如果不理解什么是网络钓鱼(Phishing),可以阅读资料: https://baike.baidu.com/item/网络钓鱼/1401858

如果有中文用户遭遇网络钓鱼、账户被盗、经济损失或其他安全入侵问题,可以报告给@steemcleaners。本文中文作者对网络安全领域有一定经验,如有朋友遇到问题,或许也可提供支持。

以下本文为正文

image alt

近日来,网络钓鱼已在Steem上重新启动。骇客们盗取了十几个Steem账户,并用它们发布了数百条恶意评论。这些评论通常采用诱导性的语言,以诱骗用户点击其中的恶意链接。

这是网络钓鱼评论的一个例子(通过30个Steem欺骗用户点击最后的链接)

像上面这样的评论中的链接将带你离开Steemit或任何其他Steem网站的界面(如Busy, eSteem,Parkito等)。这些链接会带你访问一个看起来像合法服务的网站,而实际上是一个冒充的假网站。

这些假网站刻意设计为诱骗你输入用户名和密码(或active key)。如果你输入了这些信息,黑客就会登入你的账户,偷走你账户里所有的钱,并更改你的账户密码。然后他们会使用你的账户来发送更多的钓鱼信息以欺骗你的朋友和其他Steem用户。

Flags/Downvotes 踩

@steemcleaners 团队的账户 (包括 @guard 和 @plentyofphish) 会踩骇客们发布的所有的恶意评论,尽全力把这些账户的威望踩成负数.

如果你的账户是被盗了,并恢复了你的账户,请马上联系我们(@steemcleaners)。我们会移除所有的对你的被盗账户的踩,以尽量恢复你账户的威望。之后,你需要把所有骇客通过你的账户发布的钓鱼评论都删除。

注意: 如果你的某个评论被我们大力踩了,请先不要删除这条评论,否则我们将无法移除对它的踩!请等我们把踩移除以后,再删除评论。

No Free Money 天下没有免费的午餐

骇客们挖了坑等你跳进去:从来没有免费的30 Steem等你去领取;从来没有。骇客们知道Steem上的很多人渴望通过Steem赚钱,所以故意挖了这些针对性的陷阱。

Report! 报告钓鱼问题

对于任何你发现的网络钓鱼问题,请第一时间通过我们的Dicord频道( https://discord.gg/STXSV4g )或者我们的网站( http://steemcleaners.com/reports/new )报告给我们。相比其他行为(如剽窃),网络钓鱼是我们最为重视和警惕的严重非法行为。哪怕你的账户曾经被我们加入了黑名单,我们仍然愿意帮助你;我们的首要目标是制止一切网络钓鱼和保证Steem生态的健康。

Recover 如何恢复被盗账户

如果你的账户被盗了,请根据下面的操作恢复你的个人账户。

首先,打开你的账户的Steemd.com的个人页面。

例子:

第一种情况:通过账户创建服务创建的账户

Recovery account: 本例子中为 @steemmonsters . 必须通过这个账户作为受托人账户 (Trustee Account)来重置你的密码.

Last account recovery: 默认的日期应该是1970年1月1日。如果显示为另一个日期,说明这个账户之前曾在这个日期被恢复过(密码被重置过)。

在这种情况下,用户需要联系 @steemmonsters (访问他们的Discord以寻求帮助)来启动账户恢复流程。

第二种情况:通过Steemit Inc 创建的账户

Recovery account: @steem . 这是最常见的情况因为大多数账户是通过Steemit Inc创建的。

如果你的受托人账户 (Trustee Account)是@steem,通过这个链接来启动账户恢复流程: https://steemit.com/recover_account_step_1

这是用于恢复账户的表单(原文中为英文版,这里采用中文版以方便读者)

  1. 输入你的用户名
  2. 输入你的账户最后一次使用过的密码
  3. 提交表单,你会看到一个包含更多信息的表单
  4. 在第二个表单中,确保你输入的是你注册时使用的邮箱

恢复账户的申请提交后,可以不时检查你的邮件。账户恢复流程一般需要花费Steemit Inc约24~48个小时来处理。

参考指南

如果你不确定如何联系你的受托人账户 (Trustee Account),可以在这个页面查找联系方法:https://github.com/gryter/plentyofphish/blob/master/guides/account-recovery.md (来自于@plentyofphish 的GitHub代码仓库)

本文翻译自@steemcleaners的文章Phishing Warning,感谢@steemcleaners对平台内安全问题的高度重视


This page is synchronized from the post: 网络钓鱼的安全威胁,请中文区用户警惕 | Phishing Warning

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×