From c633a0a52cd6200ee5f51949a94d400ff7f71a57 Mon Sep 17 00:00:00 2001 From: Amber Date: Mon, 21 Mar 2022 20:16:28 -0500 Subject: [PATCH 1/7] made a sample config that I think might work --- README.md | 9 ++------- config.json.default | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 config.json.default diff --git a/README.md b/README.md index 6a9434a..246934e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This version makes quite a few changes from [the original](https://github.com/Je - Doesn't unnecessarily redownload all toots every time ## FediBooks -Before you use mstdn-ebooks to create your own ebooks bot, I recommend checking out [FediBooks](https://fedibooks.com). Compared to mstdn-ebooks, FediBooks offers a few advantages: +Before you use mstdn-ebooks to create your own ebooks bot, I recommend checking out [FediBooks(Broken link)](https://fedibooks.com). Compared to mstdn-ebooks, FediBooks offers a few advantages: - Hosted and maintained by someone else - you don't have to worry about updating, keeping the computer on, etc - No installation required - A nice UI for managing your bot(s) @@ -25,7 +25,7 @@ Like mstdn-ebooks, FediBooks is free, both as in free of charge and free to modi Secure fetch (aka authorised fetches, authenticated fetches, secure mode...) is *not* supported by mstdn-ebooks, and will fail to download any posts from users on instances with secure fetch enabled. For more information, see [this wiki page](https://github.com/Lynnesbian/mstdn-ebooks/wiki/Secure-fetch). ## Install/usage Guide -An installation and usage guide is available [here](https://cloud.lynnesbian.space/s/jozbRi69t4TpD95). It's primarily targeted at Linux, but it should be possible on BSD, macOS, etc. I've also put some effort into providing steps for Windows, but I can't make any guarantees as to its effectiveness. +An installation and usage guide is available [here(broken link)](https://cloud.lynnesbian.space/s/jozbRi69t4TpD95). It's primarily targeted at Linux, but it should be possible on BSD, macOS, etc. I've also put some effort into providing steps for Windows, but I can't make any guarantees as to its effectiveness. ### Docker While there is a Docker version provided, it is **not guaranteed to work**. I personally don't use Docker and don't know how the Dockerfile works; it was create over a year ago by someone else and hasn't been updated since. It might work for you, it might not. If you'd like to help update the Dockerfile, please get in touch with me on the Fediverse. @@ -58,8 +58,3 @@ Configuring mstdn-ebooks is accomplished by editing `config.json`. If you want t | max_thread_length | 15 | The maximum number of bot posts in a thread before it stops replying. A thread can be 10 or 10000 posts long, but the bot will stop after it has posted `max_thread_length` times. | | strip_paired_punctuation | false | If true, mstdn-ebooks will remove punctuation that commonly appears in pairs, like " and (). This avoids the issue of posts that open a bracket (or quote) without closing it. | -## Donating -Please don't feel obligated to donate at all. - -- [Ko-Fi](https://ko-fi.com/lynnesbian) allows you to make one-off payments in increments of AU$3. These payments are not taxed. -- [PayPal](https://paypal.me/lynnesbian) allows you to make one-off payments of any amount in a range of currencies. These payments may be taxed. diff --git a/config.json.default b/config.json.default new file mode 100644 index 0000000..04628f7 --- /dev/null +++ b/config.json.default @@ -0,0 +1,15 @@ +{ + "cfg": { + "site": "https://botsin.space", + "cw": null, + "instance_blacklist": ["bofa.lol", "witches.town", "knzk.me"], + "learn_from_cw": false, + "mention_handling": 1, + "max_thread_length": 15, + "strip_paired_punctuation": false, + "secret": "client_secret", + "id": "client_id", + "client": "placeholder", + "website": "https://git.nixnet.services/amber/amber-ebooks" + } +} From c934808199f9bac19293e792fc579d0620842f5c Mon Sep 17 00:00:00 2001 From: Amber Date: Mon, 21 Mar 2022 20:29:07 -0500 Subject: [PATCH 2/7] fixed default config formatting --- config.json.default | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/config.json.default b/config.json.default index 04628f7..5ef15b6 100644 --- a/config.json.default +++ b/config.json.default @@ -1,15 +1,13 @@ { - "cfg": { - "site": "https://botsin.space", - "cw": null, - "instance_blacklist": ["bofa.lol", "witches.town", "knzk.me"], - "learn_from_cw": false, - "mention_handling": 1, - "max_thread_length": 15, - "strip_paired_punctuation": false, - "secret": "client_secret", - "id": "client_id", - "client": "placeholder", - "website": "https://git.nixnet.services/amber/amber-ebooks" - } + "site": "https://example.com", + "cw": null, + "instance_blacklist": ["bofa.lol", "witches.town", "knzk.me"], + "learn_from_cw": false, + "mention_handling": 1, + "max_thread_length": 15, + "strip_paired_punctuation": false, + "secret": "client_secret", + "id": "client_id", + "client": "placeholder", + "website": "https://git.nixnet.services/amber/amber-ebooks" } From e0eec3109649f47f8b09ace1a90b85c57c1d2841 Mon Sep 17 00:00:00 2001 From: Amber Date: Mon, 21 Mar 2022 20:29:07 -0500 Subject: [PATCH 3/7] fixed default config formatting --- config.json.default | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/config.json.default b/config.json.default index 04628f7..8e419ea 100644 --- a/config.json.default +++ b/config.json.default @@ -1,15 +1,13 @@ { - "cfg": { - "site": "https://botsin.space", - "cw": null, - "instance_blacklist": ["bofa.lol", "witches.town", "knzk.me"], - "learn_from_cw": false, - "mention_handling": 1, - "max_thread_length": 15, - "strip_paired_punctuation": false, - "secret": "client_secret", - "id": "client_id", - "client": "placeholder", - "website": "https://git.nixnet.services/amber/amber-ebooks" - } + "site": "https://example.com", + "cw": null, + "instance_blacklist": ["bofa.lol", "witches.town", "knzk.me"], + "learn_from_cw": false, + "mention_handling": 1, + "max_thread_length": 15, + "strip_paired_punctuation": false, + "secret": "client_secret", + "id": 11111111111, + "client": "placeholder", + "website": "https://git.nixnet.services/amber/amber-ebooks" } From f37840ef01ebb055d80a0895dcb9fea5ad2046aa Mon Sep 17 00:00:00 2001 From: Amber Date: Mon, 21 Mar 2022 21:09:41 -0500 Subject: [PATCH 4/7] renamed config.json.default to config.def.json because the lack of syntax highlighting was getting on my nerves --- config.json.default => config.def.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) rename config.json.default => config.def.json (52%) diff --git a/config.json.default b/config.def.json similarity index 52% rename from config.json.default rename to config.def.json index 8e419ea..4eeb4e0 100644 --- a/config.json.default +++ b/config.def.json @@ -1,13 +1,14 @@ { - "site": "https://example.com", + "site": "https://botsin.space", "cw": null, "instance_blacklist": ["bofa.lol", "witches.town", "knzk.me"], "learn_from_cw": false, "mention_handling": 1, "max_thread_length": 15, "strip_paired_punctuation": false, - "secret": "client_secret", - "id": 11111111111, - "client": "placeholder", - "website": "https://git.nixnet.services/amber/amber-ebooks" + "website": "https://git.nixnet.services/amber/amber-ebooks", + "client": { + "id": "placeholder string", + "secret": "placeholder string" + } } From a64a1a8e96a8b144de82a3b99bd29f55cd73aec3 Mon Sep 17 00:00:00 2001 From: Amber Date: Mon, 21 Mar 2022 21:48:03 -0500 Subject: [PATCH 5/7] Made generated config look a little nicer --- config.def.json | 6 +----- main.py | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/config.def.json b/config.def.json index 4eeb4e0..861542e 100644 --- a/config.def.json +++ b/config.def.json @@ -6,9 +6,5 @@ "mention_handling": 1, "max_thread_length": 15, "strip_paired_punctuation": false, - "website": "https://git.nixnet.services/amber/amber-ebooks", - "client": { - "id": "placeholder string", - "secret": "placeholder string" - } + "website": "https://git.nixnet.services/amber/amber-ebooks" } diff --git a/main.py b/main.py index e0a11b7..f573a33 100755 --- a/main.py +++ b/main.py @@ -62,7 +62,8 @@ if "secret" not in cfg: print("Open this URL and authenticate to give mstdn-ebooks access to your bot's account: {}".format(client.auth_request_url(scopes=scopes))) cfg['secret'] = client.log_in(code=input("Secret: "), scopes=scopes) -json.dump(cfg, open(args.cfg, "w+")) +#json.dump(cfg, open(args.cfg, "w+")) +open(args.cfg, "w").write(re.sub(",", ",\n", json.dumps(cfg))) def extract_toot(toot): toot = functions.extract_toot(toot) From d884627c51a00dee6de97ad0246ba4e50a058d9f Mon Sep 17 00:00:00 2001 From: Amber Date: Mon, 21 Mar 2022 21:55:43 -0500 Subject: [PATCH 6/7] untracked files on dev: 64676f7 Merge branch 'dev' of git.nixnet.services:amber/amber-ebooks into dev --- .vscode/amber-ebooks.code-workspace | 8 ++++++++ .vscode/launch.json | 17 +++++++++++++++++ __pycache__/functions.cpython-310.pyc | Bin 0 -> 2735 bytes config.json | 13 +++++++++++++ toots.db | Bin 0 -> 16384 bytes 5 files changed, 38 insertions(+) create mode 100644 .vscode/amber-ebooks.code-workspace create mode 100644 .vscode/launch.json create mode 100644 __pycache__/functions.cpython-310.pyc create mode 100644 config.json create mode 100644 toots.db diff --git a/.vscode/amber-ebooks.code-workspace b/.vscode/amber-ebooks.code-workspace new file mode 100644 index 0000000..bb77f5a --- /dev/null +++ b/.vscode/amber-ebooks.code-workspace @@ -0,0 +1,8 @@ +{ + "folders": [ + { + "path": "/home/amber/pkg/git/nixnet/amber-ebooks" + } + ], + "settings": {} +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..37c2785 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true, + "args": ["-c", "config.json"] + } + ] +} \ No newline at end of file diff --git a/__pycache__/functions.cpython-310.pyc b/__pycache__/functions.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..44a7ff36474aa0e0483739968246da808cc42b7d GIT binary patch literal 2735 zcmai0Pjef$6$h|?xTHu~lAWfSNz-*ZQ;W@nlpSZLNgP+PCAXQe<&316wj0^&^JBg*PMLssfV@?U?|6$HeJrX2jD#bZ{P2S2j;C- z1Htom{88_3O9*|ZJ3o8~bhh9X&p=Q_af$-1Ns31#Ab37z1(vbdfo-%CI7YjHYjiEB z8SMogwW$3P1$F9B7j%Qxs0Vt9;(gSvzk*%RZX2uCJr6ht#UKX(qWAW&K9eD4< zD}IF$`W=Kt$x8@IqUZSBnh;5*mfmOv0ZM!7KnqVS=~h-)tE{OvLle8g)LBRTMrBXy z)ScmJ14f;!X8N^7UoKV7Ii}tb;h$7!+NAXv)*ro(Dnc967G0vvm#A{K(K(*sb3B1P zrpq$~`(Bx@=zX>K1U`S_QEyVOJc>%hkE=Ru9ck@8U!}|R3SIe@O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