Compare commits
123 commits
Author | SHA1 | Date | |
---|---|---|---|
93aae1f7d6 | |||
795d5397e7 | |||
4a83bee3fc | |||
e681d7be23 | |||
e14c07204a | |||
979f6a3a80 | |||
0fa7a15296 | |||
257adb6bb5 | |||
8b509e9f8c | |||
176b919edf | |||
39333ea4fe | |||
f79529e0ea | |||
2a8171b9bb | |||
a91003568f | |||
99323a05ef | |||
47126a7b75 | |||
fd72cdecfa | |||
4b52c1214a | |||
8bb9e6c0f8 | |||
9f253e4401 | |||
643541f798 | |||
14f66cb2e1 | |||
ec9e4ae300 | |||
ff49e13b86 | |||
773ecc1820 | |||
|
0f330ca3c7 | ||
|
1cde7289c5 | ||
0b85045158 | |||
524ee19dc8 | |||
|
6a637dc2cf | ||
8f02c0124f | |||
|
a7ac9fab94 | ||
8d41a8236d | |||
1e1eb7786e | |||
daf9149b04 | |||
142b74cd9b | |||
6a7e7deac6 | |||
73943a9af9 | |||
9ef30bd5a2 | |||
bc604143b1 | |||
6bcbfa4da6 | |||
b16e3ea61f | |||
1fe7b2ed78 | |||
|
e0a735e9bc | ||
430911272e | |||
a21ff9592d | |||
aa5afcd90f | |||
19e602bf9c | |||
644717d272 | |||
90ec08522d | |||
8422e3580a | |||
4fe4060a1f | |||
07c7caade1 | |||
1143ba78a4 | |||
4537956c41 | |||
4f8eeb3eea | |||
ad352eb7fb | |||
43a3cbe6af | |||
098403588f | |||
30f7ecd612 | |||
b0d0ba9bd7 | |||
ea01bfe676 | |||
eb78652718 | |||
02b6af0e91 | |||
a7ca30cf09 | |||
0ff6f40af8 | |||
051800a3d2 | |||
c78a4dfdbe | |||
0a83f43921 | |||
af4f94adfc | |||
dce3eb0bb9 | |||
2d0dcf60a3 | |||
a2265d6b42 | |||
52c4574a3b | |||
b8cbac40f6 | |||
6a99a4a9ea | |||
88aee64dad | |||
6c9372c80f | |||
b01bae1f93 | |||
92456c16bf | |||
a5f4be5dc2 | |||
ed7c2a1f5f | |||
afb4152500 | |||
e2f74a7109 | |||
e356bae922 | |||
d926031406 | |||
d35335c234 | |||
7c5bc8f412 | |||
efea7a59bf | |||
38291503a3 | |||
eb13c31062 | |||
0b0b387ec8 | |||
0e7a16f59b | |||
1821e2bf08 | |||
4114318ded | |||
9f75c9ed0d | |||
93b1faff6a | |||
9106a08e6b | |||
70002e018a | |||
45b06cfba6 | |||
f2dbb2cf49 | |||
557f9fb56f | |||
cff37e8dfd | |||
1f8610410d | |||
f4b4e69516 | |||
0376c46f7a | |||
683df41e2a | |||
e30b09484f | |||
668b5a77ae | |||
dbf2f71b9f | |||
eb9c1d11ab | |||
2b1b032039 | |||
4c494e7d33 | |||
bb5d0eab5f | |||
e6eef65e1b | |||
96de64e06e | |||
fce8227f66 | |||
a32e895f7a | |||
0475e3b986 | |||
4bde2412fe | |||
e678de8f4e | |||
fc45b37012 | |||
cb7ec39d76 |
29 changed files with 1851 additions and 577 deletions
3
.github/FUNDING.yml
vendored
3
.github/FUNDING.yml
vendored
|
@ -1,3 +0,0 @@
|
||||||
# These are supported funding model platforms
|
|
||||||
|
|
||||||
github: jerger
|
|
117
.github/workflows/stable.yml
vendored
117
.github/workflows/stable.yml
vendored
|
@ -1,117 +0,0 @@
|
||||||
name: stable
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '[0-9]+.[0-9]+.[0-9]+'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
stable:
|
|
||||||
name: stable
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [14.x]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
|
|
||||||
- name: test em
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm install -g --save-dev shadow-cljs
|
|
||||||
shadow-cljs compile test
|
|
||||||
|
|
||||||
- name: build em
|
|
||||||
run: |
|
|
||||||
shadow-cljs release frontend
|
|
||||||
sha256sum public/js/main.js > target/dda-masto-embed.js.sha256
|
|
||||||
sha512sum public/js/main.js > target/dda-masto-embed.js.sha512
|
|
||||||
shadow-cljs run shadow.cljs.build-report frontend target/build-report.html
|
|
||||||
|
|
||||||
- name: Create Release
|
|
||||||
id: create_release
|
|
||||||
uses: actions/create-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
tag_name: ${{ github.ref }}
|
|
||||||
release_name: Release ${{ github.ref }}
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
|
|
||||||
- name: Upload masto-embed.js
|
|
||||||
id: upload-masto-embed-js
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: public/js/main.js
|
|
||||||
asset_name: dda-masto-embed.js
|
|
||||||
asset_content_type: application/javascript
|
|
||||||
|
|
||||||
- name: Upload masto-embed.js.sha256
|
|
||||||
id: upload-masto-embed-js-sha256
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: target/dda-masto-embed.js.sha256
|
|
||||||
asset_name: dda-masto-embed.js.sha256
|
|
||||||
asset_content_type: text/plain
|
|
||||||
|
|
||||||
- name: Upload masto-embed.js.sha512
|
|
||||||
id: upload-masto-embed-js-sha512
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: target/dda-masto-embed.js.sha512
|
|
||||||
asset_name: dda-masto-embed.js.sha512
|
|
||||||
asset_content_type: text/plain
|
|
||||||
|
|
||||||
- name: Upload build report
|
|
||||||
id: build-report
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: target/build-report.html
|
|
||||||
asset_name: build-report.html
|
|
||||||
asset_content_type: text/html
|
|
||||||
|
|
||||||
- name: upload to npm
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
run: |
|
|
||||||
mkdir -p target/npm-build/
|
|
||||||
cp public/js/main.js target/npm-build/dda-masto-embed.js
|
|
||||||
cp target/dda-masto-embed.js.sha256 target/npm-build/
|
|
||||||
cp target/dda-masto-embed.js.sha512 target/npm-build/
|
|
||||||
cp package.json target/npm-build/
|
|
||||||
cp README.md target/npm-build/
|
|
||||||
cp -r doc target/npm-build/
|
|
||||||
cp LICENSE target/npm-build/
|
|
||||||
npm publish target/npm-build --access public
|
|
41
.github/workflows/unstable.yml
vendored
41
.github/workflows/unstable.yml
vendored
|
@ -1,41 +0,0 @@
|
||||||
name: unstable
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '![0-9]+.[0-9]+.[0-9]+'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
unstable:
|
|
||||||
name: unstable
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [14.x]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
|
|
||||||
- name: test em
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm install -g --save-dev shadow-cljs
|
|
||||||
shadow-cljs compile test
|
|
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -19,3 +19,9 @@ node_modules/
|
||||||
/public/js
|
/public/js
|
||||||
/out
|
/out
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
/.lsp/
|
||||||
|
/.clj-kondo/
|
||||||
|
|
||||||
|
*.pyc
|
||||||
|
t2
|
||||||
|
t1
|
||||||
|
|
55
.gitlab-ci.yml
Normal file
55
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
stages:
|
||||||
|
- build_and_test
|
||||||
|
- package
|
||||||
|
- upload
|
||||||
|
|
||||||
|
.cljs-job: &cljs
|
||||||
|
image: "domaindrivenarchitecture/ddadevops-clj-cljs:4.11.3"
|
||||||
|
cache:
|
||||||
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
|
paths:
|
||||||
|
- node_modules/
|
||||||
|
- .shadow-cljs/
|
||||||
|
- .m2
|
||||||
|
before_script:
|
||||||
|
- export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW
|
||||||
|
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
|
||||||
|
- npm install
|
||||||
|
|
||||||
|
.tag_only: &tag_only
|
||||||
|
rules:
|
||||||
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||||
|
when: never
|
||||||
|
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
||||||
|
|
||||||
|
test-cljs:
|
||||||
|
<<: *cljs
|
||||||
|
stage: build_and_test
|
||||||
|
script:
|
||||||
|
- pyb test_cljs
|
||||||
|
|
||||||
|
report-frontend:
|
||||||
|
<<: *cljs
|
||||||
|
stage: package
|
||||||
|
script:
|
||||||
|
- pyb report_frontend
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/build-report.html
|
||||||
|
|
||||||
|
package-frontend:
|
||||||
|
<<: *cljs
|
||||||
|
stage: package
|
||||||
|
script:
|
||||||
|
- pyb package_frontend
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/
|
||||||
|
|
||||||
|
release-to-forgejo:
|
||||||
|
<<: *cljs
|
||||||
|
<<: *tag_only
|
||||||
|
stage: upload
|
||||||
|
script:
|
||||||
|
- pyb publish_artifacts
|
||||||
|
|
109
README.md
109
README.md
|
@ -1,32 +1,42 @@
|
||||||
# dda-masto-embed
|
# dda-masto-embed
|
||||||
![build](https://github.com/DomainDrivenArchitecture/dda-masto-embed/workflows/build-it/badge.svg)
|
|
||||||
|
|
||||||
[<img src="https://meissa-gmbh.de/img/community/Mastodon_Logotype.svg" width=20 alt="team@social.meissa-gmbh.de"> team@social.meissa-gmbh.de](https://social.meissa-gmbh.de/@team) | [Website & Blog](https://domaindrivenarchitecture.org)
|
![build](https://gitlab.com/domaindrivenarchitecture/dda-masto-embed/-/commits/master) | [![pipeline status](https://gitlab.com/domaindrivenarchitecture/dda-masto-embed/badges/main/pipeline.svg)](https://gitlab.com/domaindrivenarchitecture/dda-masto-embed/-/commits/master)
|
||||||
|
|
||||||
|
[<img src="https://domaindrivenarchitecture.org/img/delta-chat.svg" width=20 alt="DeltaChat"> chat over e-mail](mailto:buero@meissa-gmbh.de?subject=community-chat) | [<img src="https://meissa.de/images/parts/contact/mastodon36_hue9b2464f10b18e134322af482b9c915e_5501_filter_14705073121015236177.png" width=20 alt="M"> meissa@social.meissa-gmbh.de](https://social.meissa-gmbh.de/@meissa) | [Blog](https://domaindrivenarchitecture.org) | [Website](https://meissa.de)
|
||||||
|
|
||||||
|
## In brief
|
||||||
|
|
||||||
|
dda-masto-embed embedd either your timeline or replies to a specific post on your website.
|
||||||
|
|
||||||
## in brief
|
|
||||||
Embeds mastodon timeline into a html page.
|
|
||||||
* Uses JS, **no intermediate server** required,
|
* Uses JS, **no intermediate server** required,
|
||||||
* example at [meissa-gmbh.de](https://meissa-gmbh.de/pages/news/)
|
* in replies mode you can decide to show only favorited replies in order to do upfront moderation
|
||||||
|
* example for embedding a timeline at [meissa.de/news](https://meissa.de/news/)
|
||||||
|
* example for embedding replies to a specific post at [meissa.de/sustainibility_microplastic](https://meissa.de/about-meissa/03plastik-aktion/)
|
||||||
* Download latest version at:
|
* Download latest version at:
|
||||||
* [dda-masto-embed.js](https://domaindrivenarchitecture.org/downloads/downloads/dda-masto-embed.js)
|
* [dda-masto-embed.js](https://repo.prod.meissa.de/attachments/fd727528-0ab4-42d1-bade-8ff129997315)
|
||||||
* [dda-masto-embed.js.sha256](https://domaindrivenarchitecture.org/downloads/downloads/dda-masto-embed.js.sha256)
|
* [dda-masto-embed.js.sha256](https://repo.prod.meissa.de/attachments/fd727528-0ab4-42d1-bade-8ff129997315)
|
||||||
* [dda-masto-embed.js.sha512](https://domaindrivenarchitecture.org/downloads/downloads/dda-masto-embed.js.sha512)
|
* [dda-masto-embed.js.sha512](https://repo.prod.meissa.de/attachments/fd727528-0ab4-42d1-bade-8ff129997315)
|
||||||
* It is **OpenSource** - published under the Apache License, Version 2.0
|
* It is **OpenSource** - published under the Apache License, Version 2.0
|
||||||
|
|
||||||
## how it looks
|
### css and html as base
|
||||||
![masto-embed-example.png](doc/masto-embed-example.png)
|
|
||||||
|
|
||||||
## how to try it out
|
Uses a generalized HTML structure with descriptive classes and css grid for styling.
|
||||||
In order to try it, just create a html like
|
The structure in the css follows the html structure. Both accound mode and replies mode are styled there.
|
||||||
```
|
|
||||||
|
Re-styling your timeline should now be a breeze.
|
||||||
|
|
||||||
|
## Include a timeline
|
||||||
|
|
||||||
|
Including a timeline needs the following html. The div with id `masto-embed` configures the timeline to be shown.
|
||||||
|
We use bootstrap for rough styling. More styling is up to you at the moment, help is welcome :-)
|
||||||
|
|
||||||
|
```html
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>masto-embed</title>
|
<title>masto-embed</title>
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
|
<link rel="stylesheet" href="post.css">
|
||||||
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
|
|
||||||
crossorigin="anonymous">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="masto-embed"
|
<div id="masto-embed"
|
||||||
|
@ -39,17 +49,49 @@ In order to try it, just create a html like
|
||||||
</html>
|
</html>
|
||||||
```
|
```
|
||||||
|
|
||||||
We use bootstrap for rough styling. More styling is up to you at the moment, help is welcome :-)
|
Reference:
|
||||||
|
|
||||||
## using in reply mode
|
* `id` has to be `masto-embed`
|
||||||
Add `replies_to=<REPLY-ID>` and optionally whether you only want to include favorited replies as
|
* `account_name` is the name of your account.
|
||||||
`filter_favorited=<true|false>` to the div.
|
* `host_url` the url of your mastodon instance.
|
||||||
|
* Use the `post.css` from the src/main/resources or the public folder.
|
||||||
|
|
||||||
Instead of embedding all Posts of one account, this will fetch the replies to one Post and display them
|
## Using in reply mode
|
||||||
|
|
||||||
## dev setup
|
Including replies of one of your posts will work as follows:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>masto-embed</title>
|
||||||
|
<link rel="stylesheet" href="post.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="masto-embed"
|
||||||
|
account_name="team"
|
||||||
|
replies_to="112432461907918517"
|
||||||
|
filter_favorited=false
|
||||||
|
host_url="https://social.meissa-gmbh.de">
|
||||||
|
Here the timeline will appear.
|
||||||
|
</div>
|
||||||
|
<script src="https://domaindrivenarchitecture.org/downloads/dda-masto-embed.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference:
|
||||||
|
|
||||||
|
* `id` has to be `masto-embed`
|
||||||
|
* `account_name` is the name of your account.
|
||||||
|
* `host_url` the url of your mastodon instance.
|
||||||
|
* `replies_to` the id of your post.
|
||||||
|
* `filter_favorited=<true|false>` true will show only favorited replies, false will show every answer.
|
||||||
|
|
||||||
|
## Dev setup
|
||||||
|
|
||||||
|
```bash
|
||||||
npm install -g npx
|
npm install -g npx
|
||||||
npm install -g shadow-cljs
|
npm install -g shadow-cljs
|
||||||
npm install -g source-map-support --save-dev
|
npm install -g source-map-support --save-dev
|
||||||
|
@ -61,16 +103,17 @@ open browser at http://localhost:8080
|
||||||
|
|
||||||
Connect your repl for :frontend
|
Connect your repl for :frontend
|
||||||
|
|
||||||
|
## Run the tests
|
||||||
|
|
||||||
## run the tests
|
```bash
|
||||||
|
|
||||||
```
|
|
||||||
shadow-cljs compile test
|
shadow-cljs compile test
|
||||||
```
|
```
|
||||||
|
|
||||||
## releasing
|
## Releasing
|
||||||
|
|
||||||
### prod release
|
### prod release
|
||||||
```
|
|
||||||
|
```bash
|
||||||
#adjust version
|
#adjust version
|
||||||
vi package.json
|
vi package.json
|
||||||
git commit -am 'releasing'
|
git commit -am 'releasing'
|
||||||
|
@ -82,8 +125,18 @@ vi package.json
|
||||||
git commit -am "version bump" && git push
|
git commit -am "version bump" && git push
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Development & mirrors
|
||||||
|
|
||||||
|
Development happens at: https://repo.prod.meissa.de/meissa/dda-masto-embed
|
||||||
|
|
||||||
|
Mirrors are:
|
||||||
|
|
||||||
|
* https://codeberg.org/meissa/dda-masto-embed (issues and PR)
|
||||||
|
* https://gitlab.com/domaindrivenarchitecture/dda-masto-embed (CI issues and PR)
|
||||||
|
* https://github.com/DomainDrivenArchitecture/dda-masto-embed
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright © 2021 meissa GmbH
|
Copyright © 2024 meissa GmbH
|
||||||
Licensed under the [Apache License, Version 2.0](LICENSE) (the "License")
|
Licensed under the [Apache License, Version 2.0](LICENSE) (the "License")
|
||||||
Pls. find licenses of our subcomponents [here](doc/SUBCOMPONENT_LICENSE)
|
Pls. find licenses of our subcomponents [here](doc/SUBCOMPONENT_LICENSE)
|
133
build.py
Normal file
133
build.py
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
from os import environ
|
||||||
|
from subprocess import run
|
||||||
|
from pybuilder.core import init, task
|
||||||
|
from ddadevops import *
|
||||||
|
|
||||||
|
default_task = "dev"
|
||||||
|
base_name = "dda-masto-embed"
|
||||||
|
name = 'dda-masto-embed'
|
||||||
|
MODULE = 'not-used'
|
||||||
|
PROJECT_ROOT_PATH = '.'
|
||||||
|
|
||||||
|
version = "1.0.2-dev"
|
||||||
|
|
||||||
|
@init
|
||||||
|
def initialize(project):
|
||||||
|
project.build_depends_on("ddadevops>=4.7.0")
|
||||||
|
|
||||||
|
input = {
|
||||||
|
"name": name,
|
||||||
|
"module": MODULE,
|
||||||
|
"stage": "notused",
|
||||||
|
"project_root_path": PROJECT_ROOT_PATH,
|
||||||
|
"build_types": [],
|
||||||
|
"mixin_types": ["RELEASE"],
|
||||||
|
"release_primary_build_file": "package.json",
|
||||||
|
"release_secondary_build_files": [
|
||||||
|
"build.py"
|
||||||
|
],
|
||||||
|
"release_artifact_server_url": "https://repo.prod.meissa.de",
|
||||||
|
"release_organisation": "meissa",
|
||||||
|
"release_repository_name": name,
|
||||||
|
"release_artifacts": [
|
||||||
|
f"target/{name}.js",
|
||||||
|
],
|
||||||
|
"release_main_branch": "master",
|
||||||
|
}
|
||||||
|
|
||||||
|
build = ReleaseMixin(project, input)
|
||||||
|
build.initialize_build_dir()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def test(project):
|
||||||
|
test_cljs(project)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def test_cljs(project):
|
||||||
|
run("shadow-cljs compile test", shell=True, check=True)
|
||||||
|
run("node target/node-tests.js", shell=True, check=True)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def report_frontend(project):
|
||||||
|
run("mkdir -p target/frontend-build", shell=True, check=True)
|
||||||
|
run(
|
||||||
|
"shadow-cljs run shadow.cljs.build-report frontend target/build-report.html",
|
||||||
|
shell=True,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def package_frontend(project):
|
||||||
|
run("mkdir -p target/", shell=True, check=True)
|
||||||
|
run("shadow-cljs release frontend", shell=True, check=True)
|
||||||
|
run(
|
||||||
|
f"cp public/js/main.js target/{name}.js",
|
||||||
|
shell=True,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
run(
|
||||||
|
f"sha256sum target/{name}.js > target/{name}.js.sha256",
|
||||||
|
shell=True,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
run(
|
||||||
|
f"sha512sum target/{name}.js > target/{name}.js.sha512",
|
||||||
|
shell=True,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def patch(project):
|
||||||
|
linttest(project, "PATCH")
|
||||||
|
release(project)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def minor(project):
|
||||||
|
linttest(project, "MINOR")
|
||||||
|
release(project)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def major(project):
|
||||||
|
linttest(project, "MAJOR")
|
||||||
|
release(project)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def dev(project):
|
||||||
|
linttest(project, "NONE")
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def prepare(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.prepare_release()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def tag(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.tag_bump_and_push_release()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def publish_artifacts(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.publish_artifacts()
|
||||||
|
|
||||||
|
|
||||||
|
def release(project):
|
||||||
|
prepare(project)
|
||||||
|
tag(project)
|
||||||
|
|
||||||
|
|
||||||
|
def linttest(project, release_type):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.update_release_type(release_type)
|
||||||
|
test_cljs(project)
|
20
doc/media-reference.edn
Normal file
20
doc/media-reference.edn
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
:media_attachments
|
||||||
|
[{:description "Plastikmüll gesammelt",
|
||||||
|
:meta
|
||||||
|
{:original
|
||||||
|
{:width 1500, :height 2000, :size "1500x2000", :aspect 0.75},
|
||||||
|
:small
|
||||||
|
{:width 416,
|
||||||
|
:height 554,
|
||||||
|
:size "416x554",
|
||||||
|
:aspect 0.7509025270758123}},
|
||||||
|
:type "image",
|
||||||
|
:blurhash "UAFiMmx^9aE1yEjEM|%N0eD%w]t7D$%NR4tR",
|
||||||
|
:preview_url
|
||||||
|
"https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/small/0d01ddb07440328e.jpg",
|
||||||
|
:preview_remote_url nil,
|
||||||
|
:id "112432505467393505",
|
||||||
|
:url
|
||||||
|
"https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/original/0d01ddb07440328e.jpg",
|
||||||
|
:remote_url nil,
|
||||||
|
:text_url nil}],
|
88
doc/status-reference.edn
Normal file
88
doc/status-reference.edn
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
{:mentions
|
||||||
|
[{:id "109517000301838437",
|
||||||
|
:username "J12t",
|
||||||
|
:url "https://social.coop/@J12t",
|
||||||
|
:acct "J12t@social.coop"}],
|
||||||
|
:emojis [],
|
||||||
|
:tags
|
||||||
|
[{:name "federation",
|
||||||
|
:url "https://social.meissa-gmbh.de/tags/federation"}
|
||||||
|
{:name "test", :url "https://social.meissa-gmbh.de/tags/test"}],
|
||||||
|
:reblog nil,
|
||||||
|
:replies_count 1,
|
||||||
|
:in_reply_to_account_id nil,
|
||||||
|
:reblogs_count 0,
|
||||||
|
:content
|
||||||
|
"<p><span class=\"h-card\" translate=\"no\"><a href=\"https://social.coop/@J12t\" class=\"u-url mention\">@<span>J12t</span></a></span> Hi Johannes, do you have a solution for such integration tests in place / planed?</p><p><a href=\"https://codeberg.org/forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go#L76-L115\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" translate=\"no\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">codeberg.org/forgejo/forgejo/s</span><span class=\"invisible\">rc/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go#L76-L115</span></a></p><p>Would love to be able to make better integration tests ...</p><p><a href=\"https://social.meissa-gmbh.de/tags/federation\" class=\"mention hashtag\" rel=\"tag\">#<span>federation</span></a> <a href=\"https://social.meissa-gmbh.de/tags/test\" class=\"mention hashtag\" rel=\"tag\">#<span>test</span></a></p>",
|
||||||
|
:sensitive false,
|
||||||
|
:favourites_count 1,
|
||||||
|
:in_reply_to_id nil,
|
||||||
|
:poll nil,
|
||||||
|
:account
|
||||||
|
{:acct "meissa",
|
||||||
|
:last_status_at "2024-05-15",
|
||||||
|
:emojis [],
|
||||||
|
:bot false,
|
||||||
|
:group false,
|
||||||
|
:following_count 80,
|
||||||
|
:avatar_static
|
||||||
|
"https://cdn.masto.host/socialmeissagmbhde/accounts/avatars/112/400/753/820/571/578/original/fd05f46bcc0c5c69.png",
|
||||||
|
:roles [],
|
||||||
|
:fields
|
||||||
|
[{:name "See also",
|
||||||
|
:value
|
||||||
|
"<a href=\"https://meissa.de\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\" translate=\"no\"><span class=\"invisible\">https://</span><span class=\"\">meissa.de</span><span class=\"invisible\"></span></a>",
|
||||||
|
:verified_at "2024-05-14T09:08:20.463+00:00"}
|
||||||
|
{:name "OpenPGP",
|
||||||
|
:value "DF43207F1ABF673D8C7F5D1D756A2A4873B93D34",
|
||||||
|
:verified_at nil}],
|
||||||
|
:username "meissa",
|
||||||
|
:header_static
|
||||||
|
"https://cdn.masto.host/socialmeissagmbhde/accounts/headers/112/400/753/820/571/578/original/915998366b020667.jpg",
|
||||||
|
:discoverable true,
|
||||||
|
:statuses_count 10,
|
||||||
|
:header
|
||||||
|
"https://cdn.masto.host/socialmeissagmbhde/accounts/headers/112/400/753/820/571/578/original/915998366b020667.jpg",
|
||||||
|
:note
|
||||||
|
"<p>DevOps, Cloud, KI, Clojure, Kotlin, JVM, Python & k8s, Germany, Reutlingen, Tübingen, Stuttgart, genossenschaftlich, OpenSource, TestDriven, Maintainer, Forgejo, Federation</p>",
|
||||||
|
:noindex false,
|
||||||
|
:locked false,
|
||||||
|
:id "112400753820571578",
|
||||||
|
:avatar
|
||||||
|
"https://cdn.masto.host/socialmeissagmbhde/accounts/avatars/112/400/753/820/571/578/original/fd05f46bcc0c5c69.png",
|
||||||
|
:url "https://social.meissa-gmbh.de/@meissa",
|
||||||
|
:uri "https://social.meissa-gmbh.de/users/meissa",
|
||||||
|
:display_name "meissa-team",
|
||||||
|
:followers_count 172,
|
||||||
|
:created_at "2024-05-07T00:00:00.000Z"},
|
||||||
|
:card
|
||||||
|
{:description "forgejo - Beyond coding. We forge.",
|
||||||
|
:author_url "",
|
||||||
|
:image_description "",
|
||||||
|
:width 290,
|
||||||
|
:type "link",
|
||||||
|
:embed_url "",
|
||||||
|
:blurhash "URC3:FsU1xJS-8NvJ9$OFIS3wexEJ9n*xEbG",
|
||||||
|
:title
|
||||||
|
"forgejo/tests/integration/api_activitypub_repository_test.go at fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e",
|
||||||
|
:published_at nil,
|
||||||
|
:provider_name "Codeberg.org",
|
||||||
|
:language "en",
|
||||||
|
:url
|
||||||
|
"https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go",
|
||||||
|
:author_name "",
|
||||||
|
:image
|
||||||
|
"https://cdn.masto.host/socialmeissagmbhde/cache/preview_cards/images/000/545/643/original/199336f5aa5b9683.png",
|
||||||
|
:provider_url "",
|
||||||
|
:height 290,
|
||||||
|
:html ""},
|
||||||
|
:language "en",
|
||||||
|
:id "112446229070164194",
|
||||||
|
:url "https://social.meissa-gmbh.de/@meissa/112446229070164194",
|
||||||
|
:media_attachments [],
|
||||||
|
:uri
|
||||||
|
"https://social.meissa-gmbh.de/users/meissa/statuses/112446229070164194",
|
||||||
|
:edited_at nil,
|
||||||
|
:visibility "public",
|
||||||
|
:created_at "2024-05-15T17:14:50.257Z",
|
||||||
|
:spoiler_text ""}
|
10
package.json
10
package.json
|
@ -1,17 +1,17 @@
|
||||||
{
|
{
|
||||||
"name": "dda-masto-embed",
|
"name": "dda-masto-embed",
|
||||||
"author": "meissa GmbH",
|
"author": "meissa GmbH",
|
||||||
"version": "0.2.0",
|
"version": "1.0.2-SNAPSHOT",
|
||||||
"homepage": "https://github.com/DomainDrivenArchitecture/dda-masto-embed",
|
"homepage": "https://github.com/DomainDrivenArchitecture/dda-masto-embed",
|
||||||
"repository": "https://github.com/DomainDrivenArchitecture/dda-masto-embed",
|
"repository": "https://github.com/DomainDrivenArchitecture/dda-masto-embed",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"shadow-cljs": "^2.17.6",
|
|
||||||
"source-map-support": "^0.5.21",
|
|
||||||
"eslint": ">=8.10.0",
|
|
||||||
"ajv": "^8.10",
|
"ajv": "^8.10",
|
||||||
"lodash.template": ">=4.5.0"
|
"eslint": ">=8.10.0",
|
||||||
|
"lodash.template": ">=4.5.0",
|
||||||
|
"shadow-cljs": "^2.17.8",
|
||||||
|
"source-map-support": "^0.5.21"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mastodon-api": "^1.3.0"
|
"mastodon-api": "^1.3.0"
|
||||||
|
|
|
@ -3,14 +3,15 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>masto-embed</title>
|
<title>masto-embed</title>
|
||||||
|
<link rel="stylesheet" href="post.css">
|
||||||
</head>
|
</head>
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="masto-embed"
|
<div id="masto-embed"
|
||||||
account_name="team"
|
account_name="meissa"
|
||||||
coment_in_account_id="2"
|
host_url="https://social.meissa-gmbh.de"
|
||||||
host_url="https://social.meissa-gmbh.de">
|
replies_to="112432461907918517"
|
||||||
|
filter_favorited=true>
|
||||||
Here the timeline will appear.
|
Here the timeline will appear.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
358
public/post.css
Normal file
358
public/post.css
Normal file
|
@ -0,0 +1,358 @@
|
||||||
|
.section.account-mode {
|
||||||
|
--large: 1em;
|
||||||
|
--medium: 0.5em;
|
||||||
|
--small: 0.25em;
|
||||||
|
margin-bottom: var(--large);
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
grid: ". post ." / auto auto auto;
|
||||||
|
|
||||||
|
font-size: calc(clamp(0.8rem, 19200.75rem - 40000vw, 1.0rem) + max(0.75rem, 0.5rem + 0.5208333vw) - 0.75rem);
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
|
||||||
|
.mastodon-post {
|
||||||
|
grid-area: post;
|
||||||
|
justify-self: center;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"header"
|
||||||
|
"content"
|
||||||
|
"image"
|
||||||
|
"link-preview"
|
||||||
|
"footer" /
|
||||||
|
minmax(380px, 450px);
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: var(--small);
|
||||||
|
|
||||||
|
.mastodon-post-header {
|
||||||
|
grid-area: header;
|
||||||
|
justify-self: stretch;
|
||||||
|
display: grid;
|
||||||
|
grid: "avatar names . date" / max-content max-content auto 20%;
|
||||||
|
margin: var(--medium);
|
||||||
|
|
||||||
|
.mastodon-post-avatar {
|
||||||
|
grid-area: avatar;
|
||||||
|
width: auto;
|
||||||
|
max-height: 60px;
|
||||||
|
object-fit: contain;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-names {
|
||||||
|
grid-area: names;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"dp-name"
|
||||||
|
"ac-name" /
|
||||||
|
auto;
|
||||||
|
justify-self: start;
|
||||||
|
margin-left: var(--medium);
|
||||||
|
|
||||||
|
.display-name {
|
||||||
|
grid-area: dp-name;
|
||||||
|
align-self: end;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-name {
|
||||||
|
grid-area: ac-name;
|
||||||
|
align-self: start;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-date {
|
||||||
|
font-size: 85%;
|
||||||
|
grid-area: date;
|
||||||
|
justify-self: end;
|
||||||
|
align-self: center;
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-content {
|
||||||
|
grid-area: content;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"text"
|
||||||
|
"image" / 100%;
|
||||||
|
padding: var(--medium);
|
||||||
|
|
||||||
|
.mastodon-post-text {
|
||||||
|
grid-area: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-image {
|
||||||
|
grid-area: image;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
align-self: center;
|
||||||
|
justify-self: center;
|
||||||
|
border-radius: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-preview {
|
||||||
|
grid-area: link-preview;
|
||||||
|
justify-self: center;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"image"
|
||||||
|
"info" / 100%;
|
||||||
|
text-decoration: none;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: var(--small);
|
||||||
|
margin: var(--medium);
|
||||||
|
|
||||||
|
.mastodon-post-link-image{
|
||||||
|
grid-area: image;
|
||||||
|
justify-self: center;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius:var(--small);
|
||||||
|
margin-bottom: var(--small);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-info {
|
||||||
|
grid-area: info;
|
||||||
|
grid:
|
||||||
|
"link-title"
|
||||||
|
"link-description"
|
||||||
|
"link-url"
|
||||||
|
/ auto;
|
||||||
|
padding: var(--small);
|
||||||
|
|
||||||
|
.mastodon-post-link-title {
|
||||||
|
grid-area: link-title;
|
||||||
|
color: #383838;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-description {
|
||||||
|
grid-area: link-description;
|
||||||
|
color: #383838;
|
||||||
|
padding-bottom: var(--medium);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-url {
|
||||||
|
grid-area: link-url;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-footer {
|
||||||
|
margin-right: var(--medium);
|
||||||
|
margin-left: var(--medium);
|
||||||
|
grid-area: footer;
|
||||||
|
display: grid;
|
||||||
|
justify-content: space-between;
|
||||||
|
grid:
|
||||||
|
"replies retoots likes"
|
||||||
|
/ auto auto auto;
|
||||||
|
padding-top: var(--small);
|
||||||
|
|
||||||
|
.footer-button {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
display: flex;
|
||||||
|
svg {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
margin-right: var(--small);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.replies {
|
||||||
|
justify-self: center;
|
||||||
|
grid-area: replies;
|
||||||
|
}
|
||||||
|
|
||||||
|
.retoots {
|
||||||
|
justify-self: center;
|
||||||
|
grid-area: retoots;
|
||||||
|
}
|
||||||
|
|
||||||
|
.likes {
|
||||||
|
justify-self: center;
|
||||||
|
grid-area: likes;
|
||||||
|
}
|
||||||
|
|
||||||
|
.like-count {
|
||||||
|
justify-self: center;
|
||||||
|
grid-area: like-count;
|
||||||
|
}
|
||||||
|
|
||||||
|
.retoot-count {
|
||||||
|
justify-self: center;
|
||||||
|
grid-area: retoot-count;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reply-count {
|
||||||
|
justify-self: center;
|
||||||
|
grid-area: reply-count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.section.replies-mode {
|
||||||
|
--large: 1em;
|
||||||
|
--medium: 0.5em;
|
||||||
|
--small: 0.25em;
|
||||||
|
margin-bottom: var(--large);
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
grid: ". post ." / auto auto auto;
|
||||||
|
|
||||||
|
font-size: calc(clamp(0.8rem, 19200.75rem - 40000vw, 1.0rem) + max(0.75rem, 0.5rem + 0.5208333vw) - 0.75rem);
|
||||||
|
|
||||||
|
.mastodon-post {
|
||||||
|
grid-area: post;
|
||||||
|
justify-self: center;
|
||||||
|
align-self: start;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"header"
|
||||||
|
"content"
|
||||||
|
"image"
|
||||||
|
"link-preview"
|
||||||
|
"footer" /
|
||||||
|
minmax(380px, 450px);
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: var(--small);
|
||||||
|
|
||||||
|
.mastodon-post-header {
|
||||||
|
grid-area: header;
|
||||||
|
justify-self: stretch;
|
||||||
|
display: grid;
|
||||||
|
grid: "avatar names . date" / max-content max-content auto 20%;
|
||||||
|
margin: var(--medium);
|
||||||
|
|
||||||
|
.mastodon-post-avatar {
|
||||||
|
grid-area: avatar;
|
||||||
|
width: auto;
|
||||||
|
max-height: 60px;
|
||||||
|
object-fit: contain;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-names {
|
||||||
|
grid-area: names;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"dp-name"
|
||||||
|
"ac-name" /
|
||||||
|
auto;
|
||||||
|
justify-self: start;
|
||||||
|
margin-left: var(--medium);
|
||||||
|
|
||||||
|
.display-name {
|
||||||
|
grid-area: dp-name;
|
||||||
|
align-self: end;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-name {
|
||||||
|
grid-area: ac-name;
|
||||||
|
align-self: start;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-date {
|
||||||
|
font-size: 85%;
|
||||||
|
grid-area: date;
|
||||||
|
justify-self: end;
|
||||||
|
align-self: center;
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-content {
|
||||||
|
grid-area: content;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"image text" / minmax(40%, 108px) auto;
|
||||||
|
padding: var(--medium);
|
||||||
|
|
||||||
|
.mastodon-post-text {
|
||||||
|
grid-area: text;
|
||||||
|
align-self: center;
|
||||||
|
display: grid;
|
||||||
|
padding: var(--medium) 0 var(--medium) var(--medium);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-image {
|
||||||
|
grid-area: image;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
align-self: center;
|
||||||
|
justify-self: center;
|
||||||
|
border-radius: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-preview {
|
||||||
|
grid-area: link-preview;
|
||||||
|
justify-self: center;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"image"
|
||||||
|
"info" / 100%;
|
||||||
|
text-decoration: none;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: var(--small);
|
||||||
|
margin: var(--medium);
|
||||||
|
|
||||||
|
.mastodon-post-link-image{
|
||||||
|
grid-area: image;
|
||||||
|
justify-self: center;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: var(--small);
|
||||||
|
margin-bottom: var(--small);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-info {
|
||||||
|
grid-area: info;
|
||||||
|
grid:
|
||||||
|
"." "link-title" "."
|
||||||
|
"." "link-description" "."
|
||||||
|
"." "link-url" "." / auto auto auto;
|
||||||
|
padding: var(--small);
|
||||||
|
|
||||||
|
.mastodon-post-link-title {
|
||||||
|
grid-area: link-title;
|
||||||
|
color: #383838;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-description {
|
||||||
|
color: #383838;
|
||||||
|
grid-area: link-description;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-url {
|
||||||
|
grid-area: link-url;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-footer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,24 +1,23 @@
|
||||||
;; shadow-cljs configuration
|
;; shadow-cljs configuration
|
||||||
{:source-paths
|
{:source-paths
|
||||||
["src/dev"
|
["src/main"
|
||||||
"src/main"
|
|
||||||
"src/test"]
|
"src/test"]
|
||||||
|
|
||||||
:dependencies
|
:dependencies
|
||||||
[[orchestra "2019.02.06-1"]
|
[[orchestra "2021.01.01-1"]
|
||||||
[hiccups "0.3.0"]
|
[hiccups "0.3.0"]
|
||||||
[com.andrewmcveigh/cljs-time "0.5.2"]]
|
[org.clj-commons/hickory "0.7.4"]
|
||||||
|
[com.andrewmcveigh/cljs-time "0.5.2"]
|
||||||
|
[org.domaindrivenarchitecture/c4k-common-cljs "6.2.3"]]
|
||||||
:dev-http {8080 "public"}
|
:dev-http {8080 "public"}
|
||||||
:builds
|
:builds
|
||||||
{:test {:target :node-test
|
{:test {:target :node-test
|
||||||
:output-to "target/node-tests.js"
|
:output-to "target/node-tests.js"
|
||||||
:autorun true}
|
:autorun true}
|
||||||
:lib {:target :node-library
|
:lib {:target :node-library
|
||||||
:output-to "target/lib.js"
|
:output-to "target/dda-masto-embed.js"
|
||||||
:exports {:init dda.masto-embed.app/init}
|
:exports {:init dda.masto-embed.app/init}
|
||||||
:release {:compiler-options {:optimizations :simple}}}
|
:release {:compiler-options {:optimizations :advanced}}}
|
||||||
:frontend {:target :browser
|
:frontend {:target :browser
|
||||||
:modules {:main {:init-fn dda.masto-embed.app/init}}
|
:modules {:main {:init-fn dda.masto-embed.app/init}}
|
||||||
:release {}}}}
|
:release {}}}}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,116 +15,14 @@
|
||||||
; limitations under the License.
|
; limitations under the License.
|
||||||
(ns dda.masto-embed.app
|
(ns dda.masto-embed.app
|
||||||
(:require
|
(:require
|
||||||
[cljs.core.async :refer [go close! put! take! timeout chan <! >!]]
|
[dda.masto-embed.browser :as b]
|
||||||
[cljs.core.async.interop :refer-macros [<p!]]
|
[dda.masto-embed.modes :as m]))
|
||||||
[hiccups.runtime :refer [render-html]]
|
|
||||||
[dda.masto-embed.api :as api]
|
|
||||||
[dda.masto-embed.infra :as infra]
|
|
||||||
[dda.masto-embed.render-bootstrap :as rb]
|
|
||||||
))
|
|
||||||
|
|
||||||
(def masto-embed "masto-embed")
|
|
||||||
|
|
||||||
(defn element-from-document-by-name [name]
|
|
||||||
(-> js/document
|
|
||||||
(.getElementById masto-embed)
|
|
||||||
(.getAttribute name)))
|
|
||||||
|
|
||||||
(defn host-url-from-document []
|
|
||||||
(element-from-document-by-name "host_url"))
|
|
||||||
|
|
||||||
(defn account-name-from-document []
|
|
||||||
(element-from-document-by-name "account_name"))
|
|
||||||
|
|
||||||
(defn account-id-from-document []
|
|
||||||
(element-from-document-by-name "account_id"))
|
|
||||||
|
|
||||||
(defn replies-to-from-document []
|
|
||||||
(element-from-document-by-name "replies_to"))
|
|
||||||
|
|
||||||
(defn filter-favorited-from-document []
|
|
||||||
(element-from-document-by-name "filter_favorited"))
|
|
||||||
|
|
||||||
(defn render-to-document
|
|
||||||
[input]
|
|
||||||
(-> js/document
|
|
||||||
(.getElementById masto-embed)
|
|
||||||
(.-innerHTML)
|
|
||||||
(set! input)))
|
|
||||||
|
|
||||||
(defn find-account-id [host-url account-name]
|
|
||||||
(let [out (chan)]
|
|
||||||
(go
|
|
||||||
(>! out
|
|
||||||
(->>
|
|
||||||
(<p! (api/get-directory host-url))
|
|
||||||
api/mastojs->edn
|
|
||||||
(filter #(= account-name (:acct %)))
|
|
||||||
(infra/debug)
|
|
||||||
(map :id)
|
|
||||||
first)))
|
|
||||||
out))
|
|
||||||
|
|
||||||
(defn favorited-replies? [host-url account-name reply-id]
|
|
||||||
(let [out (chan)]
|
|
||||||
(go
|
|
||||||
(>! out
|
|
||||||
(->>
|
|
||||||
(<p! (api/get-favorited-by host-url reply-id))
|
|
||||||
api/mastojs->edn
|
|
||||||
(filter #(= account-name (:acct %)))
|
|
||||||
(empty?)
|
|
||||||
(not))))
|
|
||||||
out))
|
|
||||||
|
|
||||||
(defn favorited? [host-url account-name replies]
|
|
||||||
(let [out (chan)]
|
|
||||||
(go
|
|
||||||
(>! out
|
|
||||||
(loop [loc-replies replies
|
|
||||||
result []]
|
|
||||||
(if (empty? loc-replies)
|
|
||||||
result
|
|
||||||
(recur (rest loc-replies)
|
|
||||||
(conj result (<! (favorited-replies? host-url account-name (first loc-replies)))))))))
|
|
||||||
out))
|
|
||||||
|
|
||||||
(defn account-mode [host-url account-name]
|
|
||||||
(go
|
|
||||||
(let [account-id (or
|
|
||||||
(account-id-from-document)
|
|
||||||
(<! (find-account-id host-url account-name)))
|
|
||||||
statuus (->
|
|
||||||
(<p! (api/get-account-statuses host-url account-id))
|
|
||||||
api/mastojs->edn)]
|
|
||||||
(->> statuus
|
|
||||||
(take 4)
|
|
||||||
(rb/masto->html)
|
|
||||||
(render-html)
|
|
||||||
(render-to-document)))))
|
|
||||||
|
|
||||||
(defn replies-mode [host-url account-name post-id filter-favorited]
|
|
||||||
(go
|
|
||||||
(let [test-status (->
|
|
||||||
(<p! (api/get-replies host-url post-id))
|
|
||||||
api/mastojs->edn)
|
|
||||||
favorited (<! (favorited? host-url account-name (map :id (:descendants test-status))))
|
|
||||||
combined (map (fn [s f] {:status s :favorited f}) (:descendants test-status) favorited)
|
|
||||||
filtered (map :status (filter :favorited combined))
|
|
||||||
statuus (if filter-favorited filtered test-status)]
|
|
||||||
(->> statuus
|
|
||||||
(infra/debug)
|
|
||||||
(rb/masto->html)
|
|
||||||
(render-html)
|
|
||||||
(render-to-document)))))
|
|
||||||
|
|
||||||
(defn init []
|
(defn init []
|
||||||
(let [host-url (host-url-from-document)
|
(let [host-url (b/host-url-from-document)
|
||||||
account-name (account-name-from-document)
|
account-name (b/account-name-from-document)
|
||||||
replies-to (replies-to-from-document)
|
replies-to (b/replies-to-from-document)
|
||||||
filter-favorited (filter-favorited-from-document)
|
filter-favorited (b/filter-favorited-from-document)]
|
||||||
]
|
|
||||||
(if (nil? replies-to)
|
(if (nil? replies-to)
|
||||||
(account-mode host-url account-name)
|
(m/account-mode host-url account-name)
|
||||||
(replies-mode host-url account-name replies-to filter-favorited))
|
(m/replies-mode host-url account-name replies-to filter-favorited))))
|
||||||
))
|
|
51
src/main/dda/masto_embed/browser.cljs
Normal file
51
src/main/dda/masto_embed/browser.cljs
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
; Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
; or more contributor license agreements. See the NOTICE file
|
||||||
|
; distributed with this work for additional information
|
||||||
|
; regarding copyright ownership. The ASF licenses this file
|
||||||
|
; to you under the Apache License, Version 2.0 (the
|
||||||
|
; "License"); you may not use this file except in compliance
|
||||||
|
; with the License. You may obtain a copy of the License at
|
||||||
|
;
|
||||||
|
; http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
;
|
||||||
|
; Unless required by applicable law or agreed to in writing, software
|
||||||
|
; distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
; See the License for the specific language governing permissions and
|
||||||
|
; limitations under the License.
|
||||||
|
(ns dda.masto-embed.browser
|
||||||
|
(:require
|
||||||
|
[hickory.core :as h]
|
||||||
|
[shadow.resource :as rc]))
|
||||||
|
|
||||||
|
(def masto-embed "masto-embed")
|
||||||
|
|
||||||
|
(def post-html (rc/inline "dda/masto_embed/resources/post.html"))
|
||||||
|
|
||||||
|
(defn post-html-hiccup []
|
||||||
|
(h/as-hiccup (h/parse post-html)))
|
||||||
|
|
||||||
|
|
||||||
|
(defn element-from-document-by-name [name]
|
||||||
|
(-> js/document
|
||||||
|
(.getElementById masto-embed)
|
||||||
|
(.getAttribute name)))
|
||||||
|
|
||||||
|
(defn host-url-from-document []
|
||||||
|
(element-from-document-by-name "host_url"))
|
||||||
|
|
||||||
|
(defn account-name-from-document []
|
||||||
|
(element-from-document-by-name "account_name"))
|
||||||
|
|
||||||
|
(defn replies-to-from-document []
|
||||||
|
(element-from-document-by-name "replies_to"))
|
||||||
|
|
||||||
|
(defn filter-favorited-from-document []
|
||||||
|
(element-from-document-by-name "filter_favorited"))
|
||||||
|
|
||||||
|
(defn render-to-document
|
||||||
|
[input]
|
||||||
|
(-> js/document
|
||||||
|
(.getElementById masto-embed)
|
||||||
|
(.-innerHTML)
|
||||||
|
(set! input)))
|
94
src/main/dda/masto_embed/modes.cljs
Normal file
94
src/main/dda/masto_embed/modes.cljs
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
; Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
; or more contributor license agreements. See the NOTICE file
|
||||||
|
; distributed with this work for additional information
|
||||||
|
; regarding copyright ownership. The ASF licenses this file
|
||||||
|
; to you under the Apache License, Version 2.0 (the
|
||||||
|
; "License"); you may not use this file except in compliance
|
||||||
|
; with the License. You may obtain a copy of the License at
|
||||||
|
;
|
||||||
|
; http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
;
|
||||||
|
; Unless required by applicable law or agreed to in writing, software
|
||||||
|
; distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
; See the License for the specific language governing permissions and
|
||||||
|
; limitations under the License.
|
||||||
|
(ns dda.masto-embed.modes
|
||||||
|
(:require
|
||||||
|
[cljs.core.async :refer [go close! put! take! timeout chan <! >!]]
|
||||||
|
[cljs.core.async.interop :refer-macros [<p!]]
|
||||||
|
[hiccups.runtime :refer [render-html]]
|
||||||
|
[cljs-time.format :as t]
|
||||||
|
[dda.masto-embed.api :as api]
|
||||||
|
[dda.masto-embed.infra :as infra]
|
||||||
|
[dda.masto-embed.browser :as b]
|
||||||
|
[dda.masto-embed.to-html :as th]
|
||||||
|
))
|
||||||
|
|
||||||
|
; TODO?: Functions in this ns mix business logic and api calls.
|
||||||
|
; Should we separate better etween business and infra logic?
|
||||||
|
|
||||||
|
(defn favorited-replies? [host-url account-name reply-id]
|
||||||
|
(let [out (chan)]
|
||||||
|
(go
|
||||||
|
(>! out
|
||||||
|
(->>
|
||||||
|
(<p! (api/get-favorited-by host-url reply-id))
|
||||||
|
api/mastojs->edn
|
||||||
|
(filter #(= account-name (:acct %)))
|
||||||
|
(empty?)
|
||||||
|
(not))))
|
||||||
|
out))
|
||||||
|
|
||||||
|
(defn favorited? [host-url account-name replies]
|
||||||
|
(let [out (chan)]
|
||||||
|
(go
|
||||||
|
(>! out
|
||||||
|
(loop [loc-replies replies
|
||||||
|
result []]
|
||||||
|
(if (empty? loc-replies)
|
||||||
|
result
|
||||||
|
(recur (rest loc-replies)
|
||||||
|
(conj result (<! (favorited-replies? host-url account-name (first loc-replies)))))))))
|
||||||
|
out))
|
||||||
|
|
||||||
|
(defn find-account-id [host-url account-name]
|
||||||
|
(let [out (chan)]
|
||||||
|
(go
|
||||||
|
(>! out
|
||||||
|
(->>
|
||||||
|
(<p! (api/get-directory host-url))
|
||||||
|
api/mastojs->edn
|
||||||
|
(filter #(= account-name (:acct %)))
|
||||||
|
(map :id)
|
||||||
|
first)))
|
||||||
|
out))
|
||||||
|
|
||||||
|
(defn replies-mode [host-url account-name post-id filter-favorited]
|
||||||
|
(go
|
||||||
|
(let [replies (->
|
||||||
|
(<p! (api/get-replies host-url post-id))
|
||||||
|
api/mastojs->edn)
|
||||||
|
favorited (<! (favorited? host-url account-name (map :id (:descendants replies))))
|
||||||
|
combined (map (fn [s f] {:status s :favorited f}) (:descendants replies) favorited)]
|
||||||
|
(->> combined
|
||||||
|
(filter #(or (not filter-favorited) (:favorited %)))
|
||||||
|
(reverse)
|
||||||
|
(map :status)
|
||||||
|
(th/masto->html "replies-mode")
|
||||||
|
(render-html)
|
||||||
|
(b/render-to-document)))))
|
||||||
|
|
||||||
|
(defn account-mode [host-url account-name]
|
||||||
|
(go
|
||||||
|
(let [account-id (<! (find-account-id host-url account-name))
|
||||||
|
status (->
|
||||||
|
(<p! (api/get-account-statuses host-url account-id))
|
||||||
|
api/mastojs->edn)]
|
||||||
|
(->> status
|
||||||
|
(filter #(= nil (:reblog %)))
|
||||||
|
(filter #(= nil (:in_reply_to_account_id %)))
|
||||||
|
(take 4)
|
||||||
|
(th/masto->html "account-mode")
|
||||||
|
(render-html)
|
||||||
|
(b/render-to-document)))))
|
|
@ -1,45 +0,0 @@
|
||||||
; Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
; or more contributor license agreements. See the NOTICE file
|
|
||||||
; distributed with this work for additional information
|
|
||||||
; regarding copyright ownership. The ASF licenses this file
|
|
||||||
; to you under the Apache License, Version 2.0 (the
|
|
||||||
; "License"); you may not use this file except in compliance
|
|
||||||
; with the License. You may obtain a copy of the License at
|
|
||||||
;
|
|
||||||
; http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
;
|
|
||||||
; Unless required by applicable law or agreed to in writing, software
|
|
||||||
; distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
; See the License for the specific language governing permissions and
|
|
||||||
; limitations under the License.
|
|
||||||
(ns dda.masto-embed.render-bootstrap
|
|
||||||
(:require
|
|
||||||
[cljs-time.format :as t]
|
|
||||||
[clojure.spec.alpha :as s]
|
|
||||||
[orchestra.core :refer-macros [defn-spec]]))
|
|
||||||
|
|
||||||
(defn mastocard->html [card]
|
|
||||||
(when (some? card)
|
|
||||||
(let [{:keys [title description image url]} card]
|
|
||||||
[:div {:class "card" :url url}
|
|
||||||
(when (some? image)
|
|
||||||
[:img {:class "card-img-top" :src image}])
|
|
||||||
[:h3 {:class "card-title"} title]
|
|
||||||
[:p {:class "card-body"} description]])))
|
|
||||||
|
|
||||||
(defn masto->html [statuses]
|
|
||||||
[:ul {:class "list-group"}
|
|
||||||
(map (fn [status]
|
|
||||||
(let [{:keys [created_at card]} status
|
|
||||||
date (t/parse created_at)]
|
|
||||||
[:li {:class "list-group-item, card"}
|
|
||||||
[:div {:class "card-body"}
|
|
||||||
[:h2 {:class "card-title"}
|
|
||||||
[:a {:href (get-in status [:account :url])}
|
|
||||||
(t/unparse (t/formatters :date) date) " "
|
|
||||||
(t/unparse (t/formatters :hour-minute-second) date)]]
|
|
||||||
[:p {:class "card-text"}
|
|
||||||
(:content status)
|
|
||||||
(mastocard->html card)]]]))
|
|
||||||
statuses)])
|
|
1
src/main/dda/masto_embed/resources/image.html
Normal file
1
src/main/dda/masto_embed/resources/image.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<img class="mastodon-post-image" src="https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/original/0d01ddb07440328e.jpg"></img>
|
1
src/main/dda/masto_embed/resources/link_prev.html
Normal file
1
src/main/dda/masto_embed/resources/link_prev.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<a href="LINK_PREVIEW_URL" class="mastodon-post-link-preview" target="_blank"><img class="mastodon-post-link-image" src="LINK_PREVIEW_IMG_URL"></img><div class="mastodon-post-link-info"><h4 class="mastodon-post-link-title">LINK_PREVIEW_TITLE</h4><div class="mastodon-post-link-description">LINK_PREVIEW_DESC</div><div class="mastodon-post-link-url">LINK_PREVIEW_URL</div></div></a>
|
1
src/main/dda/masto_embed/resources/post-min-base.html
Normal file
1
src/main/dda/masto_embed/resources/post-min-base.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<section class="section post-container"><article class="mastodon-post"><header class="mastodon-post-header"><img class="mastodon-post-avatar" src="AVATAR_URL"></img><div class="mastodon-post-names"><a class="display-name" href="POST_URL">DISPLAY_NAME</a><a class="account-name" href="POST_URL">ACCOUNT_NAME</a></div><time class="mastodon-post-date" datetime="DATETIME">TIME</time></header><section class="mastodon-post-content"><p class="mastodon-post-text">POST_TEXT</p></section><a href="LINK_PREVIEW_URL" class="mastodon-post-link-preview" target="_blank"></a><footer class="mastodon-post-footer"><button class="footer-button replies"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23.999989 18.905102" fill="currentColor"><path d="M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z " /></svg><span class="count reply-count">REPLIES_COUNT</span></button><button class="footer-button retoots">src/main/dda/masto_embed/resources/post.html<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 15.292642" fill="currentColor"><path d="M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z" /></svg><span class="count retoot-count">REBLOGS_COUNT</span></button><button class="footer-button likes"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 22.799999" fill="currentColor"><path d="M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z" /></svg><span class="count like-count">FAVOURITES_COUNT</span></button></footer></article></section>
|
|
@ -0,0 +1 @@
|
||||||
|
<section class="section post-container"><article class="mastodon-post"><header class="mastodon-post-header"><img class="mastodon-post-avatar" src="AVATAR_URL"></img><div class="mastodon-post-names"><a class="display-name" href="POST_URL">DISPLAY_NAME</a><a class="account-name" href="POST_URL">ACCOUNT_NAME</a></div><time class="mastodon-post-date" datetime="DATETIME">TIME</time></header><section class="mastodon-post-content"><p class="mastodon-post-text">POST_TEXT</p><img class="mastodon-post-image" src="POST_IMG_URL"></img></section><a href="LINK_PREVIEW_URL" class="mastodon-post-link-preview" target="_blank"><img class="mastodon-post-link-image" src="LINK_PREVIEW_IMG_URL"></img><div class="mastodon-post-link-info"><h4 class="mastodon-post-link-title">LINK_PREVIEW_TITLE</h4><div class="mastodon-post-link-description">LINK_PREVIEW_DESC</div><div class="mastodon-post-link-url">LINK_PREVIEW_URL</div></div></a><footer class="mastodon-post-footer"><button class="footer-button replies"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23.999989 18.905102" fill="currentColor"><path d="M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "/></svg><span class="count reply-count">REPLIES_COUNT</span></button><button class="footer-button retoots"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 15.292642" fill="currentColor"><path d="M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"/></svg><span class="count retoot-count">REBLOGS_COUNT</span></button><button class="footer-button likes"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 22.799999" fill="currentColor"><path d="M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"/></svg><span class="count like-count">FAVOURITES_COUNT</span></button></footer></article></section>
|
1
src/main/dda/masto_embed/resources/post-min-img.html
Normal file
1
src/main/dda/masto_embed/resources/post-min-img.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<section class="section post-container"><article class="mastodon-post"><header class="mastodon-post-header"><img class="mastodon-post-avatar" src="AVATAR_URL"></img><div class="mastodon-post-names"><a class="display-name" href="POST_URL">DISPLAY_NAME</a><a class="account-name" href="POST_URL">ACCOUNT_NAME</a></div><time class="mastodon-post-date" datetime="DATETIME">TIME</time></header><section class="mastodon-post-content"><p class="mastodon-post-text">POST_TEXT</p><img class="mastodon-post-image" src="https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/original/0d01ddb07440328e.jpg"></img></section><footer class="mastodon-post-footer"><button class="footer-button replies"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23.999989 18.905102" fill="currentColor"><path d="M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z " /></svg><span class="count reply-count">REPLIES_COUNT</span></button><button class="footer-button retoots">src/main/dda/masto_embed/resources/post.html<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 15.292642" fill="currentColor"><path d="M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z" /></svg><span class="count retoot-count">REBLOGS_COUNT</span></button><button class="footer-button likes"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 22.799999" fill="currentColor"><path d="M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z" /></svg><span class="count like-count">FAVOURITES_COUNT</span></button></footer></article></section>
|
1
src/main/dda/masto_embed/resources/post-min-prev.html
Normal file
1
src/main/dda/masto_embed/resources/post-min-prev.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<section class="section post-container"><article class="mastodon-post"><header class="mastodon-post-header"><img class="mastodon-post-avatar" src="AVATAR_URL"></img><div class="mastodon-post-names"><a class="display-name" href="POST_URL">DISPLAY_NAME</a><a class="account-name" href="POST_URL">ACCOUNT_NAME</a></div><time class="mastodon-post-date" datetime="DATETIME">TIME</time></header><section class="mastodon-post-content"><p class="mastodon-post-text">POST_TEXT</p></section><a href="LINK_PREVIEW_URL" class="mastodon-post-link-preview" target="_blank"><img class="mastodon-post-link-image" src="LINK_PREVIEW_IMG_URL"></img><div class="mastodon-post-link-info"><h4 class="mastodon-post-link-title">LINK_PREVIEW_TITLE</h4><div class="mastodon-post-link-description">LINK_PREVIEW_DESC</div><div class="mastodon-post-link-url">LINK_PREVIEW_URL</div></div></a><footer class="mastodon-post-footer"><button class="footer-button replies"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23.999989 18.905102" fill="currentColor"><path d="M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z " /></svg><span class="count reply-count">REPLIES_COUNT</span></button><button class="footer-button retoots">src/main/dda/masto_embed/resources/post.html<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 15.292642" fill="currentColor"><path d="M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z" /></svg><span class="count retoot-count">REBLOGS_COUNT</span></button><button class="footer-button likes"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 22.799999" fill="currentColor"><path d="M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z" /></svg><span class="count like-count">FAVOURITES_COUNT</span></button></footer></article></section>
|
358
src/main/dda/masto_embed/resources/post.css
Normal file
358
src/main/dda/masto_embed/resources/post.css
Normal file
|
@ -0,0 +1,358 @@
|
||||||
|
.section.account-mode {
|
||||||
|
--large: 1em;
|
||||||
|
--medium: 0.5em;
|
||||||
|
--small: 0.25em;
|
||||||
|
margin-bottom: var(--large);
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
grid: ". post ." / auto auto auto;
|
||||||
|
|
||||||
|
font-size: calc(clamp(0.8rem, 19200.75rem - 40000vw, 1.0rem) + max(0.75rem, 0.5rem + 0.5208333vw) - 0.75rem);
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
|
||||||
|
.mastodon-post {
|
||||||
|
grid-area: post;
|
||||||
|
justify-self: center;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"header"
|
||||||
|
"content"
|
||||||
|
"image"
|
||||||
|
"link-preview"
|
||||||
|
"footer" /
|
||||||
|
minmax(380px, 450px);
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: var(--small);
|
||||||
|
|
||||||
|
.mastodon-post-header {
|
||||||
|
grid-area: header;
|
||||||
|
justify-self: stretch;
|
||||||
|
display: grid;
|
||||||
|
grid: "avatar names . date" / max-content max-content auto 20%;
|
||||||
|
margin: var(--medium);
|
||||||
|
|
||||||
|
.mastodon-post-avatar {
|
||||||
|
grid-area: avatar;
|
||||||
|
width: auto;
|
||||||
|
max-height: 60px;
|
||||||
|
object-fit: contain;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-names {
|
||||||
|
grid-area: names;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"dp-name"
|
||||||
|
"ac-name" /
|
||||||
|
auto;
|
||||||
|
justify-self: start;
|
||||||
|
margin-left: var(--medium);
|
||||||
|
|
||||||
|
.display-name {
|
||||||
|
grid-area: dp-name;
|
||||||
|
align-self: end;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-name {
|
||||||
|
grid-area: ac-name;
|
||||||
|
align-self: start;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-date {
|
||||||
|
font-size: 85%;
|
||||||
|
grid-area: date;
|
||||||
|
justify-self: end;
|
||||||
|
align-self: center;
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-content {
|
||||||
|
grid-area: content;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"text"
|
||||||
|
"image" / 100%;
|
||||||
|
padding: var(--medium);
|
||||||
|
|
||||||
|
.mastodon-post-text {
|
||||||
|
grid-area: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-image {
|
||||||
|
grid-area: image;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
align-self: center;
|
||||||
|
justify-self: center;
|
||||||
|
border-radius: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-preview {
|
||||||
|
grid-area: link-preview;
|
||||||
|
justify-self: center;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"image"
|
||||||
|
"info" / 100%;
|
||||||
|
text-decoration: none;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: var(--small);
|
||||||
|
margin: var(--medium);
|
||||||
|
|
||||||
|
.mastodon-post-link-image{
|
||||||
|
grid-area: image;
|
||||||
|
justify-self: center;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius:var(--small);
|
||||||
|
margin-bottom: var(--small);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-info {
|
||||||
|
grid-area: info;
|
||||||
|
grid:
|
||||||
|
"link-title"
|
||||||
|
"link-description"
|
||||||
|
"link-url"
|
||||||
|
/ auto;
|
||||||
|
padding: var(--small);
|
||||||
|
|
||||||
|
.mastodon-post-link-title {
|
||||||
|
grid-area: link-title;
|
||||||
|
color: #383838;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-description {
|
||||||
|
grid-area: link-description;
|
||||||
|
color: #383838;
|
||||||
|
padding-bottom: var(--medium);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-url {
|
||||||
|
grid-area: link-url;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-footer {
|
||||||
|
margin-right: var(--medium);
|
||||||
|
margin-left: var(--medium);
|
||||||
|
grid-area: footer;
|
||||||
|
display: grid;
|
||||||
|
justify-content: space-between;
|
||||||
|
grid:
|
||||||
|
"replies retoots likes"
|
||||||
|
/ auto auto auto;
|
||||||
|
padding-top: var(--small);
|
||||||
|
|
||||||
|
.footer-button {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
display: flex;
|
||||||
|
svg {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
margin-right: var(--small);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.replies {
|
||||||
|
justify-self: center;
|
||||||
|
grid-area: replies;
|
||||||
|
}
|
||||||
|
|
||||||
|
.retoots {
|
||||||
|
justify-self: center;
|
||||||
|
grid-area: retoots;
|
||||||
|
}
|
||||||
|
|
||||||
|
.likes {
|
||||||
|
justify-self: center;
|
||||||
|
grid-area: likes;
|
||||||
|
}
|
||||||
|
|
||||||
|
.like-count {
|
||||||
|
justify-self: center;
|
||||||
|
grid-area: like-count;
|
||||||
|
}
|
||||||
|
|
||||||
|
.retoot-count {
|
||||||
|
justify-self: center;
|
||||||
|
grid-area: retoot-count;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reply-count {
|
||||||
|
justify-self: center;
|
||||||
|
grid-area: reply-count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.section.replies-mode {
|
||||||
|
--large: 1em;
|
||||||
|
--medium: 0.5em;
|
||||||
|
--small: 0.25em;
|
||||||
|
margin-bottom: var(--large);
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
grid: ". post ." / auto auto auto;
|
||||||
|
|
||||||
|
font-size: calc(clamp(0.8rem, 19200.75rem - 40000vw, 1.0rem) + max(0.75rem, 0.5rem + 0.5208333vw) - 0.75rem);
|
||||||
|
|
||||||
|
.mastodon-post {
|
||||||
|
grid-area: post;
|
||||||
|
justify-self: center;
|
||||||
|
align-self: start;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"header"
|
||||||
|
"content"
|
||||||
|
"image"
|
||||||
|
"link-preview"
|
||||||
|
"footer" /
|
||||||
|
minmax(380px, 450px);
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: var(--small);
|
||||||
|
|
||||||
|
.mastodon-post-header {
|
||||||
|
grid-area: header;
|
||||||
|
justify-self: stretch;
|
||||||
|
display: grid;
|
||||||
|
grid: "avatar names . date" / max-content max-content auto 20%;
|
||||||
|
margin: var(--medium);
|
||||||
|
|
||||||
|
.mastodon-post-avatar {
|
||||||
|
grid-area: avatar;
|
||||||
|
width: auto;
|
||||||
|
max-height: 60px;
|
||||||
|
object-fit: contain;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-names {
|
||||||
|
grid-area: names;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"dp-name"
|
||||||
|
"ac-name" /
|
||||||
|
auto;
|
||||||
|
justify-self: start;
|
||||||
|
margin-left: var(--medium);
|
||||||
|
|
||||||
|
.display-name {
|
||||||
|
grid-area: dp-name;
|
||||||
|
align-self: end;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-name {
|
||||||
|
grid-area: ac-name;
|
||||||
|
align-self: start;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-date {
|
||||||
|
font-size: 85%;
|
||||||
|
grid-area: date;
|
||||||
|
justify-self: end;
|
||||||
|
align-self: center;
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-content {
|
||||||
|
grid-area: content;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"image text" / minmax(40%, 108px) auto;
|
||||||
|
padding: var(--medium);
|
||||||
|
|
||||||
|
.mastodon-post-text {
|
||||||
|
grid-area: text;
|
||||||
|
align-self: center;
|
||||||
|
display: grid;
|
||||||
|
padding: var(--medium) 0 var(--medium) var(--medium);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-image {
|
||||||
|
grid-area: image;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
align-self: center;
|
||||||
|
justify-self: center;
|
||||||
|
border-radius: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-preview {
|
||||||
|
grid-area: link-preview;
|
||||||
|
justify-self: center;
|
||||||
|
display: grid;
|
||||||
|
grid:
|
||||||
|
"image"
|
||||||
|
"info" / 100%;
|
||||||
|
text-decoration: none;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: var(--small);
|
||||||
|
margin: var(--medium);
|
||||||
|
|
||||||
|
.mastodon-post-link-image{
|
||||||
|
grid-area: image;
|
||||||
|
justify-self: center;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: var(--small);
|
||||||
|
margin-bottom: var(--small);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-info {
|
||||||
|
grid-area: info;
|
||||||
|
grid:
|
||||||
|
"." "link-title" "."
|
||||||
|
"." "link-description" "."
|
||||||
|
"." "link-url" "." / auto auto auto;
|
||||||
|
padding: var(--small);
|
||||||
|
|
||||||
|
.mastodon-post-link-title {
|
||||||
|
grid-area: link-title;
|
||||||
|
color: #383838;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-description {
|
||||||
|
color: #383838;
|
||||||
|
grid-area: link-description;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-link-url {
|
||||||
|
grid-area: link-url;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mastodon-post-footer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
29
src/main/dda/masto_embed/resources/post.html
Normal file
29
src/main/dda/masto_embed/resources/post.html
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<section class="section MODE">
|
||||||
|
<article class="mastodon-post">
|
||||||
|
<header class="mastodon-post-header">
|
||||||
|
<img class="mastodon-post-avatar" src="AVATAR_URL"></img>
|
||||||
|
<div class="mastodon-post-names">
|
||||||
|
<a class="display-name" href="POST_URL">DISPLAY_NAME</a>
|
||||||
|
<a class="account-name" href="POST_URL">ACCOUNT_NAME</a>
|
||||||
|
</div>
|
||||||
|
<time class="mastodon-post-date" datetime="DATETIME">TIME</time>
|
||||||
|
</header>
|
||||||
|
<section class="mastodon-post-content">
|
||||||
|
<div class="mastodon-post-text">POST_TEXT</div>
|
||||||
|
</section>
|
||||||
|
<footer class="mastodon-post-footer"><button class="footer-button replies"><svg xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 23.999989 18.905102" fill="currentColor">
|
||||||
|
<path
|
||||||
|
d="M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z " />
|
||||||
|
</svg><span class="count reply-count">REPLIES_COUNT</span></button><button
|
||||||
|
class="footer-button retoots"><svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 15.292642" fill="currentColor">
|
||||||
|
<path
|
||||||
|
d="M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z" />
|
||||||
|
</svg><span class="count retoot-count">REBLOGS_COUNT</span></button><button class="footer-button likes"><svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 22.799999" fill="currentColor">
|
||||||
|
<path
|
||||||
|
d="M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z" />
|
||||||
|
</svg><span class="count like-count">FAVOURITES_COUNT</span></button></footer>
|
||||||
|
</article>
|
||||||
|
</section>
|
117
src/main/dda/masto_embed/to_html.cljs
Normal file
117
src/main/dda/masto_embed/to_html.cljs
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
; Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
; or more contributor license agreements. See the NOTICE file
|
||||||
|
; distributed with this work for additional information
|
||||||
|
; regarding copyright ownership. The ASF licenses this file
|
||||||
|
; to you under the Apache License, Version 2.0 (the
|
||||||
|
; "License"); you may not use this file except in compliance
|
||||||
|
; with the License. You may obtain a copy of the License at
|
||||||
|
;
|
||||||
|
; http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
;
|
||||||
|
; Unless required by applicable law or agreed to in writing, software
|
||||||
|
; distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
; See the License for the specific language governing permissions and
|
||||||
|
; limitations under the License.
|
||||||
|
(ns dda.masto-embed.to-html
|
||||||
|
(:require
|
||||||
|
[cljs.core.async :refer [go chan <! >!]]
|
||||||
|
[cljs.core.async.interop :refer-macros [<p!]]
|
||||||
|
[hiccups.runtime :refer [render-html]]
|
||||||
|
[cljs-time.format :as t]
|
||||||
|
[dda.masto-embed.api :as api]
|
||||||
|
[dda.masto-embed.infra :as infra]
|
||||||
|
[dda.masto-embed.browser :as b]
|
||||||
|
[dda.c4k-common.common :as cm]
|
||||||
|
[clojure.walk :refer [postwalk]]))
|
||||||
|
|
||||||
|
(def link_preview
|
||||||
|
[:a
|
||||||
|
{:href "LINK_PREVIEW_URL", :class "mastodon-post-link-preview", :target "_blank"}
|
||||||
|
[:img {:class "mastodon-post-link-image", :src "LINK_PREVIEW_IMG_URL"}]
|
||||||
|
[:div
|
||||||
|
{:class "mastodon-post-link-info"}
|
||||||
|
[:h4 {:class "mastodon-post-link-title"} "LINK_PREVIEW_TITLE"]
|
||||||
|
[:div {:class "mastodon-post-link-description"} "LINK_PREVIEW_DESC"]
|
||||||
|
[:div {:class "mastodon-post-link-url"} "LINK_PREVIEW_URL"]]])
|
||||||
|
|
||||||
|
(defn insert [v i e] (vec (concat (subvec v 0 i) [e] (subvec v i))))
|
||||||
|
|
||||||
|
(defn truncate [s n] (subs s 0 (min (count s) n)))
|
||||||
|
|
||||||
|
(defn masto-header->html [html account created_at url]
|
||||||
|
(let [{:keys [username display_name avatar_static]} account
|
||||||
|
date (t/parse created_at)]
|
||||||
|
(-> html
|
||||||
|
(cm/replace-all-matching-values-by-new-value "AVATAR_URL" avatar_static)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "POST_URL" url)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "DISPLAY_NAME" display_name)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "ACCOUNT_NAME" (str "@" username))
|
||||||
|
(cm/replace-all-matching-values-by-new-value "DATETIME" created_at)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "TIME" (t/unparse (t/formatter "EEEE, dd MMMM yyyy") date)))))
|
||||||
|
|
||||||
|
(defn masto-content->html [html content]
|
||||||
|
(-> html
|
||||||
|
(cm/replace-all-matching-values-by-new-value "POST_TEXT" content)))
|
||||||
|
|
||||||
|
; Meant to be used in postwalk on hiccup/hickory html-representation
|
||||||
|
(defn insert-into-content [item insertion-element]
|
||||||
|
(let [condition (if (vector? item)
|
||||||
|
(every? true? [(= (first item) :section)
|
||||||
|
(= (:class (second item)) "mastodon-post-content")])
|
||||||
|
false)]
|
||||||
|
(if condition
|
||||||
|
(conj item insertion-element)
|
||||||
|
item)))
|
||||||
|
|
||||||
|
(defn insert-into-post [item index insertion-element]
|
||||||
|
(let [condition (if (vector? item)
|
||||||
|
(every? true? [(= (first item) :article)
|
||||||
|
(= (:class (second item)) "mastodon-post")])
|
||||||
|
false)]
|
||||||
|
(if condition
|
||||||
|
(insert item index insertion-element)
|
||||||
|
item)))
|
||||||
|
|
||||||
|
(defn masto-media->html [html media_attachments]
|
||||||
|
(if-let [preview-image-url (get-in media_attachments [0 :preview_url])]
|
||||||
|
(let [image-element [:img {:class "mastodon-post-image", :src preview-image-url}]]
|
||||||
|
(postwalk #(insert-into-content % image-element) html))
|
||||||
|
html))
|
||||||
|
|
||||||
|
(defn insert-link-prev [html]
|
||||||
|
(postwalk #(insert-into-post % 4 link_preview) html))
|
||||||
|
|
||||||
|
(defn masto-link-prev->html [html card]
|
||||||
|
(let [{:keys [url image title description]} card]
|
||||||
|
(if (nil? card)
|
||||||
|
html
|
||||||
|
(-> html
|
||||||
|
(insert-link-prev)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_URL" url)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_IMG_URL" image)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_TITLE" (str (truncate title 47) "..."))
|
||||||
|
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_DESC" description)))))
|
||||||
|
|
||||||
|
(defn masto-footer->html [html replies_count reblogs_count favourites_count]
|
||||||
|
(-> html
|
||||||
|
(cm/replace-all-matching-values-by-new-value "REPLIES_COUNT" replies_count)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "REBLOGS_COUNT" reblogs_count)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "FAVOURITES_COUNT" favourites_count)))
|
||||||
|
|
||||||
|
(defn insert-mode [html mode]
|
||||||
|
(-> html
|
||||||
|
(cm/replace-all-matching-values-by-new-value "section MODE" (str "section " mode))))
|
||||||
|
|
||||||
|
(defn masto->html [mode statuses]
|
||||||
|
(let [html (b/post-html-hiccup)]
|
||||||
|
(map (fn [status]
|
||||||
|
(let [{:keys [account created_at content media_attachments replies_count reblogs_count favourites_count card url]} status]
|
||||||
|
(-> html
|
||||||
|
(masto-header->html account created_at url)
|
||||||
|
(masto-content->html content)
|
||||||
|
(masto-media->html media_attachments)
|
||||||
|
(masto-link-prev->html card)
|
||||||
|
(masto-footer->html replies_count reblogs_count favourites_count)
|
||||||
|
(insert-mode mode))))
|
||||||
|
statuses)))
|
319
src/test/dda/masto_embed/data_helpers.cljs
Normal file
319
src/test/dda/masto_embed/data_helpers.cljs
Normal file
|
@ -0,0 +1,319 @@
|
||||||
|
(ns dda.masto-embed.data-helpers)
|
||||||
|
|
||||||
|
(def complete-template-post-hiccup
|
||||||
|
[:html
|
||||||
|
{}
|
||||||
|
[:head {}]
|
||||||
|
[:body
|
||||||
|
{}
|
||||||
|
[:section
|
||||||
|
{:class "section post-container"}
|
||||||
|
[:article
|
||||||
|
{:class "mastodon-post"}
|
||||||
|
[:header
|
||||||
|
{:class "mastodon-post-header"}
|
||||||
|
[:img {:class "mastodon-post-avatar", :src "AVATAR_URL"}]
|
||||||
|
[:div
|
||||||
|
{:class "mastodon-post-names"}
|
||||||
|
[:a {:class "display-name", :href "POST_URL"} "DISPLAY_NAME"]
|
||||||
|
[:a {:class "account-name", :href "POST_URL"} "ACCOUNT_NAME"]]
|
||||||
|
[:time {:class "mastodon-post-date", :datetime "DATETIME"} "TIME"]]
|
||||||
|
[:section
|
||||||
|
{:class "mastodon-post-content"}
|
||||||
|
[:p {:class "mastodon-post-text"} "POST_TEXT"]
|
||||||
|
[:img {:class "mastodon-post-image", :src "POST_IMG_URL"}]]
|
||||||
|
[:a
|
||||||
|
{:href "LINK_PREVIEW_URL", :class "mastodon-post-link-preview", :target "_blank"}
|
||||||
|
[:img {:class "mastodon-post-link-image", :src "LINK_PREVIEW_IMG_URL"}]
|
||||||
|
[:div
|
||||||
|
{:class "mastodon-post-link-info"}
|
||||||
|
[:h4 {:class "mastodon-post-link-title"} "LINK_PREVIEW_TITLE"]
|
||||||
|
[:div {:class "mastodon-post-link-description"} "LINK_PREVIEW_DESC"]
|
||||||
|
[:div {:class "mastodon-post-link-url"} "LINK_PREVIEW_URL"]]]
|
||||||
|
[:footer
|
||||||
|
{:class "mastodon-post-footer"}
|
||||||
|
[:button
|
||||||
|
{:class "footer-button replies"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "}]]
|
||||||
|
[:span {:class "count reply-count"} "REPLIES_COUNT"]]
|
||||||
|
[:button
|
||||||
|
{:class "footer-button retoots"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"}]]
|
||||||
|
[:span {:class "count retoot-count"} "REBLOGS_COUNT"]]
|
||||||
|
[:button
|
||||||
|
{:class "footer-button likes"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"}]]
|
||||||
|
[:span {:class "count like-count"} "FAVOURITES_COUNT"]]]]]]])
|
||||||
|
|
||||||
|
; complete-template-post-hiccup without link prev and img
|
||||||
|
(def post-base-img
|
||||||
|
[:html
|
||||||
|
{}
|
||||||
|
[:head {}]
|
||||||
|
[:body
|
||||||
|
{}
|
||||||
|
[:section
|
||||||
|
{:class "section post-container"}
|
||||||
|
[:article
|
||||||
|
{:class "mastodon-post"}
|
||||||
|
[:header
|
||||||
|
{:class "mastodon-post-header"}
|
||||||
|
[:img {:class "mastodon-post-avatar", :src "AVATAR_URL"}]
|
||||||
|
[:div
|
||||||
|
{:class "mastodon-post-names"}
|
||||||
|
[:a {:class "display-name", :href "POST_URL"} "DISPLAY_NAME"]
|
||||||
|
[:a {:class "account-name", :href "POST_URL"} "ACCOUNT_NAME"]]
|
||||||
|
[:time {:class "mastodon-post-date", :datetime "DATETIME"} "TIME"]]
|
||||||
|
[:section
|
||||||
|
{:class "mastodon-post-content"}
|
||||||
|
[:p {:class "mastodon-post-text"} "POST_TEXT"]]
|
||||||
|
[:footer
|
||||||
|
{:class "mastodon-post-footer"}
|
||||||
|
[:button
|
||||||
|
{:class "footer-button replies"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "}]]
|
||||||
|
[:span {:class "count reply-count"} "REPLIES_COUNT"]]
|
||||||
|
[:button
|
||||||
|
{:class "footer-button retoots"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"}]]
|
||||||
|
[:span {:class "count retoot-count"} "REBLOGS_COUNT"]]
|
||||||
|
[:button
|
||||||
|
{:class "footer-button likes"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"}]]
|
||||||
|
[:span {:class "count like-count"} "FAVOURITES_COUNT"]]]]]]])
|
||||||
|
|
||||||
|
(def post-with-img
|
||||||
|
[:html
|
||||||
|
{}
|
||||||
|
[:head {}]
|
||||||
|
[:body
|
||||||
|
{}
|
||||||
|
[:section
|
||||||
|
{:class "section post-container"}
|
||||||
|
[:article
|
||||||
|
{:class "mastodon-post"}
|
||||||
|
[:header
|
||||||
|
{:class "mastodon-post-header"}
|
||||||
|
[:img {:class "mastodon-post-avatar", :src "AVATAR_URL"}]
|
||||||
|
[:div
|
||||||
|
{:class "mastodon-post-names"}
|
||||||
|
[:a {:class "display-name", :href "POST_URL"} "DISPLAY_NAME"]
|
||||||
|
[:a {:class "account-name", :href "POST_URL"} "ACCOUNT_NAME"]]
|
||||||
|
[:time {:class "mastodon-post-date", :datetime "DATETIME"} "TIME"]]
|
||||||
|
[:section
|
||||||
|
{:class "mastodon-post-content"}
|
||||||
|
[:p {:class "mastodon-post-text"} "POST_TEXT"]
|
||||||
|
[:img
|
||||||
|
{:class "mastodon-post-image",
|
||||||
|
:src "https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/small/0d01ddb07440328e.jpg"}]]
|
||||||
|
[:footer
|
||||||
|
{:class "mastodon-post-footer"}
|
||||||
|
[:button
|
||||||
|
{:class "footer-button replies"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "}]]
|
||||||
|
[:span {:class "count reply-count"} "REPLIES_COUNT"]]
|
||||||
|
[:button
|
||||||
|
{:class "footer-button retoots"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"}]]
|
||||||
|
[:span {:class "count retoot-count"} "REBLOGS_COUNT"]]
|
||||||
|
[:button
|
||||||
|
{:class "footer-button likes"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"}]]
|
||||||
|
[:span {:class "count like-count"} "FAVOURITES_COUNT"]]]]]]])
|
||||||
|
|
||||||
|
; complete-template-post-hiccup without link prev and img
|
||||||
|
(def post-base-prev
|
||||||
|
[:html
|
||||||
|
{}
|
||||||
|
[:head {}]
|
||||||
|
[:body
|
||||||
|
{}
|
||||||
|
[:section
|
||||||
|
{:class "section post-container"}
|
||||||
|
[:article
|
||||||
|
{:class "mastodon-post"}
|
||||||
|
[:header
|
||||||
|
{:class "mastodon-post-header"}
|
||||||
|
[:img {:class "mastodon-post-avatar", :src "AVATAR_URL"}]
|
||||||
|
[:div
|
||||||
|
{:class "mastodon-post-names"}
|
||||||
|
[:a {:class "display-name", :href "POST_URL"} "DISPLAY_NAME"]
|
||||||
|
[:a {:class "account-name", :href "POST_URL"} "ACCOUNT_NAME"]]
|
||||||
|
[:time {:class "mastodon-post-date", :datetime "DATETIME"} "TIME"]]
|
||||||
|
[:section
|
||||||
|
{:class "mastodon-post-content"}
|
||||||
|
[:p {:class "mastodon-post-text"} "POST_TEXT"]]
|
||||||
|
[:footer
|
||||||
|
{:class "mastodon-post-footer"}
|
||||||
|
[:button
|
||||||
|
{:class "footer-button replies"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "}]]
|
||||||
|
[:span {:class "count reply-count"} "REPLIES_COUNT"]]
|
||||||
|
[:button
|
||||||
|
{:class "footer-button retoots"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"}]]
|
||||||
|
[:span {:class "count retoot-count"} "REBLOGS_COUNT"]]
|
||||||
|
[:button
|
||||||
|
{:class "footer-button likes"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"}]]
|
||||||
|
[:span {:class "count like-count"} "FAVOURITES_COUNT"]]]]]]])
|
||||||
|
|
||||||
|
(def post-with-prev
|
||||||
|
[:html
|
||||||
|
{}
|
||||||
|
[:head {}]
|
||||||
|
[:body
|
||||||
|
{}
|
||||||
|
[:section
|
||||||
|
{:class "section post-container"}
|
||||||
|
[:article
|
||||||
|
{:class "mastodon-post"}
|
||||||
|
[:header
|
||||||
|
{:class "mastodon-post-header"}
|
||||||
|
[:img {:class "mastodon-post-avatar", :src "AVATAR_URL"}]
|
||||||
|
[:div
|
||||||
|
{:class "mastodon-post-names"}
|
||||||
|
[:a {:class "display-name", :href "POST_URL"} "DISPLAY_NAME"]
|
||||||
|
[:a {:class "account-name", :href "POST_URL"} "ACCOUNT_NAME"]]
|
||||||
|
[:time {:class "mastodon-post-date", :datetime "DATETIME"} "TIME"]]
|
||||||
|
[:section
|
||||||
|
{:class "mastodon-post-content"}
|
||||||
|
[:p {:class "mastodon-post-text"} "POST_TEXT"]]
|
||||||
|
[:a
|
||||||
|
{:href "LINK_PREVIEW_URL", :class "mastodon-post-link-preview", :target "_blank"}
|
||||||
|
[:img {:class "mastodon-post-link-image", :src "LINK_PREVIEW_IMG_URL"}]
|
||||||
|
[:div
|
||||||
|
{:class "mastodon-post-link-info"}
|
||||||
|
[:h4 {:class "mastodon-post-link-title"} "LINK_PREVIEW_TITLE"]
|
||||||
|
[:div {:class "mastodon-post-link-description"} "LINK_PREVIEW_DESC"]
|
||||||
|
[:div {:class "mastodon-post-link-url"} "LINK_PREVIEW_URL"]]]
|
||||||
|
[:footer
|
||||||
|
{:class "mastodon-post-footer"}
|
||||||
|
[:button
|
||||||
|
{:class "footer-button replies"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "}]]
|
||||||
|
[:span {:class "count reply-count"} "REPLIES_COUNT"]]
|
||||||
|
[:button
|
||||||
|
{:class "footer-button retoots"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"}]]
|
||||||
|
[:span {:class "count retoot-count"} "REBLOGS_COUNT"]]
|
||||||
|
[:button
|
||||||
|
{:class "footer-button likes"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"}]]
|
||||||
|
[:span {:class "count like-count"} "FAVOURITES_COUNT"]]]]]]])
|
||||||
|
|
||||||
|
(def filled-post-with-prev
|
||||||
|
[:html
|
||||||
|
{}
|
||||||
|
[:head {}]
|
||||||
|
[:body
|
||||||
|
{}
|
||||||
|
[:section
|
||||||
|
{:class "section post-container"}
|
||||||
|
[:article
|
||||||
|
{:class "mastodon-post"}
|
||||||
|
[:header
|
||||||
|
{:class "mastodon-post-header"}
|
||||||
|
[:img {:class "mastodon-post-avatar", :src "AVATAR_URL"}]
|
||||||
|
[:div
|
||||||
|
{:class "mastodon-post-names"}
|
||||||
|
[:a {:class "display-name", :href "POST_URL"} "DISPLAY_NAME"]
|
||||||
|
[:a {:class "account-name", :href "POST_URL"} "ACCOUNT_NAME"]]
|
||||||
|
[:time {:class "mastodon-post-date", :datetime "DATETIME"} "TIME"]]
|
||||||
|
[:section
|
||||||
|
{:class "mastodon-post-content"}
|
||||||
|
[:p {:class "mastodon-post-text"} "POST_TEXT"]]
|
||||||
|
[:a
|
||||||
|
{:href "https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go", :class "mastodon-post-link-preview", :target "_blank"}
|
||||||
|
[:img {:class "mastodon-post-link-image", :src "https://cdn.masto.host/socialmeissagmbhde/cache/preview_cards/images/000/545/643/original/199336f5aa5b9683.png"}]
|
||||||
|
[:div
|
||||||
|
{:class "mastodon-post-link-info"}
|
||||||
|
[:h4 {:class "mastodon-post-link-title"} "forgejo/tests/integration/api_activitypub_repos..."]
|
||||||
|
[:div {:class "mastodon-post-link-description"} "forgejo - Beyond coding. We forge."]
|
||||||
|
[:div {:class "mastodon-post-link-url"} "https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go"]]]
|
||||||
|
[:footer
|
||||||
|
{:class "mastodon-post-footer"}
|
||||||
|
[:button
|
||||||
|
{:class "footer-button replies"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "}]]
|
||||||
|
[:span {:class "count reply-count"} "REPLIES_COUNT"]]
|
||||||
|
[:button
|
||||||
|
{:class "footer-button retoots"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"}]]
|
||||||
|
[:span {:class "count retoot-count"} "REBLOGS_COUNT"]]
|
||||||
|
[:button
|
||||||
|
{:class "footer-button likes"}
|
||||||
|
[:svg
|
||||||
|
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"}
|
||||||
|
[:path
|
||||||
|
{:d
|
||||||
|
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"}]]
|
||||||
|
[:span {:class "count like-count"} "FAVOURITES_COUNT"]]]]]]])
|
|
@ -1,195 +0,0 @@
|
||||||
; Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
; or more contributor license agreements. See the NOTICE file
|
|
||||||
; distributed with this work for additional information
|
|
||||||
; regarding copyright ownership. The ASF licenses this file
|
|
||||||
; to you under the Apache License, Version 2.0 (the
|
|
||||||
; "License"); you may not use this file except in compliance
|
|
||||||
; with the License. You may obtain a copy of the License at
|
|
||||||
;
|
|
||||||
; http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
;
|
|
||||||
; Unless required by applicable law or agreed to in writing, software
|
|
||||||
; distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
; See the License for the specific language governing permissions and
|
|
||||||
; limitations under the License.
|
|
||||||
|
|
||||||
(ns dda.masto-embed.render-bootstrap-test
|
|
||||||
(:require
|
|
||||||
[cljs.test :refer (deftest is)]
|
|
||||||
[dda.masto-embed.render-bootstrap :as sut]))
|
|
||||||
|
|
||||||
(def statuses [{:mentions []
|
|
||||||
:emojis []
|
|
||||||
:tags []
|
|
||||||
:reblog
|
|
||||||
{:mentions []
|
|
||||||
:emojis []
|
|
||||||
:tags
|
|
||||||
[{:name "hetzner"
|
|
||||||
:url "https://social.meissa-gmbh.de/tags/hetzner"}
|
|
||||||
{:name "devops", :url "https://social.meissa-gmbh.de/tags/devops"}
|
|
||||||
{:name "k8s", :url "https://social.meissa-gmbh.de/tags/k8s"}
|
|
||||||
{:name "cheap", :url "https://social.meissa-gmbh.de/tags/cheap"}]
|
|
||||||
:reblog nil
|
|
||||||
:replies_count 0
|
|
||||||
:in_reply_to_account_id nil
|
|
||||||
:reblogs_count 1
|
|
||||||
:application nil
|
|
||||||
:content
|
|
||||||
"mentioned: <p>We've a new asciicast ... </p>"
|
|
||||||
:sensitive false
|
|
||||||
:favourites_count 2
|
|
||||||
:in_reply_to_id nil
|
|
||||||
:poll nil
|
|
||||||
:account
|
|
||||||
{:acct "jerger"
|
|
||||||
:last_status_at "2020-06-14"
|
|
||||||
:emojis []
|
|
||||||
:bot false
|
|
||||||
:group false
|
|
||||||
:following_count 64
|
|
||||||
:avatar_static
|
|
||||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/001/original/794ca61bfd71bbe1.jpg"
|
|
||||||
:fields
|
|
||||||
[{:name "blog"
|
|
||||||
:value
|
|
||||||
"<a href=\"https://domaindrivenarchitecture.org/\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">domaindrivenarchitecture.org/</span><span class=\"invisible\"></span></a>"
|
|
||||||
:verified_at nil}
|
|
||||||
{:name "interests"
|
|
||||||
:value "Clojure, sci-fi, tech, DevOps, public weal"
|
|
||||||
:verified_at nil}
|
|
||||||
{:name "location"
|
|
||||||
:value "Reutlingen, de, eu"
|
|
||||||
:verified_at nil}]
|
|
||||||
:username "jerger"
|
|
||||||
:header_static
|
|
||||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/001/original/2a45f78fa1af0815.jpg"
|
|
||||||
:discoverable true
|
|
||||||
:statuses_count 135
|
|
||||||
:header
|
|
||||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/001/original/2a45f78fa1af0815.jpg"
|
|
||||||
:note
|
|
||||||
"<p>meissa GmbH, Maintainer, dda-pallet, Clojure, OpenSource, DevOps, DomainDrivenDesign, Demokratie, Bürgerbeteiligung, Europa, Klettern, Wandern</p>"
|
|
||||||
:locked false
|
|
||||||
:id "1"
|
|
||||||
:avatar
|
|
||||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/001/original/794ca61bfd71bbe1.jpg"
|
|
||||||
:url "https://social.meissa-gmbh.de/@jerger"
|
|
||||||
:display_name "jerger"
|
|
||||||
:followers_count 24
|
|
||||||
:created_at "2019-06-02T10:41:41.919Z"}
|
|
||||||
:card
|
|
||||||
{:description
|
|
||||||
"We use our dda-k8s-crate to install kubernetes automatically with a nexux repository manager. See our GitHub page for more details :) https://github.com/DomainDrivenArchitecture/dda-k8s-crate"
|
|
||||||
:author_url ""
|
|
||||||
:width 400
|
|
||||||
:type "link"
|
|
||||||
:embed_url ""
|
|
||||||
:title "Automatic kubernetes installation"
|
|
||||||
:provider_name ""
|
|
||||||
:url "https://asciinema.org/a/329800"
|
|
||||||
:author_name ""
|
|
||||||
:image
|
|
||||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/cache/preview_cards/images/000/024/180/original/8562ddca088c16e3.png"
|
|
||||||
:provider_url ""
|
|
||||||
:height 311
|
|
||||||
:html ""}
|
|
||||||
:language "en"
|
|
||||||
:id "104172691066899431"
|
|
||||||
:url "https://social.meissa-gmbh.de/@jerger/104172691066899431"
|
|
||||||
:media_attachments []
|
|
||||||
:uri
|
|
||||||
"https://social.meissa-gmbh.de/users/jerger/statuses/104172691066899431"
|
|
||||||
:visibility "public"
|
|
||||||
:created_at "2020-05-15T13:25:19.190Z"
|
|
||||||
:spoiler_text ""}
|
|
||||||
:replies_count 0
|
|
||||||
:in_reply_to_account_id nil
|
|
||||||
:reblogs_count 0
|
|
||||||
:application nil
|
|
||||||
:content
|
|
||||||
"<p>We've a new asciicast ... </p>"
|
|
||||||
:sensitive false
|
|
||||||
:favourites_count 0
|
|
||||||
:in_reply_to_id nil
|
|
||||||
:poll nil
|
|
||||||
:account
|
|
||||||
{:acct "team"
|
|
||||||
:last_status_at "2020-05-17"
|
|
||||||
:emojis []
|
|
||||||
:bot false
|
|
||||||
:group false
|
|
||||||
:following_count 2
|
|
||||||
:avatar_static
|
|
||||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/002/original/1aaff0c626a2ade3.png"
|
|
||||||
:fields []
|
|
||||||
:username "team"
|
|
||||||
:header_static
|
|
||||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/002/original/2e6a592b61a2d505.jpg"
|
|
||||||
:discoverable true
|
|
||||||
:statuses_count 12
|
|
||||||
:header
|
|
||||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/002/original/2e6a592b61a2d505.jpg"
|
|
||||||
:note
|
|
||||||
"<p>DevOps, Cloud, KI, Clojure, Java, Python, Reutlingen, Tübingen, Stuttgart, genossenschaftlich, OpenSource, TestDriven, Maintainer</p>"
|
|
||||||
:locked false
|
|
||||||
:id "2"
|
|
||||||
:avatar
|
|
||||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/002/original/1aaff0c626a2ade3.png"
|
|
||||||
:url "https://social.meissa-gmbh.de/@team"
|
|
||||||
:display_name "meissa-team"
|
|
||||||
:followers_count 3
|
|
||||||
:created_at "2019-06-02T10:50:28.976Z"}
|
|
||||||
:card nil
|
|
||||||
:language nil
|
|
||||||
:id "104183256213204298"
|
|
||||||
:url
|
|
||||||
"https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity"
|
|
||||||
:media_attachments []
|
|
||||||
:uri
|
|
||||||
"https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity"
|
|
||||||
:visibility "public"
|
|
||||||
:created_at "2020-05-17T10:12:10.403Z"
|
|
||||||
:spoiler_text ""}])
|
|
||||||
|
|
||||||
(deftest test-mastodon->html
|
|
||||||
(is (= [:ul {:class "list-group"}
|
|
||||||
'([:li {:class "list-group-item, card"}
|
|
||||||
[:div {:class "card-body"}
|
|
||||||
[:h2 {:class "card-title"} [:a {:href "https://social.meissa-gmbh.de/@team"} "2020-05-17" " " "10:12:10"]]
|
|
||||||
[:p {:class "card-text"} "<p>We've a new asciicast ... </p>"
|
|
||||||
nil]]])]
|
|
||||||
(sut/masto->html statuses))))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(deftest empty-card-should-produce-empty-result
|
|
||||||
(is (= nil
|
|
||||||
(sut/mastocard->html nil))))
|
|
||||||
|
|
||||||
(def link-card {:description "A comprehensive free SSL test for your public web servers.",
|
|
||||||
:author_url "", :width 0, :type "link", :embed_url "",
|
|
||||||
:title "SSL Server Test (Powered by Qualys SSL Labs)",
|
|
||||||
:provider_name "", :url "https://www.ssllabs.com/ssltest/",
|
|
||||||
:author_name "", :image nil, :provider_url "", :height 0, :html ""})
|
|
||||||
|
|
||||||
(deftest link-card-should-show-desc-and-link
|
|
||||||
(is (= [:div {:class "card", :url "https://www.ssllabs.com/ssltest/"} nil
|
|
||||||
[:h3 {:class "card-title"} "SSL Server Test (Powered by Qualys SSL Labs)"]
|
|
||||||
[:p {:class "card-body"} "A comprehensive free SSL test for your public web servers."]]
|
|
||||||
(sut/mastocard->html link-card))))
|
|
||||||
|
|
||||||
(def link-card-with-image
|
|
||||||
{:description "Cryogen's core. Contribute to DomainDrivenArchitecture/cryogen-core development by creating an account on GitHub.", :author_url "", :width 400, :type "link", :embed_url "",
|
|
||||||
:title "DomainDrivenArchitecture/cryogen-core", :provider_name "",
|
|
||||||
:url "https://github.com/DomainDrivenArchitecture/cryogen-core", :author_name "",
|
|
||||||
:image "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/cache/preview_cards/images/000/017/635/original/5634071238f1f91f.png",
|
|
||||||
:provider_url "", :height 400, :html ""})
|
|
||||||
|
|
||||||
(deftest link-card-should-show-image-and-desc-and-link
|
|
||||||
(is (= [:div {:class "card", :url "https://github.com/DomainDrivenArchitecture/cryogen-core"}
|
|
||||||
[:img {:class "card-img-top", :src "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/cache/preview_cards/images/000/017/635/original/5634071238f1f91f.png"}]
|
|
||||||
[:h3 {:class "card-title"} "DomainDrivenArchitecture/cryogen-core"]
|
|
||||||
[:p {:class "card-body"} "Cryogen's core. Contribute to DomainDrivenArchitecture/cryogen-core development by creating an account on GitHub."]]
|
|
||||||
(sut/mastocard->html link-card-with-image))))
|
|
90
src/test/dda/masto_embed/to_html_test.cljs
Normal file
90
src/test/dda/masto_embed/to_html_test.cljs
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
; Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
; or more contributor license agreements. See the NOTICE file
|
||||||
|
; distributed with this work for additional information
|
||||||
|
; regarding copyright ownership. The ASF licenses this file
|
||||||
|
; to you under the Apache License, Version 2.0 (the
|
||||||
|
; "License"); you may not use this file except in compliance
|
||||||
|
; with the License. You may obtain a copy of the License at
|
||||||
|
;
|
||||||
|
; http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
;
|
||||||
|
; Unless required by applicable law or agreed to in writing, software
|
||||||
|
; distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
; See the License for the specific language governing permissions and
|
||||||
|
; limitations under the License.
|
||||||
|
|
||||||
|
(ns dda.masto-embed.to-html-test
|
||||||
|
(:require
|
||||||
|
[cljs.test :refer (deftest is)]
|
||||||
|
[dda.masto-embed.to-html :as sut]
|
||||||
|
[dda.masto-embed.data-helpers :as dh]
|
||||||
|
[hickory.core :as h]
|
||||||
|
[hickory.convert :as hc]
|
||||||
|
[shadow.resource :as rc]))
|
||||||
|
|
||||||
|
(def media_attachments
|
||||||
|
[{:description "Plastikmüll gesammelt",
|
||||||
|
:meta
|
||||||
|
{:original
|
||||||
|
{:width 1500, :height 2000, :size "1500x2000", :aspect 0.75},
|
||||||
|
:small
|
||||||
|
{:width 416,
|
||||||
|
:height 554,
|
||||||
|
:size "416x554",
|
||||||
|
:aspect 0.7509025270758123}},
|
||||||
|
:type "image",
|
||||||
|
:blurhash "UAFiMmx^9aE1yEjEM|%N0eD%w]t7D$%NR4tR",
|
||||||
|
:preview_url
|
||||||
|
"https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/small/0d01ddb07440328e.jpg",
|
||||||
|
:preview_remote_url nil,
|
||||||
|
:id "112432505467393505",
|
||||||
|
:url
|
||||||
|
"https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/original/0d01ddb07440328e.jpg",
|
||||||
|
:remote_url nil,
|
||||||
|
:text_url nil}])
|
||||||
|
|
||||||
|
(def link_prev
|
||||||
|
{:description "forgejo - Beyond coding. We forge.",
|
||||||
|
:author_url "",
|
||||||
|
:image_description "",
|
||||||
|
:width 290,
|
||||||
|
:type "link",
|
||||||
|
:embed_url "",
|
||||||
|
:blurhash "URC3:FsU1xJS-8NvJ9$OFIS3wexEJ9n*xEbG",
|
||||||
|
:title
|
||||||
|
"forgejo/tests/integration/api_activitypub_repository_test.go at fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e",
|
||||||
|
:published_at nil,
|
||||||
|
:provider_name "Codeberg.org",
|
||||||
|
:language "en",
|
||||||
|
:url
|
||||||
|
"https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go",
|
||||||
|
:author_name "",
|
||||||
|
:image
|
||||||
|
"https://cdn.masto.host/socialmeissagmbhde/cache/preview_cards/images/000/545/643/original/199336f5aa5b9683.png",
|
||||||
|
:provider_url "",
|
||||||
|
:height 290,
|
||||||
|
:html ""})
|
||||||
|
|
||||||
|
; TODO: Replace this test
|
||||||
|
;(deftest test-mastodon->html
|
||||||
|
; (is (= [:ul {:class "list-group"}
|
||||||
|
; '([:li {:class "list-group-item, card"}
|
||||||
|
; [:div {:class "card-body"}
|
||||||
|
; [:h2 {:class "card-title"} [:a {:href "https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity"} "2020-05-17" " " "10:12:10"]]
|
||||||
|
; [:p {:class "card-text"} "<p>We've a new asciicast ... </p>"
|
||||||
|
; nil]]])]
|
||||||
|
; (sut/masto->html statuses))))
|
||||||
|
|
||||||
|
(deftest test-masto-media->html
|
||||||
|
(is (= dh/post-with-img
|
||||||
|
(sut/masto-media->html dh/post-base-img media_attachments))))
|
||||||
|
|
||||||
|
(deftest test-insert-link-prev
|
||||||
|
(is (= dh/post-with-prev
|
||||||
|
(sut/insert-link-prev dh/post-base-prev))))
|
||||||
|
|
||||||
|
(deftest test-masto-link-prev->html
|
||||||
|
(is (= dh/filled-post-with-prev
|
||||||
|
(sut/masto-link-prev->html dh/post-base-prev link_prev))))
|
||||||
|
|
Loading…
Reference in a new issue