From 7ce076f6fe61f6b09c9bebfcd61ee858968cce98 Mon Sep 17 00:00:00 2001 From: 0Nom4D Date: Sun, 6 Mar 2022 16:54:04 +0100 Subject: [PATCH] Aeris : feat/reddit-worker - Commiting forgotten files --- README.md | 2 +- api/src/Api/OIDC.hs | 4 ++-- api/src/Core/OIDC.hs | 6 +++--- api/src/Core/User.hs | 4 ++-- mobile/lib/src/models/service.dart | 2 +- web-app/src/utils/globals.tsx | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 5e8ac90..2ca2dce 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Aeris supports a variety of service, on which Pipelines are perfomed upon: - GitHub - Spotify - Youtube -- Discord +- Reddit - Anilist - Twitter diff --git a/api/src/Api/OIDC.hs b/api/src/Api/OIDC.hs index 4eb3cdd..ae0a691 100644 --- a/api/src/Api/OIDC.hs +++ b/api/src/Api/OIDC.hs @@ -7,7 +7,7 @@ module Api.OIDC where import App (AppM) import Control.Monad.IO.Class (liftIO) -import Core.User (ExternalToken (ExternalToken, service), Service (Github, Spotify, Twitter, Google, Anilist, Discord), UserId (UserId), User (User)) +import Core.User (ExternalToken (ExternalToken, service), Service (Github, Spotify, Twitter, Google, Anilist, Reddit), UserId (UserId), User (User)) import Data.Text (pack) import Core.OIDC ( getOauthTokens ) import Repository.User (updateTokens, getTokensByUserId, delTokens) @@ -43,7 +43,7 @@ urlHandler Anilist (Just r) = do backRedirect <- liftIO $ envAsString "BACK_URL" "" throwError $ err302 { errHeaders = [("Location", B8.pack $ "https://anilist.co/api/v2/oauth/authorize?client_id=" ++ clientId ++ "&response_type=code&redirect_uri=" ++ backRedirect ++ "auth/redirect" ++ "&state=" ++ r)] } -urlHandler Discord (Just r) = do +urlHandler Reddit (Just r) = do clientId <- liftIO $ envAsString "DISCORD_CLIENT_ID" "" backRedirect <- liftIO $ envAsString "BACK_URL" "" throwError $ err302 { errHeaders = diff --git a/api/src/Core/OIDC.hs b/api/src/Core/OIDC.hs index 2a74b5d..573c5b6 100644 --- a/api/src/Core/OIDC.hs +++ b/api/src/Core/OIDC.hs @@ -6,7 +6,7 @@ import qualified Data.ByteString.Char8 as B8 import qualified Data.HashMap.Strict as HM import App (AppM) -import Core.User (ExternalToken (ExternalToken, expiresAt), Service (Github, Discord, Spotify, Google, Twitter, Anilist)) +import Core.User (ExternalToken (ExternalToken, expiresAt), Service (Github, Reddit, Spotify, Google, Twitter, Anilist)) import Data.Aeson.Types (Object, Value (String)) import Data.Text (Text, pack, unpack) import Network.HTTP.Simple (JSONException, addRequestHeader, getResponseBody, httpJSONEither, parseRequest, setRequestMethod, setRequestQueryString, setRequestBodyURLEncoded) @@ -96,7 +96,7 @@ getDiscordTokens code = do refresh <- lookupObjString obj "refresh_token" expiresIn <- lookupObjInt obj "expires_in" let expiresAt = addUTCTime (fromInteger . fromIntegral $ expiresIn) currTime - Just $ ExternalToken (pack access) (pack refresh) expiresAt Discord + Just $ ExternalToken (pack access) (pack refresh) expiresAt Reddit -- GOOGLE getGoogleConfig :: IO OAuth2Conf @@ -246,7 +246,7 @@ getAnilistTokens code = do -- General getOauthTokens :: Service -> String -> IO (Maybe ExternalToken) getOauthTokens Github = getGithubTokens -getOauthTokens Discord = getDiscordTokens +getOauthTokens Reddit = getDiscordTokens getOauthTokens Spotify = getSpotifyTokens getOauthTokens Google = getGoogleTokens getOauthTokens Twitter = getTwitterTokens diff --git a/api/src/Core/User.hs b/api/src/Core/User.hs index 3a7f7b2..6e8ff97 100644 --- a/api/src/Core/User.hs +++ b/api/src/Core/User.hs @@ -26,7 +26,7 @@ newtype UserId = UserId {toInt64 :: Int64} deriving newtype (DBEq, DBType, Eq, Show, Num, FromJSON, ToJSON, FromHttpApiData) deriving stock (Generic) -data Service = Github | Google | Spotify | Twitter | Discord | Anilist +data Service = Github | Google | Spotify | Twitter | Reddit | Anilist deriving (Eq, Show, Generic, ToJSON, FromJSON) instance FromHttpApiData Service where @@ -35,7 +35,7 @@ instance FromHttpApiData Service where parseUrlPiece "google" = Right Google parseUrlPiece "spotify" = Right Spotify parseUrlPiece "twitter" = Right Twitter - parseUrlPiece "discord" = Right Discord + parseUrlPiece "discord" = Right Reddit parseUrlPiece "anilist" = Right Anilist parseUrlPiece _ = Left "not a service" diff --git a/mobile/lib/src/models/service.dart b/mobile/lib/src/models/service.dart index 2ccf842..8188785 100644 --- a/mobile/lib/src/models/service.dart +++ b/mobile/lib/src/models/service.dart @@ -40,7 +40,7 @@ class Service { logoUrl = "https://anilist.co/img/icons/android-chrome-512x512.png"; const Service.discord() - : name = "Discord", + : name = "Reddit", url = "https://discord.com/app", logoUrl = "https://play-lh.googleusercontent.com/fbrWR4LbtB_1Ulgz3_rw8bY3tx_zPU7A9ZOB5WYG_QmqOUUjA6JEzE_20GA4YBDWMx4"; diff --git a/web-app/src/utils/globals.tsx b/web-app/src/utils/globals.tsx index 9ae1c10..f219e58 100644 --- a/web-app/src/utils/globals.tsx +++ b/web-app/src/utils/globals.tsx @@ -30,7 +30,7 @@ export const AppServicesLogos: { [key: string]: ImageProps } = { }, discord: { imageSrc: "https://upload.wikimedia.org/wikipedia/fr/4/4f/Discord_Logo_sans_texte.svg", - altText: "Discord logo", + altText: "Reddit logo", }, anilist: { imageSrc: "https://anilist.co/img/icons/safari-pinned-tab.svg", @@ -75,7 +75,7 @@ export const AppServices: Array = [ linked: false, }, { - label: "Discord", + label: "Reddit", uid: "discord", logo: AppServicesLogos["discord"], urlAuth: getServiceUrl("discord"),