当前位置: 首页 > 软件库 > Web应用开发 > >

webpage-micropub-to-github

授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发
软件类型 开源软件
地区 不详
投 递 者 方坚壁
操作系统 未知
开源组织
适用人群 未知
 软件概览

Micropub to GitHub

FOSSA Status

An endpoint that accepts Micropub requests, formats them into Jekyll posts before pushing them to a configured GitHub repository. This enables updating a Jekyll blog through a Micropub client.

Early alpha

Supported:

  • Creation of posts
  • Uploading of media
  • Replacing an existing post with a new version

Unsupported:

  • Partial update
  • Deletes

Requirements

Requires at least Node.js 14.0.0.

This project contains a https://yarnpkg.com/ lock file which is a faster and more secure alternative to the npm client.

Installation

Install as a normal Node.js application. Add the required configuration values via environment variables or similar mechanism. Or deploy to Heroku:

Deploy

Endpoint discovery

Once deployed, your Micropub endpoint can be found at /micropub/main e.g. https://example.com/micropub/main.

If you specified more than one site using the MICROPUB_SITES_JSON variable, then each endpoint will be available under the name of its respective key, i.e. /micropub/key-name.

To enable automatic discovery for your Micropub endpoint and token endpoint, you will need to add the following values to your site's <head>:

<link rel="micropub" href="https://example.com/micropub/main">
<link rel="token_endpoint" href="https://tokens.indieauth.com/token">

Configuration

Required values

The following variables are required to enable a Micropub client to push content to your GitHub repository.

Variable Description
MICROPUB_TOKEN_ENDPOINT URL to verify Micropub token. Example: https://tokens.indieauth.com/token
MICROPUB_TOKEN_ME URL to identify Micropub user. Example: https://johndoe.example
MICROPUB_GITHUB_TOKEN GitHub access token to grant access to repository. Example: 12345abcde67890fghij09876klmno54321pqrst
MICROPUB_GITHUB_USER Username/organisation that owns repository. Example: johndoe
MICROPUB_SITE_GITHUB_REPO GitHub repository in which site files are found. Example: johndoe.github.io
MICROPUB_SITE_URL URL where site is published. Example: https://johndoe.example

Syndication

The following variables can be used to set syndication target(s).

Variable Description
MICROPUB_SITE_SYNDICATE_TO_UID Unique identifier of syndication target. Example: https://social.example/johndoe
MICROPUB_SITE_SYNDICATE_TO_NAME User readable name of syndication target. Example: @johndoe on Example Social Network
MICROPUB_SITE_SYNDICATE_TO Complex syndication target. Provided as a JSON array, e.g.: [{"uid":"https://social.example/johndoe","name":"@johndoe on Example Social Network","service":{"name":"Example Social Network","url":"https://social.example/","photo":"https://social.example/icon.png"},"user":{"name":"johndoe","url":"https://social.example/johndoe","photo":"https://social.example/johndoe/photo.jpg"}}]. Not compatible with MICROPUB_SITES_JSON.

Output style

The following variables allow you to configure the name and destination for files pushed to your repository. These variables will also accept conditional values (described below).

Variable Description
MICROPUB_FILENAME_STYLE File name and path for post. Example: _posts/:year-:month-:day-:slug
MICROPUB_MEDIA_FILES_STYLE File name and path for media files. Example: media/:year-:month-:slug/:filesslug
MICROPUB_PERMALINK_STYLE Jekyll permalink style. Example: /:categories/:year/:month/:title/
MICROPUB_LAYOUT_NAME The name of the Jekyll layout to use for the posts. Set to false to have no layout be added. Defaults to microblogpost
MICROPUB_OPTION_DERIVE_CATEGORY Override the default category
MICROPUB_GITHUB_BRANCH Branch to use for pushes. Useful to test out if things end up where you want them to. Example: micropub

Complex output styles

These configuration options can all be given different values for different types of content by setting up conditions under which each configuration applies. See conditional values.

Complex configuration

Variable Description
MICROPUB_SITES_JSON Complex settings and/or multiple sites (including their syndication targets) provided as JSON, e.g.: '{"site1":{"url":"https://site1.example/","github":{"repo":"site1"},"token":[{"endpoint":"https://tokens.indieauth.com/token","me":"https://site1.example/"}]},"site2":{"url":"http://site2.example/","github":{"repo":"site2"},"token":[{"endpoint":"https://tokens.indieauth.com/token","me":"http://site2.example/"}]}}'
MICROPUB_OPTION_NO_AUTO_CONFIGURE Auto-configure permalink status from the Jekyll repo config. Boolean
MICROPUB_OPTION_DERIVE_LANGUAGES Comma separated list of language codes to auto-detect. Example eng,swe
MICROPUB_HOST Domain name to enforce. Will redirect requests to all other domain names and IP addresses that the endpoint can be accessed on.
MICROPUB_ENCODE_HTML (non-standard) Option to opt out of HTML-encoding of text content if set to false. Defaults to true.

Conditional values

Conditions are set up by assessing the environment variables using a JSON object of the format:

[
  {
    "condition": "bookmark OR name",
    "value": "value-one"
  },
  {
    "condition": "bookmark OR name",
    "value": "value-two"
  }
]

Conditions are fulfills expressions that apply to the properties of the document being saved. Pretty much any property that can be inserted into a YAML front matter can be matched against. All values explicitly set in the Micropub request are available, but some defaults and derived values may not be available, depending on the option configured.

Please open an issue and let me know what conditions you would like to set up.

Modules used

  • micropub-express – an Express Micropub endpoint that accepts and verifies Micropub requests and calls a callback with a parsed micropubDocument.
  • format-microformat – a module that takes a micropubDocument as its input, and converts this data into a standard that can be published elsewhere. Currently supports the Jekyll format.
  • github-publish – a module that takes a filename and content and publishes it to a GitHub repository. The formatted data generated by format-microformat can be published to a Jekyll blog hosted on a GitHub, or a GitHub Pages site.

Related

License

FOSSA Status

 相关资料
  • Webpage Screenshot这个扩展不管是从功能上还是易用性上都非常不错,可以调整截屏的大小,而且是目前我所知道的唯一一个可以截取整个网页的截 屏扩展,当然也可以截取可见部分。同时在截屏之前可以对大小进行调整,支持多国语言界面,开发者Amina是中国人。另外,改扩展已经通过了Softpedia 网站的100% CLEAN认可,推荐有需要的同学安装此扩展。

  • Webpage Decorator 这个Chrome浏览器扩展提供了一些可以自定义网页颜色主题和字体的选项。不过安装本扩展后会在Chrome浏览器的地址栏右侧增加一个按钮,也许这会 导致部分网页的地址显示不全。 单击这个按钮就会打开此扩展的选项,可以调整网页背景图片、背景颜色、已读链接的颜色以及网页文字的颜色、字体大小和字体类型等。 颜色选择器是为改变颜色准备的,使用者通过它可选择自己喜欢的颜色或

  • 问题内容: 在HTML 5文档中添加边框时,页面元素移动时出现问题。 我希望包含的标头元素(灰色)出现在屏幕顶部,但它似乎占据了内部div(红色)的边距。但是,如果我在标题中添加边框,它会出现在我期望的位置,并且红色的内部div只会稍微移动! (第一张图片:无边框;第二张图片:有边框) 我尝试使用div而不是header元素设置相对或绝对定位,将边界和填充设置为0,使用HTML4doctype等。

  • 当我在网上做研究时,似乎人们也在这个堆栈中使用SQS,SNS会将信息放在SQS上,然后SQS会调用Lambda。 我想我想理解的是在这方面对SQS的需求。这增加了什么价值?换句话说,直接从SNS调用我的Lambda会失去什么?

  • 问题内容: 当前,我需要一个提供URL的程序,该程序返回网页上所有图像的列表。 即: logo.png gallery1.jpg test.gif 在尝试编写代码之前,有没有可用的开源软件? 语言应为java。谢谢菲利普 问题答案: HtmlUnit具有,可能会适合您。 (阅读简短的入门指南,了解如何获取正确的对象)

  • .to( target:Object, duration:Number, vars:Object, position:* ) : * 添加一个TweenLite.to()动画到时间轴,相当于add(TweenLite.to(...)),以下两行产生相同的结果: myTimeline.add( TweenLite.to(element, 1, {left:100, opacity:0.5}) );