Skip to main content

A blog like plugin

Project description

OrLike

GitHub GitHub branch checks state GitHub Release Date

使用LeanCloud, 部署在vercel的博客点赞插件, 保障安全.

当前功能:

  • 分离APPID/APPKEY, 保护账号安全
  • 使用随机用户ID, 不保存用户其他信息, 保障用户隐私
  • 支持设置用户过期时间
  • 支持取消点赞/踩
  • 将orlike发布为pipy包, 方便自动升级
  • 加载动画
  • 自定义图标和CDN

Branch

  • server: server端代码
  • client: client端代码
  • master: demo

Deployment

在这里可以将OrLike部署到你的Vercel账户上.

Deploy to Vercel

我们更推荐使用这个零配置的例子.

Usage

在你期望嵌入OrLike的页面加入以下链接:

<script src="https://cdn.jsdelivr.net/gh/caibingcheng/orlike@client/orlike.min.js"></script>

当然, 也可以使用自己的CDN. 本项目也依赖JQuery, 所以别忘记引用JQuery:

<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

接下来, 在你期望嵌入OrLike的位置加上一个div标签, 并且加上class或者id:

<div class="orlike-box"></div>

然后在合适的地方初始化OrLike:

<script>
    new OrLike({
        serverUrl: "https://orlike.vercel.app/",
        el: ".orlike-box",
        days: 30,
        icon: {like: "fa fa-heart", dislike: false},
        style: "https://cdn.jsdelivr.net/gh/caibingcheng/orlike@client/orlike.min.css",
    });
</script>

尽管可以使用公共的serverUrl, 但是更推荐使用私有的serverUrl, 这样更容易保证数据安全.

目前初始化需要的参数:

  • serverUrl: 必填, Vercel服务地址
  • el: 必填, 放orlikediv名字(classid)
  • days: 可选, 用户id保存的时间, 默认是30天
  • icon: 可选, 自定义点赞和踩的图标, 不填写这是默认, 如果是false, 则不显示对应的按扭
  • style: 可选, 可自定义样式, 如果不填写, 则使用默认CDN
  • ifont: 可选, 可自定义font-awesome CDN, 如果不填写, 则使用默认CDN

到此为止, 本地工作已经做完了, 现在需要创建LeanCloud账户, 可以参考Valine的配置方法.

创建账户并且新建应用之后, 需要给应用添加一个名为OrLike的class, 并且设置读写权限为所有用户, 然后再拿到LeanCloud的APP IDAPP Key填入到Vercel的环境变量.

  • APPID 对应 APP ID
  • APPKEY 对应 APP Key

然后部署OrLike就可以正常工作了.

Todo & Contributes

项目初期, 还有很多想象空间, 加油↖(^ω^)↗

  • 提供点赞/踩排名

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

orlike-0.1.38.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

orlike-0.1.38-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file orlike-0.1.38.tar.gz.

File metadata

  • Download URL: orlike-0.1.38.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.15

File hashes

Hashes for orlike-0.1.38.tar.gz
Algorithm Hash digest
SHA256 8bfb0325c6734e2e5c42df3b3ec409cfd089ac09ae509ad9ff45bc7e07a46cab
MD5 71366dccc1f1576403ded6117bd304b6
BLAKE2b-256 cbfe630fb460992b8b8f3689bcabbe5411d534fb262d1484929f01d7c3a0cf46

See more details on using hashes here.

File details

Details for the file orlike-0.1.38-py3-none-any.whl.

File metadata

  • Download URL: orlike-0.1.38-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.15

File hashes

Hashes for orlike-0.1.38-py3-none-any.whl
Algorithm Hash digest
SHA256 c0d8687a5d27ac25df38152f23bd414b2531fd122314e7328b6b256d11fdf0af
MD5 35f03a7bb714fe602e80f0f4a55d22a3
BLAKE2b-256 a0f1b70347f566c8055f7e4d5c75022e67423d9be526e65ab5796d04b3325225

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page