diff --git a/.env.example b/.env.example
index 77d0676..09c787e 100644
--- a/.env.example
+++ b/.env.example
@@ -21,3 +21,5 @@ SPOTIFY_SECRET=
ANILIST_SECRET=
ANILIST_CLIENT_ID=
BACK_URL=
+REDDIT_CLIENT_ID=
+REDDIT_SECRET=
diff --git a/web-app/src/i18n/en/translation.json b/web-app/src/i18n/en/translation.json
index 037491f..42ab3ea 100644
--- a/web-app/src/i18n/en/translation.json
+++ b/web-app/src/i18n/en/translation.json
@@ -34,5 +34,13 @@
"switch_to_english": "English",
"pipeline_error_prefix": "Error: ",
"pipeline_layout_pipeline_section_title": "My pipelines",
- "pipeline_layout_disable_pipeline_section_title": "Disabled pipelines"
+ "pipeline_layout_disable_pipeline_section_title": "Disabled pipelines",
+ "pipeline_edit_params_info_text": "You can use the residuals variables from previous reactions by typing {PARAM_NAME@REACTION_ID}.",
+ "pipeline_edit_area_service_disconnected_info_part_1": "You must be connected to the ",
+ "pipeline_edit_area_service_disconnected_info_part_2": " service to use its ",
+ "pipeline_missing_service_account_part_1": "You aren't connected to a ",
+ "pipeline_missing_service_account_part_2": " account and you're using actions/reactions from this service in this pipeline",
+ "pipeline_no_last_trigger": "Not triggered yet",
+ "loginWithServices": "You can sign in with this services:",
+ "signUpWithServices": "You can sign up with this services:"
}
\ No newline at end of file
diff --git a/web-app/src/i18n/fr/translation.json b/web-app/src/i18n/fr/translation.json
index c38d745..1edefff 100644
--- a/web-app/src/i18n/fr/translation.json
+++ b/web-app/src/i18n/fr/translation.json
@@ -34,5 +34,13 @@
"switch_to_english": "Anglais",
"pipeline_error_prefix": "Erreur: ",
"pipeline_layout_pipeline_section_title": "Mes pipelines",
- "pipeline_layout_disable_pipeline_section_title": "Pipelines désativées"
+ "pipeline_layout_disable_pipeline_section_title": "Pipelines désativées",
+ "pipeline_edit_params_info_text": "Vous pouvez utiliser les résidus des actions et réactions passées en utilisant la synthaxe suivante {NOM_DU_PARAM@ID_RÉACTION}.",
+ "pipeline_edit_area_service_disconnected_info_part_1": "Vous devez être connecté au service ",
+ "pipeline_edit_area_service_disconnected_info_part_2": " pour profiter de ses ",
+ "pipeline_missing_service_account_part_1": "Vous n'êtes pas connecté à un compte ",
+ "pipeline_missing_service_account_part_2": " et vous utilisez des actions/réactions de ce service dans cette pipeline",
+ "pipeline_no_last_trigger": "Jamais déclenchée",
+ "loginWithServices": "Vous pouvez vous connecter avec ces services:",
+ "signUpWithServices": "Vous pouvez vous enregistrer avec ces services:"
}
\ No newline at end of file
diff --git a/web-app/src/pages/Login/LoginPage.tsx b/web-app/src/pages/Login/LoginPage.tsx
index 325d516..d7d1001 100644
--- a/web-app/src/pages/Login/LoginPage.tsx
+++ b/web-app/src/pages/Login/LoginPage.tsx
@@ -253,6 +253,27 @@ export default function AuthComponent() {
{authData.authMode === "login" ? t('signUp') : t('connectToAeris')}
+
+
+ {authData.authMode === 'login' ? t('loginWithServices') : t('signUpWithServices')}
+
+
+ {servicesData.map((elem, index) => {
+ if (elem.uid === "utils")
+ return ();
+ return (
+
+ );
+ })}
+
diff --git a/worker/src/services/reddit.ts b/worker/src/services/reddit.ts
new file mode 100644
index 0000000..2c6e3a8
--- /dev/null
+++ b/worker/src/services/reddit.ts
@@ -0,0 +1,92 @@
+import { Pipeline, PipelineEnv, PipelineType, ReactionType, ServiceType } from "../models/pipeline";
+import { action, BaseService, reaction, service } from "../models/base-service";
+import { Client, GuildMember, Intents, Message, TextChannel } from "discord.js";
+import { filter, fromEvent, map, Observable } from "rxjs";
+import snoowrap, {Submission, Subreddit} from 'snoowrap';
+
+@service(ServiceType.Reddit)
+export class Reddit extends BaseService {
+ private _pipeline: Pipeline;
+ private _client: snoowrap;
+
+ constructor(pipeline: Pipeline) {
+ super();
+ this._client = new snoowrap({
+ userAgent: "Aeris",
+ accessToken: this._pipeline.userData["Reddit"].accessToken
+ });
+ }
+
+ @reaction(ReactionType.JoinSubreddit, ['sub_id'])
+ async joinSubreddit(params: any): Promise {
+ return this._client.getSubreddit(params['sub_id']).subscribe().then((response) => {
+ return {
+ SUB_NAME: response.name,
+ SUB_ID: response.id
+ };
+ });
+ }
+
+ @reaction(ReactionType.LeaveSubreddit, ['sub_id'])
+ async leaveSubreddit(params: any): Promise {
+ return this._client.getSubreddit(params['sub_id']).unsubscribe().then((response) => {
+ return {
+ SUB_NAME: response.name,
+ SUB_ID: response.id
+ };
+ });
+ }
+
+ @reaction(ReactionType.PostInSubreddit, ['sub_id', 'title', 'body'])
+ async postInSubreddit(params: any): Promise {
+ return this._client.getSubreddit(params['sub_id']).submitSelfpost({
+ subredditName: params['sub_id'],
+ title: params['title'],
+ text: params['body']
+ }).then((response) => {
+ return {
+ SUB_NAME: response.subreddit.name,
+ SUB_ID: response.subreddit.id,
+ POST_ID: response.id
+ };
+ });
+ }
+
+ @reaction(ReactionType.ReplyToPost, ['post_id', 'reply_body'])
+ async commentPost(params: any): Promise {
+ let fetchedSubmission: Submission = this._client.getSubmission(params['post_id']);
+
+ return fetchedSubmission.reply(params['reply_body']).then((res) => {
+ return {
+ SUB_NAME: fetchedSubmission.subreddit.name,
+ SUB_ID: fetchedSubmission.subreddit.id,
+ POST_ID: params['post_id'],
+ REPLY_ID: res.id
+ };
+ });
+ }
+
+ @reaction(ReactionType.Upvote, ['post_id'])
+ async upvotePost(params: any): Promise {
+ return this._client.getSubmission(params['post_id']).upvote().then((res) => {
+ return {
+ SUB_NAME: res.subreddit.name,
+ SUB_ID: res.subreddit.id,
+ POST_ID: params['post_id'],
+ UPVOTE_COUNT: res.ups
+ };
+ });
+ }
+
+ @reaction(ReactionType.Downvote, ['post_id'])
+ async downvotePost(params: any): Promise {
+ return this._client.getSubmission(params['post_id']).downvote().then((res) => {
+ return {
+ SUB_NAME: res.subreddit.name,
+ SUB_ID: res.subreddit.id,
+ POST_ID: res.id,
+ DOWNVOTE_COUNT: res.downs
+ };
+ });
+ }
+}