Skip to content

Dionid/teleblog

Repository files navigation

Teleblog Community Edition

Template to create your own site from Telegram channel.

Demo: davidshekunts.ru

WARNING

This project is OpenSource version of teleblog.net and it maintained by me AND you, so be kind and suggest things, lets build together.

Stack

  1. Go
  2. Pocketbase
  3. Templ
  4. Vue
  5. Tailwind
  6. daisyUI

Word of caution

This project is NOT about best practices. It's about making product and do it efficiently. I haven't been working with Vue for a long time, and this is first time for me to use Pocketbase, Templ.

Don't take this project as a reference for best practices.

Project structure

  1. cmd/teleblog - Teleblog platform
  2. infra - some infrastructure code (nginx, systemctl)
  3. libs - libraries

How to

Install dependencies

  1. Install Go & Node.js
  2. Run make setup
  3. Install node deps (npm install or yarn install or pnpm install)

Develope

  1. Run cd cmd/teleblog && cp app.env.example app.env and fill it
  2. Run make dev

Deploy

  1. From sources
    1. Make sure you have Go installed, GOBIN and PATH configured on server
    2. Clone repository git clone git@github.com:Dionid/teleblog.git
    3. Install dependencies (live in section above)
    4. Run make serve
  2. Go install
    1. Make sure you have Go installed, GOBIN and PATH configured on server
    2. Run go install github.com/Dionid/teleblog/cmd/teleblog@latest on server
    3. Run teleblog serve --http=127.0.0.1:8091

Configure

  1. Create bot in @BotFather
  2. Go to SITE_URL:8090/_ to see Pocketbase admin panel and fill in your admin
  3. Create user in user table (username will be enough)
  4. Verify in bot to start parsing your channel
    1. Create tg_verification_token (be sure that column "verified" is false)
    2. Send this token to your bot /verifytoken YOUR_TOKEN (this will add tg_id, tg_user and verified to your user)
    3. Add bot to public TG channels and their groups
    4. Send group links to your bot /addchannel YOUR_CHANNEL_LINK

Customize

  1. Fill logo, seo and description data in config table
  2. Add menu items in menu_item table
  3. Change any template as you need in cmd/teleblog/httpapi
  4. Add any public assets to cmd/teleblog/httpapi/public

Upload history messages

  1. Export JSON history from your channel and zip it with files
  2. Via UI
    1. Go to /_/upload-history and upload file to it
  3. Via terminal
    1. Paste it to cmd/teleblog folder
    2. Run cd cmd/teleblog && go run . upload-history FILE_NAME.zip
  4. !ATTENTION! Upload channels posts firstly and linked chats comments secondly

Roadmap

First phase

Goal: Make it so content appears, but customization through Pocketbase admin

Status: Done

Second phase

Goal: Add content improvement features

Status: Done

Third phase

Goal: Separate it from demo project

Status: Done

X phase

Goal: Future features

  1. Schema.org + Open Graph.
  2. Auto-translate
  3. Repost to Medium
  4. Files
  5. Spoilers for Audio & Circles
  6. Dark / Light theme changer
  7. Delete old tags
  8. Author Image (getUserProfilePhotos)
  9. Admin page
  10. Partial reload
  11. Sorting
  12. Releases
  13. Docker image
  14. H1 from any text

Don't work with History Messages

  1. Pinned messages
  2. Likes counter
  3. Album id

FAQ

Why some posts are separated and some merged?

Every photo, video, audio, file, poll, etc. is a separate post in TG.

To merge them toghether, we use album_id field.

But there is no album_id for messages parsed from history.

So right now the only way is to assume that messages that are created in the same time are from the same album.

About

Create site from telegram channel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published