mirror of
https://gitlab.com/octtspacc/staticoso
synced 2025-06-05 22:09:23 +02:00
Temp. fix for Gemini URIs; Add base for Mastodon support
This commit is contained in:
27
Source/Modules/ActivityPub.py
Normal file
27
Source/Modules/ActivityPub.py
Normal file
@@ -0,0 +1,27 @@
|
||||
""" ================================= |
|
||||
| This file is part of |
|
||||
| staticoso |
|
||||
| Just a simple Static Site Generator |
|
||||
| |
|
||||
| Licensed under the AGPLv3 license |
|
||||
| Copyright (C) 2022, OctoSpacc |
|
||||
| ================================= """
|
||||
|
||||
from Libs.mastodon import Mastodon
|
||||
from Modules.Utils import *
|
||||
|
||||
def MastodonGetSession(MastodonURL, MastodonToken):
|
||||
return Mastodon(
|
||||
api_base_url=MastodonURL,
|
||||
access_token=MastodonToken)
|
||||
|
||||
def MastodonGetMyID(Session):
|
||||
return Session.me()['id']
|
||||
|
||||
def MastodonGetPostsFromUserID(Session, UserID):
|
||||
return Session.account_statuses(
|
||||
UserID,
|
||||
exclude_replies=True)
|
||||
|
||||
def MastodonDoPost(Session):
|
||||
pass # mastodon.toot('Tooting from python using #mastodonpy !')
|
@@ -22,11 +22,13 @@ OpenTags = (
|
||||
'img')
|
||||
|
||||
def GemtextCompileList(Pages):
|
||||
Cmd = ''
|
||||
for File, Content, Titles, Meta, HTMLContent, Description, Image in Pages:
|
||||
Src = 'public/{}.html.tmp'.format(StripExt(File))
|
||||
WriteFile(Src, HTMLContent)
|
||||
Src = 'public.gmi/{}.html.tmp'.format(StripExt(File))
|
||||
WriteFile(Src, HTMLContent.replace('.html', '.gmi')) # TODO: Adjust links properly..
|
||||
Dst = 'public.gmi/{}.gmi'.format(StripExt(File))
|
||||
os.system('cat {} | html2gmi > {}'.format(Src, Dst))
|
||||
Cmd += 'cat "{}" | html2gmi > "{}"; '.format(Src, Dst)
|
||||
os.system(Cmd)
|
||||
|
||||
def FindEarliest(Str, Items):
|
||||
Pos, Item = 0, ''
|
||||
|
Reference in New Issue
Block a user