aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/services')
-rw-r--r--src/services/api/api.service.js38
-rw-r--r--src/services/backend_interactor_service/backend_interactor_service.js7
-rw-r--r--src/services/status_poster/status_poster.service.js4
-rw-r--r--src/services/style_setter/style_setter.js9
4 files changed, 48 insertions, 10 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index f14bfd6d..0d91851b 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -30,6 +30,8 @@ const BLOCKING_URL = '/api/blocks/create.json'
const UNBLOCKING_URL = '/api/blocks/destroy.json'
const USER_URL = '/api/users/show.json'
const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import'
+const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account'
+const CHANGE_PASSWORD_URL = '/api/pleroma/change_password'
import { each, map } from 'lodash'
import 'whatwg-fetch'
@@ -329,12 +331,14 @@ const retweet = ({ id, credentials }) => {
})
}
-const postStatus = ({credentials, status, mediaIds, inReplyToStatusId}) => {
+const postStatus = ({credentials, status, spoilerText, visibility, mediaIds, inReplyToStatusId}) => {
const idsText = mediaIds.join(',')
const form = new FormData()
form.append('status', status)
form.append('source', 'Pleroma FE')
+ if (spoilerText) form.append('spoiler_text', spoilerText)
+ if (visibility) form.append('visibility', visibility)
form.append('media_ids', idsText)
if (inReplyToStatusId) {
form.append('in_reply_to_status_id', inReplyToStatusId)
@@ -373,6 +377,34 @@ const followImport = ({params, credentials}) => {
.then((response) => response.ok)
}
+const deleteAccount = ({credentials, password}) => {
+ const form = new FormData()
+
+ form.append('password', password)
+
+ return fetch(DELETE_ACCOUNT_URL, {
+ body: form,
+ method: 'POST',
+ headers: authHeaders(credentials)
+ })
+ .then((response) => response.json())
+}
+
+const changePassword = ({credentials, password, newPassword, newPasswordConfirmation}) => {
+ const form = new FormData()
+
+ form.append('password', password)
+ form.append('new_password', newPassword)
+ form.append('new_password_confirmation', newPasswordConfirmation)
+
+ return fetch(CHANGE_PASSWORD_URL, {
+ body: form,
+ method: 'POST',
+ headers: authHeaders(credentials)
+ })
+ .then((response) => response.json())
+}
+
const fetchMutes = ({credentials}) => {
const url = '/api/qvitter/mutes.json'
@@ -408,7 +440,9 @@ const apiService = {
updateProfile,
updateBanner,
externalProfile,
- followImport
+ followImport,
+ deleteAccount,
+ changePassword
}
export default apiService
diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js
index 52b8286b..14173558 100644
--- a/src/services/backend_interactor_service/backend_interactor_service.js
+++ b/src/services/backend_interactor_service/backend_interactor_service.js
@@ -61,6 +61,9 @@ const backendInteractorService = (credentials) => {
const externalProfile = (profileUrl) => apiService.externalProfile({profileUrl, credentials})
const followImport = ({params}) => apiService.followImport({params, credentials})
+ const deleteAccount = ({password}) => apiService.deleteAccount({credentials, password})
+ const changePassword = ({password, newPassword, newPasswordConfirmation}) => apiService.changePassword({credentials, password, newPassword, newPasswordConfirmation})
+
const backendInteractorServiceInstance = {
fetchStatus,
fetchConversation,
@@ -82,7 +85,9 @@ const backendInteractorService = (credentials) => {
updateBanner,
updateProfile,
externalProfile,
- followImport
+ followImport,
+ deleteAccount,
+ changePassword
}
return backendInteractorServiceInstance
diff --git a/src/services/status_poster/status_poster.service.js b/src/services/status_poster/status_poster.service.js
index 001ff8a5..3381e9e2 100644
--- a/src/services/status_poster/status_poster.service.js
+++ b/src/services/status_poster/status_poster.service.js
@@ -1,10 +1,10 @@
import { map } from 'lodash'
import apiService from '../api/api.service.js'
-const postStatus = ({ store, status, media = [], inReplyToStatusId = undefined }) => {
+const postStatus = ({ store, status, spoilerText, visibility, media = [], inReplyToStatusId = undefined }) => {
const mediaIds = map(media, 'id')
- return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, mediaIds, inReplyToStatusId})
+ return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, spoilerText, visibility, mediaIds, inReplyToStatusId})
.then((data) => data.json())
.then((data) => {
if (!data.error) {
diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js
index 9dc4a3e1..493d444e 100644
--- a/src/services/style_setter/style_setter.js
+++ b/src/services/style_setter/style_setter.js
@@ -71,13 +71,11 @@ const setColors = (col, commit) => {
colors.bg = rgb2hex(col.bg.r, col.bg.g, col.bg.b) // background
colors.lightBg = rgb2hex((col.bg.r + col.fg.r) / 2, (col.bg.g + col.fg.g) / 2, (col.bg.b + col.fg.b) / 2) // hilighted bg
colors.btn = rgb2hex(col.fg.r, col.fg.g, col.fg.b) // panels & buttons
+ colors.input = `rgba(${col.fg.r}, ${col.fg.g}, ${col.fg.b}, .5)`
colors.border = rgb2hex(col.fg.r - mod, col.fg.g - mod, col.fg.b - mod) // borders
- colors.faint = rgb2hex(
- col.text.r * 0.45 + col.fg.r * 0.55,
- col.text.g * 0.45 + col.fg.g * 0.55,
- col.text.b * 0.45 + col.fg.b * 0.55) // faint text
+ colors.faint = `rgba(${col.text.r}, ${col.text.g}, ${col.text.b}, .5)`
colors.fg = rgb2hex(col.text.r, col.text.g, col.text.b) // text
- colors.lightFg = rgb2hex(col.text.r - mod, col.text.g - mod, col.text.b - mod) // strong text
+ colors.lightFg = rgb2hex(col.text.r - mod * 5, col.text.g - mod * 5, col.text.b - mod * 5) // strong text
colors['base07'] = rgb2hex(col.text.r - mod * 2, col.text.g - mod * 2, col.text.b - mod * 2)
@@ -92,6 +90,7 @@ const setColors = (col, commit) => {
colors.cAlertRed = col.cRed && `rgba(${col.cRed.r}, ${col.cRed.g}, ${col.cRed.b}, .5)`
radii.btnRadius = col.btnRadius
+ radii.inputRadius = col.inputRadius
radii.panelRadius = col.panelRadius
radii.avatarRadius = col.avatarRadius
radii.avatarAltRadius = col.avatarAltRadius