Skip to content

weakish/telegraphet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This is the available telegraph API:

  • createAccount
  • createPage
  • editAccountInfo
  • editPage
  • getAccountInfo
  • getPage
  • getPageList
  • getViews
  • revokeAccessToken

First, I do not care about page views, so I remove the getViews API.

Second, remove the account concept:

  • createPage
  • editPage
  • getPage

Hmm, deletePage is missing. And editPage requires an account or a special token. Thus I make page immutable, and remove editPage. Thus only two API interfaces are left:

  • createPage
  • getPage

Since I only care about page content, then getPage is unnecessary (just go the url in browser).

Therefore I wrote this simple script to post content to telegraph.

echo '<p>Hello world!</p>' | telegraphet hello

I still need to create an account beforehand though. telegraph requires an account to create a new page.

telegraph --init PICKUP_A_USERNAME

If you already have a telegraph, you can setup the access token via environment variable or configuration file.

# config file
mkdir -p ~/.config/telegraphet
echo '{ "token": "YOUR_TOKEN" }' > ~/.config/telegraphet/config.json
# environment variable
echo '<p>hi</p>' | TELEGRAPH_TOKEN=YOUR_TOKEN telegraphet hi

About

command line tool to post content on telegra.ph

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages