Skip to content

Commit d695453

Browse files
committed
Merge branch 'edge'
2 parents ba53233 + 04b8762 commit d695453

File tree

6 files changed

+126
-1
lines changed

6 files changed

+126
-1
lines changed

docs/examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This directory contains example of valid, ready-to-go configurations for Context
1818
* [Author](/docs/examples/author)
1919
* [Regex](/docs/examples/regex)
2020
* [Repost](/docs/examples/repost)
21+
* [Author and post flairs](/docs/examples/onlyfansFlair)
2122
* [Toolbox User Notes](/docs/examples/userNotes)
2223
* [Advanced Concepts](/docs/examples/advancedConcepts)
2324
* [Rule Sets](/docs/examples/advancedConcepts/ruleSets.json5)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Flair users and submissions
2+
3+
Flair users and submissions based on certain keywords from submitter's profile.
4+
5+
Consult [User Flair schema](https://json-schema.app/view/%23%2Fdefinitions%2FUserFlairActionJson?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fcontext-mod%2Fmaster%2Fsrc%2FSchema%2FApp.json) and [Submission Flair schema](https://json-schema.app/view/%23%2Fdefinitions%2FFlairActionJson?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fcontext-mod%2Fmaster%2Fsrc%2FSchema%2FApp.json) for a complete reference of the rule's properties.
6+
7+
### Examples
8+
9+
* OnlyFans submissions [YAML](/docs/examples/onlyFansFlair/onlyFansFlair.yaml) | [JSON](/docs/examples/onlyfansFlair/onlyfansFlair.json5) - Check whether submitter has typical OF keywords in their profile and flair both author + submission accordingly.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"checks": [
3+
{
4+
"name": "Flair OF submitters",
5+
"description": "Flair submission as OF if user does not have Verified flair and has certain keywords in their profile",
6+
"kind": "submission",
7+
"authorIs": {
8+
"exclude": [
9+
{
10+
"flairCssClass": ["verified"]
11+
}
12+
]
13+
},
14+
"rules": [
15+
{
16+
"name": "OnlyFans strings in description",
17+
"kind": "author",
18+
"include": [
19+
{
20+
"description": [
21+
"/(cashapp|allmylinks|linktr|onlyfans\\.com)/i",
22+
"/(see|check|my|view) (out|of|onlyfans|kik|skype|insta|ig|profile|links)/i",
23+
"my links",
24+
"$"
25+
]
26+
}
27+
]
28+
}
29+
],
30+
"actions": [
31+
{
32+
"name": "Set OnlyFans user flair",
33+
"kind": "userflair",
34+
"flair_template_id": "put-your-onlyfans-user-flair-id-here"
35+
},
36+
{
37+
"name":"Set OF Creator SUBMISSION flair",
38+
"kind": "flair",
39+
"flair_template_id": "put-your-onlyfans-post-flair-id-here"
40+
}
41+
]
42+
},
43+
44+
{
45+
"name": "Flair posts of OF submitters",
46+
"description": "Flair submission as OnlyFans if submitter has OnlyFans userflair (override post flair set by submitter)",
47+
"kind": "submission",
48+
"rules": [
49+
{
50+
"name": "Include OF submitters",
51+
"kind": "author",
52+
"include": [
53+
{
54+
"flairCssClass": ["onlyfans"]
55+
}
56+
]
57+
}
58+
],
59+
"actions": [
60+
{
61+
"name":"Set OF Creator SUBMISSION flair",
62+
"kind": "flair",
63+
"flair_template_id": "put-your-onlyfans-post-flair-id-here"
64+
}
65+
]
66+
}
67+
]
68+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
checks:
2+
- name: Flair OF submitters
3+
description: Flair submission as OF if user does not have Verified flair and has
4+
certain keywords in their profile
5+
kind: submission
6+
authorIs:
7+
exclude:
8+
- flairCssClass:
9+
- verified
10+
rules:
11+
- name: OnlyFans strings in description
12+
kind: author
13+
include:
14+
- description:
15+
- '/(cashapp|allmylinks|linktr|onlyfans\.com)/i'
16+
- '/(see|check|my|view) (out|of|onlyfans|kik|skype|insta|ig|profile|links)/i'
17+
- my links
18+
- "$"
19+
actions:
20+
- name: Set OnlyFans user flair
21+
kind: userflair
22+
flair_template_id: put-your-onlyfans-user-flair-id-here
23+
- name: Set OF Creator SUBMISSION flair
24+
kind: flair
25+
flair_template_id: put-your-onlyfans-post-flair-id-here
26+
- name: Flair posts of OF submitters
27+
description: Flair submission as OnlyFans if submitter has OnlyFans userflair (override post flair set by submitter)
28+
kind: submission
29+
rules:
30+
- name: Include OF submitters
31+
kind: author
32+
include:
33+
- flairCssClass:
34+
- onlyfans
35+
actions:
36+
- name: Set OF Creator SUBMISSION flair
37+
kind: flair
38+
flair_template_id: put-your-onlyfans-post-flair-id-here

src/Web/Client/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,9 @@ const webClient = async (options: OperatorConfig) => {
352352
msg = `${msg}. ${botAddResult.stored === false ? 'Additionally, the bot was not stored in config so the operator will need to add it manually to persist after a restart.' : ''}`;
353353
}
354354
data.addResult = msg;
355+
// @ts-ignore
356+
req.session.destroy();
357+
req.logout();
355358
}
356359
}
357360
return res.render('callback', data);

src/Web/Server/routes/authenticated/user/status.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ const status = () => {
4141
if(req.serverBot !== undefined) {
4242
bots = [req.serverBot];
4343
} else {
44-
bots = (req.user as Express.User).isOperator ? req.botApp.bots : req.botApp.bots.filter(x => intersect(req.user?.subreddits as string[], x.subManagers.map(y => y.subreddit.display_name)));
44+
bots = (req.user as Express.User).isOperator ? req.botApp.bots : req.botApp.bots.filter(x => {
45+
const i = intersect(req.user?.subreddits as string[], x.subManagers.map(y => y.subreddit.display_name));
46+
return i.length > 0;
47+
});
4548
}
4649
const botResponses: BotStatusResponse[] = [];
4750
for(const b of bots) {
@@ -89,6 +92,9 @@ const status = () => {
8992
if(m === undefined) {
9093
continue;
9194
}
95+
if(!(req.user as Express.User).isOperator && !(req.user?.subreddits as string[]).includes(m.subreddit.display_name)) {
96+
continue;
97+
}
9298
const sd = {
9399
name: s,
94100
//linkName: s.replace(/\W/g, ''),

0 commit comments

Comments
 (0)