use OAuthStore directly
This commit is contained in:
parent
529a2d100b
commit
3984a5aefa
44 changed files with 226 additions and 256 deletions
|
|
@ -30,7 +30,6 @@ import routes from './routes'
|
|||
|
||||
import { useAnnouncementsStore } from 'src/stores/announcements'
|
||||
import { useAuthFlowStore } from 'src/stores/auth_flow'
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useEmojiStore } from 'src/stores/emoji.js'
|
||||
import { useI18nStore } from 'src/stores/i18n'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
|
|
@ -38,7 +37,7 @@ import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.j
|
|||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
|
||||
|
|
@ -261,13 +260,6 @@ const getStickers = async ({ store }) => {
|
|||
}
|
||||
}
|
||||
|
||||
const getAppSecret = async ({ store }) => {
|
||||
const oauth = useOAuthStore()
|
||||
if (oauth.userToken) {
|
||||
useCredentialsStore().setCredentials(oauth.getToken)
|
||||
}
|
||||
}
|
||||
|
||||
const resolveStaffAccounts = ({ store, accounts }) => {
|
||||
const nicknames = accounts.map((uri) => uri.split('/').pop())
|
||||
useInstanceStore().set({
|
||||
|
|
@ -458,14 +450,13 @@ const setConfig = async ({ store }) => {
|
|||
const apiConfig = configInfos[0]
|
||||
const staticConfig = configInfos[1]
|
||||
|
||||
getAppSecret({ store })
|
||||
await setSettings({ store, apiConfig, staticConfig })
|
||||
}
|
||||
|
||||
const checkOAuthToken = async ({ store }) => {
|
||||
const oauth = useOAuthStore()
|
||||
if (oauth.getUserToken) {
|
||||
return store.dispatch('loginUser', oauth.getUserToken)
|
||||
if (oauth.userToken) {
|
||||
return store.dispatch('loginUser', oauth.userToken)
|
||||
}
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import EmojiPicker from 'src/components/emoji_picker/emoji_picker.vue'
|
||||
|
||||
import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders.js'
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { fetchBookmarkFolders } from 'src/services/api/api.service.js'
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ const BookmarkFolderEdit = {
|
|||
if (!this.id) return
|
||||
|
||||
fetchBookmarkFolders({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((folders) => {
|
||||
const folder = folders.find((folder) => folder.id === this.id)
|
||||
if (!folder) return
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ import {
|
|||
isScrollable,
|
||||
} from './chat_layout_utils.js'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
chatMessages,
|
||||
|
|
@ -277,7 +277,7 @@ const Chat = {
|
|||
id: chatId,
|
||||
maxId,
|
||||
sinceId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((messages) => {
|
||||
// Clear the current chat in case we're recovering from a ws connection loss.
|
||||
if (isFirstFetch) {
|
||||
|
|
@ -312,7 +312,7 @@ const Chat = {
|
|||
try {
|
||||
chat = await getOrCreateChat({
|
||||
accountId: this.recipientId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
} catch (e) {
|
||||
console.error('Error creating or getting a chat', e)
|
||||
|
|
@ -381,7 +381,7 @@ const Chat = {
|
|||
|
||||
sendChatMessage({
|
||||
params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then((data) => {
|
||||
this.$store.dispatch('addChatMessages', {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { mapGetters, mapState } from 'vuex'
|
|||
import BasicUserCard from 'src/components/basic_user_card/basic_user_card.vue'
|
||||
import UserAvatar from 'src/components/user_avatar/user_avatar.vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { chats } from 'src/services/api/api.service.js'
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ const chatNew = {
|
|||
},
|
||||
async created() {
|
||||
const { chats } = await chats({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
chats.forEach((chat) => this.suggestions.push(chat.account))
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import QuickViewSettings from 'src/components/quick_view_settings/quick_view_set
|
|||
import ThreadTree from 'src/components/thread_tree/thread_tree.vue'
|
||||
import { WSConnectionStatus } from '../../services/api/api.service.js'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { fetchConversation, fetchStatus } from 'src/services/api/api.service.js'
|
||||
|
||||
|
|
@ -441,7 +441,7 @@ const conversation = {
|
|||
if (this.status) {
|
||||
fetchConversation({
|
||||
id: this.statusId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ ancestors, descendants }) => {
|
||||
this.$store.dispatch('addNewStatuses', { statuses: ancestors })
|
||||
this.$store.dispatch('addNewStatuses', { statuses: descendants })
|
||||
|
|
@ -451,13 +451,14 @@ const conversation = {
|
|||
this.loadStatusError = null
|
||||
fetchStatus({
|
||||
id: this.statusId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then((status) => {
|
||||
this.$store.dispatch('addNewStatuses', { statuses: [status] })
|
||||
this.fetchConversation()
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
this.loadStatusError = error
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import { defineAsyncComponent } from 'vue'
|
|||
import { notificationsFromStore } from '../../services/notification_utils/notification_utils.js'
|
||||
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { approveUser, denyUser } from 'src/services/api/api.service.js'
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ const FollowRequestCard = {
|
|||
doApprove() {
|
||||
approveUser({
|
||||
id: this.user.id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
this.$store.dispatch('removeFollowRequest', this.user)
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ const FollowRequestCard = {
|
|||
|
||||
denyUser({
|
||||
id: this.user.id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => {
|
||||
this.$store.dispatch('dismissNotificationLocal', { id: notifId })
|
||||
this.$store.dispatch('removeFollowRequest', this.user)
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ import {
|
|||
highlightStyle,
|
||||
} from '../../services/user_highlighter/user_highlighter.js'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
|
||||
import { approveUser, denyUser } from 'src/services/api/api.service.js'
|
||||
|
|
@ -146,7 +146,7 @@ const Notification = {
|
|||
doApprove() {
|
||||
approveUser({
|
||||
id: this.user.id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
this.$store.dispatch('removeFollowRequest', this.user)
|
||||
this.$store.dispatch('markSingleNotificationAsSeen', {
|
||||
|
|
@ -170,7 +170,7 @@ const Notification = {
|
|||
doDeny() {
|
||||
denyUser({
|
||||
id: this.user.id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => {
|
||||
this.$store.dispatch('dismissNotificationLocal', {
|
||||
id: this.notification.id,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { fetchUser } from 'src/services/api/api.service.js'
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ const RemoteUserResolver = {
|
|||
const id = this.$route.params.username + '@' + this.$route.params.hostname
|
||||
fetchUser({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then((externalUser) => {
|
||||
if (externalUser.error) {
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ import Popover from 'components/popover/popover.vue'
|
|||
import SelectComponent from 'components/select/select.vue'
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
addNewEmojiFile,
|
||||
|
|
@ -257,7 +257,7 @@ export default {
|
|||
newShortcode: this.editedShortcode,
|
||||
newFilename: this.editedFile,
|
||||
force: false,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then((resp) => {
|
||||
if (resp.error !== undefined) {
|
||||
|
|
@ -281,7 +281,7 @@ export default {
|
|||
: this.emojiAddr(this.file),
|
||||
shortcode: this.editedShortcode,
|
||||
filename: this.editedFile,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then((resp) => resp.json())
|
||||
.then((resp) => {
|
||||
|
|
@ -308,7 +308,7 @@ export default {
|
|||
deleteEmojiFile({
|
||||
packName: this.packName,
|
||||
shortcode: this.shortcode,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then((resp) => resp.json())
|
||||
.then((resp) => {
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import SharedComputedObject from '../helpers/shared_computed_object.js'
|
|||
import UnitSetting from '../helpers/unit_setting.vue'
|
||||
import Preview from './old_theme_tab/theme_preview.vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { normalizeThemeData, useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { updateProfileImages } from 'src/services/api/api.service.js'
|
||||
import { newImporter } from 'src/services/export_import/export_import.js'
|
||||
|
|
@ -488,7 +488,7 @@ const AppearanceTab = {
|
|||
this.backgroundUploading = true
|
||||
updateProfileImages({
|
||||
background,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then((data) => {
|
||||
this.$store.commit('addNewUsers', [data])
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ import IntegerSetting from '../helpers/integer_setting.vue'
|
|||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||
import UnitSetting from '../helpers/unit_setting.vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { updateProfile } from 'src/services/api/api.service.js'
|
||||
|
|
@ -168,7 +168,7 @@ const ComposingTab = {
|
|||
|
||||
updateProfile({
|
||||
params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((user) => {
|
||||
this.$store.commit('addNewUsers', [user])
|
||||
this.$store.commit('setCurrentUser', user)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import Checkbox from 'src/components/checkbox/checkbox.vue'
|
|||
import Exporter from 'src/components/exporter/exporter.vue'
|
||||
import Importer from 'src/components/importer/importer.vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useOAuthTokensStore } from 'src/stores/oauth_tokens.js'
|
||||
|
||||
import {
|
||||
|
|
@ -47,23 +47,23 @@ const DataImportExportTab = {
|
|||
getFollowsContent() {
|
||||
return exportFriends({
|
||||
id: this.user.id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(this.generateExportableUsersContent)
|
||||
},
|
||||
getBlocksContent() {
|
||||
return fetchBlocks({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(this.generateExportableUsersContent)
|
||||
},
|
||||
getMutesContent() {
|
||||
return fetchMutes({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(this.generateExportableUsersContent)
|
||||
},
|
||||
importFollows(file) {
|
||||
return importFollows({
|
||||
file,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) => {
|
||||
if (!status) {
|
||||
throw new Error('failed')
|
||||
|
|
@ -73,7 +73,7 @@ const DataImportExportTab = {
|
|||
importBlocks(file) {
|
||||
return importBlocks({
|
||||
file,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) => {
|
||||
if (!status) {
|
||||
throw new Error('failed')
|
||||
|
|
@ -83,7 +83,7 @@ const DataImportExportTab = {
|
|||
importMutes(file) {
|
||||
return importMutes({
|
||||
file,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) => {
|
||||
if (!status) {
|
||||
throw new Error('failed')
|
||||
|
|
@ -105,7 +105,7 @@ const DataImportExportTab = {
|
|||
},
|
||||
addBackup() {
|
||||
addBackup({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then(() => {
|
||||
this.addedBackup = true
|
||||
|
|
@ -119,7 +119,7 @@ const DataImportExportTab = {
|
|||
},
|
||||
fetchBackups() {
|
||||
listBackups({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then((res) => {
|
||||
this.backups = res
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ import FloatSetting from '../helpers/float_setting.vue'
|
|||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||
import UnitSetting from '../helpers/unit_setting.vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { updateProfile } from 'src/services/api/api.service.js'
|
||||
|
|
@ -62,7 +62,7 @@ const GeneralTab = {
|
|||
|
||||
updateProfile({
|
||||
params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((user) => {
|
||||
this.$store.commit('addNewUsers', [user])
|
||||
this.$store.commit('setCurrentUser', user)
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import MuteCard from 'src/components/mute_card/mute_card.vue'
|
|||
import ProgressButton from 'src/components/progress_button/progress_button.vue'
|
||||
import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useOAuthTokensStore } from 'src/stores/oauth_tokens.js'
|
||||
|
||||
import { importBlocks, importFollows } from 'src/services/api/api.service.js'
|
||||
|
|
@ -59,7 +59,7 @@ const MutesAndBlocks = {
|
|||
importFollows(file) {
|
||||
return importFollows({
|
||||
file,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) => {
|
||||
if (!status) {
|
||||
throw new Error('failed')
|
||||
|
|
@ -69,7 +69,7 @@ const MutesAndBlocks = {
|
|||
importBlocks(file) {
|
||||
return importBlocks({
|
||||
file,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) => {
|
||||
if (!status) {
|
||||
throw new Error('failed')
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import BooleanSetting from '../helpers/boolean_setting.vue'
|
||||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { updateNotificationSettings } from 'src/services/api/api.service.js'
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ const NotificationsTab = {
|
|||
methods: {
|
||||
updateNotificationSettings() {
|
||||
updateNotificationSettings({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
settings: this.notificationSettings,
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import UserCard from 'src/components/user_card/user_card.vue'
|
|||
import BooleanSetting from '../helpers/boolean_setting.vue'
|
||||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { updateProfile } from 'src/services/api/api.service.js'
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ const ProfileTab = {
|
|||
}
|
||||
updateProfile({
|
||||
params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then((user) => {
|
||||
this.$store.commit('addNewUsers', [user])
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import Confirm from './confirm.vue'
|
|||
import RecoveryCodes from './mfa_backup_codes.vue'
|
||||
import TOTP from './mfa_totp.vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
generateMfaBackupCodes,
|
||||
|
|
@ -94,7 +94,7 @@ const Mfa = {
|
|||
this.backupCodes.codes = []
|
||||
|
||||
return generateMfaBackupCodes({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((res) => {
|
||||
this.backupCodes.codes = res.codes
|
||||
this.backupCodes.inProgress = false
|
||||
|
|
@ -121,7 +121,7 @@ const Mfa = {
|
|||
this.setupState.state = 'setupOTP'
|
||||
this.setupState.setupOTPState = 'prepare'
|
||||
mfaSetupOTP({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((res) => {
|
||||
this.otpSettings = res
|
||||
this.setupState.setupOTPState = 'confirm'
|
||||
|
|
@ -133,7 +133,7 @@ const Mfa = {
|
|||
mfaConfirmOTP({
|
||||
token: this.otpConfirmToken,
|
||||
password: this.currentPassword,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((res) => {
|
||||
if (res.error) {
|
||||
this.error = res.error
|
||||
|
|
@ -162,7 +162,7 @@ const Mfa = {
|
|||
// fetch settings from server
|
||||
async fetchSettings() {
|
||||
const result = await settingsMFA({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
if (result.error) return
|
||||
this.settings = result.settings
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { mapState } from 'vuex'
|
|||
|
||||
import Confirm from './confirm.vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { mfaDisableOTP } from 'src/services/api/api.service.js'
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ export default {
|
|||
this.inProgress = true
|
||||
mfaDisableOTP({
|
||||
password: this.currentPassword,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((res) => {
|
||||
this.inProgress = false
|
||||
if (res.error) {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ import Checkbox from 'src/components/checkbox/checkbox.vue'
|
|||
import ProgressButton from 'src/components/progress_button/progress_button.vue'
|
||||
import Mfa from './mfa.vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useOAuthTokensStore } from 'src/stores/oauth_tokens'
|
||||
|
||||
import {
|
||||
|
|
@ -76,7 +76,7 @@ const SecurityTab = {
|
|||
},
|
||||
deleteAccount() {
|
||||
deleteAccount({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
password: this.deleteAccountConfirmPasswordInput,
|
||||
}).then((res) => {
|
||||
if (res.status === 'success') {
|
||||
|
|
@ -92,7 +92,7 @@ const SecurityTab = {
|
|||
password: this.changePasswordInputs[0],
|
||||
newPassword: this.changePasswordInputs[1],
|
||||
newPasswordConfirmation: this.changePasswordInputs[2],
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}
|
||||
changePassword(params).then((res) => {
|
||||
if (res.status === 'success') {
|
||||
|
|
@ -109,7 +109,7 @@ const SecurityTab = {
|
|||
const params = {
|
||||
email: this.newEmail,
|
||||
password: this.changeEmailPassword,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}
|
||||
changeEmail(params).then((res) => {
|
||||
if (res.status === 'success') {
|
||||
|
|
@ -125,7 +125,7 @@ const SecurityTab = {
|
|||
const params = {
|
||||
targetAccount: this.moveAccountTarget,
|
||||
password: this.moveAccountPassword,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}
|
||||
moveAccount(params).then((res) => {
|
||||
if (res.status === 'success') {
|
||||
|
|
@ -140,13 +140,13 @@ const SecurityTab = {
|
|||
removeAlias(alias) {
|
||||
deleteAlias({
|
||||
alias,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => this.fetchAliases())
|
||||
},
|
||||
addAlias() {
|
||||
addAlias({
|
||||
alias: this.addAliasTarget,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then(() => {
|
||||
this.addedAlias = true
|
||||
|
|
@ -161,7 +161,7 @@ const SecurityTab = {
|
|||
},
|
||||
fetchAliases() {
|
||||
listAliases({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then((res) => {
|
||||
this.aliases = res.aliases
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ import Select from 'src/components/select/select.vue'
|
|||
import UserAvatar from 'src/components/user_avatar/user_avatar.vue'
|
||||
import UserLink from 'src/components/user_link/user_link.vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useEmojiStore } from 'src/stores/emoji.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface'
|
||||
import { useMediaViewerStore } from 'src/stores/media_viewer'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { usePostStatusStore } from 'src/stores/post_status'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import List from 'src/components/list/list.vue'
|
|||
import Modal from 'src/components/modal/modal.vue'
|
||||
import UserLink from 'src/components/user_link/user_link.vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useReportsStore } from 'src/stores/reports.js'
|
||||
|
||||
import { reportUser } from 'src/services/api/api.service.js'
|
||||
|
|
@ -31,6 +31,7 @@ const UserReportingModal = {
|
|||
return !!this.$store.state.users.currentUser
|
||||
},
|
||||
isOpen() {
|
||||
console.log(this.reportModal)
|
||||
return this.isLoggedIn && this.reportModal.activated
|
||||
},
|
||||
userId() {
|
||||
|
|
@ -73,7 +74,7 @@ const UserReportingModal = {
|
|||
comment: this.comment,
|
||||
forward: this.forward,
|
||||
statusIds: [...this.statusIdsToReport],
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}
|
||||
reportUser({ ...params })
|
||||
.then(() => {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import FollowCard from 'src/components/follow_card/follow_card.vue'
|
||||
import apiService from '../../services/api/api.service.js'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { fetchUser, suggestions } from 'src/services/api/api.service.js'
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ const WhoToFollow = {
|
|||
reply.forEach(({ id }) => {
|
||||
fetchUser({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((externalUser) => {
|
||||
if (!externalUser.error) {
|
||||
this.$store.commit('addNewUsers', [externalUser])
|
||||
|
|
@ -33,7 +33,7 @@ const WhoToFollow = {
|
|||
})
|
||||
},
|
||||
getWhoToFollow() {
|
||||
const credentials = useCredentialsStore().current
|
||||
const credentials = useOAuthStore().token
|
||||
if (credentials) {
|
||||
suggestions({ credentials }).then((reply) => {
|
||||
this.showWhoToFollow(reply)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { shuffle } from 'lodash'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { fetchUser, suggestions } from 'src/services/api/api.service.js'
|
||||
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
||||
|
|
@ -20,7 +20,7 @@ function showWhoToFollow(panel, reply) {
|
|||
|
||||
fetchUser({
|
||||
id: name,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((externalUser) => {
|
||||
if (!externalUser.error) {
|
||||
panel.$store.commit('addNewUsers', [externalUser])
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ import { Socket } from 'phoenix'
|
|||
import { WSConnectionStatus } from '../services/api/api.service.js'
|
||||
import { maybeShowChatNotification } from '../services/chat_utils/chat_utils.js'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useShoutStore } from 'src/stores/shout.js'
|
||||
|
||||
import {
|
||||
|
|
@ -98,7 +98,7 @@ const api = {
|
|||
const timelineData = rootState.statuses.timelines.friends
|
||||
|
||||
const serv = useInstanceStore().server.replace('http', 'ws')
|
||||
const credentials = useCredentialsStore().current
|
||||
const credentials = useOAuthStore().token
|
||||
const url = getMastodonSocketURI({ credentials }, serv)
|
||||
|
||||
state.mastoUserSocket = ProcessedWS({
|
||||
|
|
@ -266,7 +266,7 @@ const api = {
|
|||
statusId,
|
||||
bookmarkFolderId,
|
||||
tag,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
|
||||
store.commit('addFetcher', { fetcherName: timeline, fetcher })
|
||||
|
|
@ -282,7 +282,7 @@ const api = {
|
|||
store,
|
||||
timeline,
|
||||
...rest,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ const api = {
|
|||
if (store.state.fetchers.notifications) return
|
||||
const fetcher = notificationsFetcher.startFetching({
|
||||
store,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
store.commit('addFetcher', { fetcherName: 'notifications', fetcher })
|
||||
},
|
||||
|
|
@ -306,7 +306,7 @@ const api = {
|
|||
if (store.state.fetchers.followRequests) return
|
||||
const fetcher = followRequestFetcher.startFetchingFollowRequests({
|
||||
store,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
|
||||
store.commit('addFetcher', { fetcherName: 'followRequests', fetcher })
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {
|
|||
} from '../services/entity_normalizer/entity_normalizer.service.js'
|
||||
import { promiseInterval } from '../services/promise_interval/promise_interval.js'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
chats,
|
||||
|
|
@ -68,7 +68,7 @@ const chatsModule = {
|
|||
},
|
||||
fetchChats({ dispatch, rootState }) {
|
||||
return chats({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ chatList }) => {
|
||||
dispatch('addNewChats', { chats: chatList })
|
||||
return chats
|
||||
|
|
@ -125,14 +125,14 @@ const chatsModule = {
|
|||
readChat({
|
||||
id,
|
||||
lastReadId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
}
|
||||
},
|
||||
deleteChatMessage({ rootState, commit }, value) {
|
||||
deleteChatMessage({
|
||||
...value,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
commit('deleteChatMessage', { commit, ...value })
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ import {
|
|||
maybeShowNotification,
|
||||
} from '../services/notification_utils/notification_utils.js'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useI18nStore } from 'src/stores/i18n.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useReportsStore } from 'src/stores/reports.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ export const notifications = {
|
|||
commit('dismissNotification', { id })
|
||||
dismissNotification({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
updateNotification({ commit }, { id, updater }) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { get, set } from 'lodash'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
updateNotificationSettings,
|
||||
|
|
@ -12,7 +12,7 @@ const defaultApi = ({ rootState, commit }, { path, value }) => {
|
|||
set(params, path, value)
|
||||
return updateProfile({
|
||||
params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((result) => {
|
||||
commit('addNewUsers', [result])
|
||||
commit('setCurrentUser', result)
|
||||
|
|
@ -24,7 +24,7 @@ const notificationsApi = ({ rootState, commit }, { path, value, oldValue }) => {
|
|||
set(settings, path, value)
|
||||
return updateNotificationSettings({
|
||||
settings,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((result) => {
|
||||
if (result.status === 'success') {
|
||||
commit('confirmProfileOption', { name, value })
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ import {
|
|||
unretweet,
|
||||
} from '../services/api/api.service.js'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
const emptyTl = (userId = 0) => ({
|
||||
statuses: [],
|
||||
|
|
@ -632,7 +632,7 @@ const statuses = {
|
|||
fetchStatusSource({ rootState }, status) {
|
||||
return fetchStatusSource({
|
||||
id: status.id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
fetchStatusHistory(_, status) {
|
||||
|
|
@ -641,7 +641,7 @@ const statuses = {
|
|||
deleteStatus({ rootState, commit }, status) {
|
||||
deleteStatus({
|
||||
id: status.id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then(() => {
|
||||
commit('setDeleted', { status })
|
||||
|
|
@ -667,7 +667,7 @@ const statuses = {
|
|||
commit('setFavorited', { status, value: true })
|
||||
favorite({
|
||||
id: status.id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) =>
|
||||
commit('setFavoritedConfirm', {
|
||||
status,
|
||||
|
|
@ -680,7 +680,7 @@ const statuses = {
|
|||
commit('setFavorited', { status, value: false })
|
||||
unfavorite({
|
||||
id: status.id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) =>
|
||||
commit('setFavoritedConfirm', {
|
||||
status,
|
||||
|
|
@ -691,7 +691,7 @@ const statuses = {
|
|||
fetchPinnedStatuses({ rootState, dispatch }, userId) {
|
||||
fetchPinnedStatuses({
|
||||
id: userId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((statuses) =>
|
||||
dispatch('addNewStatuses', {
|
||||
statuses,
|
||||
|
|
@ -705,25 +705,25 @@ const statuses = {
|
|||
pinStatus({ rootState, dispatch }, statusId) {
|
||||
return pinOwnStatus({
|
||||
id: statusId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) => dispatch('addNewStatuses', { statuses: [status] }))
|
||||
},
|
||||
unpinStatus({ rootState, dispatch }, statusId) {
|
||||
return unpinOwnStatus({
|
||||
id: statusId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) => dispatch('addNewStatuses', { statuses: [status] }))
|
||||
},
|
||||
muteConversation({ rootState, commit }, { id: statusId }) {
|
||||
return muteConversation({
|
||||
id: statusId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) => commit('setMutedStatus', status))
|
||||
},
|
||||
unmuteConversation({ rootState, commit }, { id: statusId }) {
|
||||
return unmuteConversation({
|
||||
id: statusId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) => commit('setMutedStatus', status))
|
||||
},
|
||||
retweet({ rootState, commit }, status) {
|
||||
|
|
@ -731,7 +731,7 @@ const statuses = {
|
|||
commit('setRetweeted', { status, value: true })
|
||||
retweet({
|
||||
id: status.id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) =>
|
||||
commit('setRetweetedConfirm', {
|
||||
status: status.retweeted_status,
|
||||
|
|
@ -744,7 +744,7 @@ const statuses = {
|
|||
commit('setRetweeted', { status, value: false })
|
||||
unretweet({
|
||||
id: status.id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) =>
|
||||
commit('setRetweetedConfirm', {
|
||||
status,
|
||||
|
|
@ -757,7 +757,7 @@ const statuses = {
|
|||
bookmarkStatus({
|
||||
id: status.id,
|
||||
folder_id: status.bookmark_folder_id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) => {
|
||||
commit('setBookmarkedConfirm', { status })
|
||||
})
|
||||
|
|
@ -766,7 +766,7 @@ const statuses = {
|
|||
commit('setBookmarked', { status, value: false })
|
||||
unbookmarkStatus({
|
||||
id: status.id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((status) => {
|
||||
commit('setBookmarkedConfirm', { status })
|
||||
})
|
||||
|
|
@ -781,11 +781,11 @@ const statuses = {
|
|||
Promise.all([
|
||||
fetchFavoritedByUsers({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}),
|
||||
fetchRebloggedByUsers({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}),
|
||||
]).then(([favoritedByUsers, rebloggedByUsers]) => {
|
||||
commit('addFavs', {
|
||||
|
|
@ -808,7 +808,7 @@ const statuses = {
|
|||
reactWithEmoji({
|
||||
id,
|
||||
emoji,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => {
|
||||
dispatch('fetchEmojiReactionsBy', id)
|
||||
})
|
||||
|
|
@ -829,7 +829,7 @@ const statuses = {
|
|||
fetchEmojiReactionsBy({ rootState, commit }, id) {
|
||||
return fetchEmojiReactions({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((emojiReactions) => {
|
||||
commit('addEmojiReactionsBy', {
|
||||
id,
|
||||
|
|
@ -841,7 +841,7 @@ const statuses = {
|
|||
fetchFavs({ rootState, commit }, id) {
|
||||
fetchFavoritedByUsers({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((favoritedByUsers) =>
|
||||
commit('addFavs', {
|
||||
id,
|
||||
|
|
@ -853,7 +853,7 @@ const statuses = {
|
|||
fetchRepeats({ rootState, commit }, id) {
|
||||
fetchRebloggedByUsers({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((rebloggedByUsers) =>
|
||||
commit('addRepeats', {
|
||||
id,
|
||||
|
|
@ -870,7 +870,7 @@ const statuses = {
|
|||
offset,
|
||||
following,
|
||||
type,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((data) => {
|
||||
store.commit('addNewUsers', data.accounts)
|
||||
store.commit(
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import {
|
|||
} from '../services/window_utils/window_utils'
|
||||
|
||||
import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders.js'
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useEmojiStore } from 'src/stores/emoji.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
|
|
@ -133,7 +132,7 @@ const localMuteUser = (store, args) => {
|
|||
return muteUser({
|
||||
id,
|
||||
expiresIn,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((relationship) => {
|
||||
store.commit('updateUserRelationship', [relationship])
|
||||
store.commit('addMuteId', id)
|
||||
|
|
@ -154,7 +153,7 @@ const hideReblogs = (store, userId) => {
|
|||
return followUser({
|
||||
id: userId,
|
||||
reblogs: false,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((relationship) => {
|
||||
store.commit('updateUserRelationship', [relationship])
|
||||
})
|
||||
|
|
@ -164,7 +163,7 @@ const showReblogs = (store, userId) => {
|
|||
return followUser({
|
||||
id: userId,
|
||||
reblogs: true,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((relationship) =>
|
||||
store.commit('updateUserRelationship', [relationship]),
|
||||
)
|
||||
|
|
@ -173,14 +172,14 @@ const showReblogs = (store, userId) => {
|
|||
const muteDomain = (store, domain) => {
|
||||
return muteDomain({
|
||||
domain,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => store.commit('addDomainMute', domain))
|
||||
}
|
||||
|
||||
const unmuteDomain = (store, domain) => {
|
||||
return unmuteDomain({
|
||||
domain,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => store.commit('removeDomainMute', domain))
|
||||
}
|
||||
|
||||
|
|
@ -404,7 +403,7 @@ const users = {
|
|||
fetchUser(store, id) {
|
||||
return fetchUser({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((user) => {
|
||||
store.commit('addNewUsers', [user])
|
||||
return user
|
||||
|
|
@ -413,7 +412,7 @@ const users = {
|
|||
fetchUserByName(store, name) {
|
||||
return fetchUserByName({
|
||||
name,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((user) => {
|
||||
store.commit('addNewUsers', [user])
|
||||
return user
|
||||
|
|
@ -423,7 +422,7 @@ const users = {
|
|||
if (store.state.currentUser) {
|
||||
fetchUserRelationship({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((relationships) =>
|
||||
store.commit('updateUserRelationship', relationships),
|
||||
)
|
||||
|
|
@ -433,7 +432,7 @@ const users = {
|
|||
if (store.state.currentUser) {
|
||||
fetchUserInLists({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((inLists) => store.commit('updateUserInLists', { id, inLists }))
|
||||
}
|
||||
},
|
||||
|
|
@ -443,7 +442,7 @@ const users = {
|
|||
const maxId = store.state.currentUser.blockIdsMaxId
|
||||
return fetchBlocks({
|
||||
maxId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((blocks) => {
|
||||
if (reset) {
|
||||
store.commit('saveBlockIds', map(blocks, 'id'))
|
||||
|
|
@ -481,7 +480,7 @@ const users = {
|
|||
const maxId = store.state.currentUser.muteIdsMaxId
|
||||
return fetchMutes({
|
||||
maxId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((mutes) => {
|
||||
if (reset) {
|
||||
store.commit('saveMuteIds', map(mutes, 'id'))
|
||||
|
|
@ -515,7 +514,7 @@ const users = {
|
|||
},
|
||||
fetchDomainMutes(store) {
|
||||
return fetchDomainMutes({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((domainMutes) => {
|
||||
store.commit('saveDomainMutes', domainMutes)
|
||||
return domainMutes
|
||||
|
|
@ -539,7 +538,7 @@ const users = {
|
|||
return fetchFriends({
|
||||
id,
|
||||
maxId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((friends) => {
|
||||
commit('addNewUsers', friends)
|
||||
commit('saveFriendIds', { id, friendIds: map(friends, 'id') })
|
||||
|
|
@ -552,7 +551,7 @@ const users = {
|
|||
return fetchFollowers({
|
||||
id,
|
||||
maxId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((followers) => {
|
||||
commit('addNewUsers', followers)
|
||||
commit('saveFollowerIds', { id, followerIds: map(followers, 'id') })
|
||||
|
|
@ -569,7 +568,7 @@ const users = {
|
|||
return followUser({
|
||||
id,
|
||||
notify: true,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((relationship) =>
|
||||
commit('updateUserRelationship', [relationship]),
|
||||
)
|
||||
|
|
@ -578,7 +577,7 @@ const users = {
|
|||
return followUser({
|
||||
id,
|
||||
notify: false,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((relationship) =>
|
||||
commit('updateUserRelationship', [relationship]),
|
||||
)
|
||||
|
|
@ -644,7 +643,7 @@ const users = {
|
|||
searchUsers({ rootState, commit }, { query }) {
|
||||
return searchUsers({
|
||||
query,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((users) => {
|
||||
commit('addNewUsers', users)
|
||||
return users
|
||||
|
|
@ -679,7 +678,7 @@ const users = {
|
|||
},
|
||||
getCaptcha(store) {
|
||||
return getCaptcha({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
|
||||
|
|
@ -704,7 +703,6 @@ const users = {
|
|||
store.dispatch('disconnectFromSocket')
|
||||
oauth.clearToken()
|
||||
store.dispatch('stopFetchingTimeline', 'friends')
|
||||
useCredentialsStore().setCredentials(null)
|
||||
store.dispatch('stopFetchingNotifications')
|
||||
useListsStore().stopFetching()
|
||||
useBookmarkFoldersStore().stopFetching()
|
||||
|
|
@ -721,9 +719,11 @@ const users = {
|
|||
return new Promise((resolve, reject) => {
|
||||
const commit = store.commit
|
||||
const dispatch = store.dispatch
|
||||
|
||||
commit('beginLogin')
|
||||
|
||||
verifyCredentials({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then((data) => {
|
||||
if (!data.error) {
|
||||
|
|
@ -753,9 +753,6 @@ const users = {
|
|||
useInterfaceStore().setNotificationPermission(permission),
|
||||
)
|
||||
|
||||
// Update credentials
|
||||
useCredentialsStore().setCredentials(accessToken)
|
||||
|
||||
// Do server-side storage migrations
|
||||
|
||||
// Debug snippet to clean up storage and reset migrations
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ const REPORTS = '/api/v1/pleroma/admin/reports'
|
|||
const CONFIG_URL = '/api/v1/pleroma/admin/config'
|
||||
const DESCRIPTIONS_URL = '/api/v1/pleroma/admin/config/descriptions'
|
||||
|
||||
const ANNOUNCEMENTS_URL = (id = '') => `/api/v1/pleroma/admin/announcements/${id}`
|
||||
const ANNOUNCEMENTS_URL = (id = '') =>
|
||||
`/api/v1/pleroma/admin/announcements/${id}`
|
||||
|
||||
const FRONTENDS_URL = '/api/v1/pleroma/admin/frontends'
|
||||
const FRONTENDS_INSTALL_URL = '/api/v1/pleroma/admin/frontends/install'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
fetchUserRelationship,
|
||||
|
|
@ -11,7 +11,7 @@ const fetchRelationship = (attempt, userId, store) =>
|
|||
setTimeout(() => {
|
||||
fetchUserRelationship({
|
||||
id: userId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then((relationship) => {
|
||||
store.commit('updateUserRelationship', [relationship])
|
||||
|
|
@ -39,7 +39,7 @@ export const requestFollow = (userId, store) =>
|
|||
new Promise((resolve) => {
|
||||
followUser({
|
||||
id: userId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((updated) => {
|
||||
store.commit('updateUserRelationship', [updated])
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ export const requestUnfollow = (userId, store) =>
|
|||
new Promise((resolve) => {
|
||||
unfollowUser({
|
||||
id: userId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((updated) => {
|
||||
store.commit('updateUserRelationship', [updated])
|
||||
resolve({
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@
|
|||
|
||||
const wait = (timeout) => {
|
||||
let timeoutId
|
||||
const promise = () => new Promise((resolve) => {
|
||||
timeoutId = window.setTimeout(() => resolve(), timeout)
|
||||
})
|
||||
const promise = () =>
|
||||
new Promise((resolve) => {
|
||||
timeoutId = window.setTimeout(() => resolve(), timeout)
|
||||
})
|
||||
return { timeoutId, promise }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { cloneDeep, differenceWith, flatten, get, isEqual, set } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
addNewEmojiFile,
|
||||
|
|
@ -86,7 +86,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
|
||||
loadAdminStuff() {
|
||||
getInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((backendDbConfig) => {
|
||||
if (backendDbConfig.error) {
|
||||
if (backendDbConfig.error.status === 400) {
|
||||
|
|
@ -98,17 +98,17 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
}
|
||||
} else {
|
||||
this.setInstanceAdminSettings({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
backendDbConfig,
|
||||
})
|
||||
}
|
||||
})
|
||||
if (this.descriptions === null) {
|
||||
getInstanceConfigDescriptions({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((backendDescriptions) =>
|
||||
this.setInstanceAdminDescriptions({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
backendDescriptions,
|
||||
}),
|
||||
)
|
||||
|
|
@ -243,19 +243,19 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
})
|
||||
|
||||
pushInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
payload: {
|
||||
configs: changed,
|
||||
},
|
||||
})
|
||||
.then(() =>
|
||||
getInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}),
|
||||
)
|
||||
.then((backendDbConfig) =>
|
||||
this.setInstanceAdminSettings({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
|
||||
backendDbConfig,
|
||||
}),
|
||||
|
|
@ -280,7 +280,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
}
|
||||
|
||||
pushInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
payload: {
|
||||
configs: [
|
||||
{
|
||||
|
|
@ -293,12 +293,12 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
})
|
||||
.then(() =>
|
||||
getInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}),
|
||||
)
|
||||
.then((backendDbConfig) =>
|
||||
this.setInstanceAdminSettings({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
backendDbConfig,
|
||||
}),
|
||||
)
|
||||
|
|
@ -311,7 +311,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
this.modifiedPaths.delete(path)
|
||||
|
||||
return pushInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
payload: {
|
||||
configs: [
|
||||
{
|
||||
|
|
@ -325,7 +325,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
})
|
||||
.then(() =>
|
||||
getInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}),
|
||||
)
|
||||
.then((backendDbConfig) =>
|
||||
|
|
@ -336,7 +336,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
// Frontends Stuff
|
||||
loadFrontendsStuff() {
|
||||
getAvailableFrontends({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((frontends) => this.setAvailableFrontends({ frontends }))
|
||||
},
|
||||
|
||||
|
|
@ -354,14 +354,14 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
|
||||
installFrontend() {
|
||||
return installFrontend({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
|
||||
// Statuses stuff
|
||||
async fetchStatuses(opts) {
|
||||
const { total, activities } = await listStatuses({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
opts,
|
||||
})
|
||||
|
||||
|
|
@ -376,7 +376,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
},
|
||||
async changeStatusScope(opts) {
|
||||
const raw = await changeStatusScope({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
opts,
|
||||
})
|
||||
const status = parseStatus(raw)
|
||||
|
|
@ -387,7 +387,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
// Users stuff
|
||||
async fetchUsers(opts) {
|
||||
const { users, count } = await listUsers({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
|
||||
opts,
|
||||
})
|
||||
|
|
@ -409,7 +409,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const { screen_name } = user
|
||||
|
||||
const result = await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_name,
|
||||
})
|
||||
window.vuex.commit('updateUserAdminData', { user: result })
|
||||
|
|
@ -419,7 +419,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = deleteAccounts
|
||||
|
||||
const resultUserIds = await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
})
|
||||
|
||||
|
|
@ -437,7 +437,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const screen_names = users.map((u) => u.screen_name)
|
||||
|
||||
return resendConfirmationEmail({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
})
|
||||
},
|
||||
|
|
@ -445,7 +445,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const screen_names = users.map((u) => u.screen_name)
|
||||
|
||||
return requirePasswordChange({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
})
|
||||
},
|
||||
|
|
@ -454,7 +454,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const { screen_name } = user
|
||||
|
||||
return disableMFA({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_name,
|
||||
})
|
||||
},
|
||||
|
|
@ -463,7 +463,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = setUsersTags
|
||||
|
||||
await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
tags,
|
||||
value,
|
||||
|
|
@ -478,7 +478,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = setUsersRight
|
||||
|
||||
await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
right,
|
||||
value,
|
||||
|
|
@ -493,7 +493,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = setUsersActivationStatus
|
||||
|
||||
const resultUsers = await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
value,
|
||||
})
|
||||
|
|
@ -507,7 +507,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = setUsersSuggestionStatus
|
||||
|
||||
const resultUsers = await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
value,
|
||||
})
|
||||
|
|
@ -521,7 +521,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = setUsersConfirmationStatus
|
||||
|
||||
await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
})
|
||||
|
||||
|
|
@ -534,7 +534,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = setUsersApprovalStatus
|
||||
|
||||
const resultUsers = await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
})
|
||||
|
||||
|
|
@ -543,21 +543,21 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
})
|
||||
},
|
||||
reloadEmoji() {
|
||||
return reloadEmoji({ credentials: useCredentialsStore().current })
|
||||
return reloadEmoji({ credentials: useOAuthStore().token })
|
||||
},
|
||||
importEmojiFromFS() {
|
||||
return importEmojiFromFS({ credentials: useCredentialsStore().current })
|
||||
return importEmojiFromFS({ credentials: useOAuthStore().token })
|
||||
},
|
||||
listEmojiPacks(params) {
|
||||
return listEmojiPacks({
|
||||
...params,
|
||||
credentials: useCredentialsStore().current
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
listRemoteEmojiPacks(params) {
|
||||
return listRemoteEmojiPacks({
|
||||
...params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
addNewEmojiFile({ packName, file, shortcode, filename }) {
|
||||
|
|
@ -566,7 +566,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
file,
|
||||
shortcode,
|
||||
filename,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
downloadRemoteEmojiPack({ instance, packName, as }) {
|
||||
|
|
@ -574,33 +574,33 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
instance,
|
||||
packName,
|
||||
as,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
downloadRemoteEmojiPackZIP({ url, packName }) {
|
||||
return downloadRemoteEmojiPackZIP({
|
||||
url,
|
||||
packName,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
createEmojiPack({ name }) {
|
||||
return createEmojiPack({
|
||||
name,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
deleteEmojiPack({ name }) {
|
||||
return createEmojiPack({
|
||||
name,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
saveEmojiPackMetadata({ name, newData }) {
|
||||
return createEmojiPack({
|
||||
name,
|
||||
newData,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
getAnnouncements as adminGetAnnouncements,
|
||||
|
|
@ -47,15 +47,15 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
const fetchAnnouncements = async () => {
|
||||
if (!isAdmin) {
|
||||
return getAnnouncements({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
}
|
||||
|
||||
const all = await adminGetAnnouncements({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
const visible = await getAnnouncements({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
const visibleObject = visible.reduce((a, c) => {
|
||||
a[c.id] = c
|
||||
|
|
@ -93,7 +93,7 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
markAnnouncementAsRead(id) {
|
||||
return dismissAnnouncement({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => {
|
||||
const index = this.announcements.findIndex((a) => a.id === id)
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
},
|
||||
postAnnouncement({ content, startsAt, endsAt, allDay }) {
|
||||
return postAnnouncement({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
content,
|
||||
startsAt,
|
||||
endsAt,
|
||||
|
|
@ -140,7 +140,7 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
startsAt,
|
||||
endsAt,
|
||||
allDay,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => {
|
||||
return this.fetchAnnouncements()
|
||||
})
|
||||
|
|
@ -148,7 +148,7 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
deleteAnnouncement(id) {
|
||||
return deleteAnnouncement({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => {
|
||||
return this.fetchAnnouncements()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { find, remove } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
createBookmarkFolder,
|
||||
|
|
@ -29,7 +29,7 @@ export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
|||
startFetching() {
|
||||
promiseInterval(() => {
|
||||
this.fetcher = fetchBookmarkFolders({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then(
|
||||
(folders) => this.setBookmarkFolders(folders),
|
||||
|
|
@ -60,7 +60,7 @@ export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
|||
return createBookmarkFolder({
|
||||
name,
|
||||
emoji,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((folder) => {
|
||||
this.setBookmarkFolder(folder)
|
||||
return folder
|
||||
|
|
@ -68,7 +68,7 @@ export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
|||
},
|
||||
updateBookmarkFolder({ folderId, name, emoji }) {
|
||||
return updateBookmarkFolder({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
folderId,
|
||||
name,
|
||||
emoji,
|
||||
|
|
@ -80,7 +80,7 @@ export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
|||
deleteBookmarkFolder({ folderId }) {
|
||||
deleteBookmarkFolder({
|
||||
folderId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
remove(this.allFolders, (folder) => folder.id === folderId)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
const defaultState = {
|
||||
credentials: null,
|
||||
}
|
||||
|
||||
export const useCredentialsStore = defineStore('credentials', {
|
||||
state: () => ({ ...defaultState }),
|
||||
actions: {
|
||||
setCredentials(credentials) {
|
||||
this.credentials = credentials
|
||||
},
|
||||
},
|
||||
getters: {
|
||||
current() {
|
||||
return this.credentials
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { merge } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { ensureFinalFallback } from 'src/i18n/languages.js'
|
||||
import { listEmojiPacks } from 'src/services/api/api.service.js'
|
||||
|
|
@ -188,9 +188,10 @@ export const useEmojiStore = defineStore('emoji', {
|
|||
this.adminPacksLocalLoading = true
|
||||
this.adminPacksLocal = await this.getAdminPacks(
|
||||
useInstanceStore().server,
|
||||
(params) => listEmojiPacks({
|
||||
(params) =>
|
||||
listEmojiPacks({
|
||||
...params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}),
|
||||
)
|
||||
this.adminPacksLocalLoading = false
|
||||
|
|
@ -221,14 +222,13 @@ export const useEmojiStore = defineStore('emoji', {
|
|||
instance,
|
||||
page: i,
|
||||
pageSize,
|
||||
})
|
||||
.then((pageData) => {
|
||||
if (pageData.error !== undefined) {
|
||||
return Promise.reject(pageData.error)
|
||||
}
|
||||
}).then((pageData) => {
|
||||
if (pageData.error !== undefined) {
|
||||
return Promise.reject(pageData.error)
|
||||
}
|
||||
|
||||
return pageData.packs
|
||||
}),
|
||||
return pageData.packs
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { find, remove } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
addAccountsToList,
|
||||
|
|
@ -36,7 +36,7 @@ export const useListsStore = defineStore('lists', {
|
|||
startFetching() {
|
||||
promiseInterval(() => {
|
||||
this.fetcher = fetchLists({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then(
|
||||
(lists) => this.setLists(lists),
|
||||
|
|
@ -56,7 +56,7 @@ export const useListsStore = defineStore('lists', {
|
|||
createList({ title }) {
|
||||
return createList({
|
||||
title,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((list) => {
|
||||
this.setList({ listId: list.id, title })
|
||||
return list
|
||||
|
|
@ -65,13 +65,13 @@ export const useListsStore = defineStore('lists', {
|
|||
fetchList({ listId }) {
|
||||
return getList({
|
||||
listId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((list) => this.setList({ listId: list.id, title: list.title }))
|
||||
},
|
||||
fetchListAccounts({ listId }) {
|
||||
return getListAccounts({
|
||||
listId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((accountIds) => {
|
||||
if (!this.allListsObject[listId]) {
|
||||
this.allListsObject[listId] = { accountIds: [] }
|
||||
|
|
@ -83,7 +83,7 @@ export const useListsStore = defineStore('lists', {
|
|||
updateList({
|
||||
listId,
|
||||
title,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
|
||||
if (!this.allListsObject[listId]) {
|
||||
|
|
@ -110,14 +110,14 @@ export const useListsStore = defineStore('lists', {
|
|||
addAccountsToList({
|
||||
listId,
|
||||
accountIds: added,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
}
|
||||
if (removed.length > 0) {
|
||||
removeAccountsFromList({
|
||||
listId,
|
||||
accountIds: removed,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
@ -125,7 +125,7 @@ export const useListsStore = defineStore('lists', {
|
|||
return addAccountsToList({
|
||||
listId,
|
||||
accountIds: [accountId],
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((result) => {
|
||||
if (!this.allListsObject[listId]) {
|
||||
this.allListsObject[listId] = { accountIds: [] }
|
||||
|
|
@ -138,7 +138,7 @@ export const useListsStore = defineStore('lists', {
|
|||
return removeAccountsFromList({
|
||||
listId,
|
||||
accountIds: [accountId],
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((result) => {
|
||||
if (!this.allListsObject[listId]) {
|
||||
this.allListsObject[listId] = { accountIds: [] }
|
||||
|
|
@ -154,7 +154,7 @@ export const useListsStore = defineStore('lists', {
|
|||
deleteList({ listId }) {
|
||||
deleteList({
|
||||
listId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
|
||||
delete this.allListsObject[listId]
|
||||
|
|
|
|||
|
|
@ -41,12 +41,9 @@ export const useOAuthStore = defineStore('oauth', {
|
|||
userToken: false,
|
||||
}),
|
||||
getters: {
|
||||
getToken() {
|
||||
token() {
|
||||
return this.userToken || this.appToken
|
||||
},
|
||||
getUserToken() {
|
||||
return this.userToken
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
setClientData({ clientId, clientSecret }) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
fetchOAuthTokens,
|
||||
|
|
@ -14,7 +14,7 @@ export const useOAuthTokensStore = defineStore('oauthTokens', {
|
|||
actions: {
|
||||
fetchTokens() {
|
||||
fetchOAuthTokens({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((tokens) => {
|
||||
this.swapTokens(tokens)
|
||||
})
|
||||
|
|
@ -22,7 +22,7 @@ export const useOAuthTokensStore = defineStore('oauthTokens', {
|
|||
revokeToken(id) {
|
||||
revokeOAuthToken({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((response) => {
|
||||
if (response.status === 201) {
|
||||
this.swapTokens(this.tokens.filter((token) => token.id !== id))
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { merge } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { fetchPoll, vote } from 'src/services/api/api.service.js'
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ export const usePollsStore = defineStore('polls', {
|
|||
updateTrackedPoll(pollId) {
|
||||
fetchPoll({
|
||||
pollId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((poll) => {
|
||||
setTimeout(() => {
|
||||
if (this.trackedPolls[pollId]) {
|
||||
|
|
@ -58,7 +58,7 @@ export const usePollsStore = defineStore('polls', {
|
|||
return vote({
|
||||
pollId,
|
||||
choices,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((poll) => {
|
||||
this.mergeOrAddPoll(poll)
|
||||
return poll
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { filter } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { setReportState } from 'src/services/api/admin.js'
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ export const useReportsStore = defineStore('reports', {
|
|||
setReportState({
|
||||
id,
|
||||
state,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).catch((e) => {
|
||||
console.error('Failed to set report state', e)
|
||||
useInterfaceStore().pushGlobalNotice({
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ import { toRaw } from 'vue'
|
|||
|
||||
import { CURRENT_UPDATE_COUNTER } from 'src/components/update_notification/update_notification.js'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { storage } from 'src/lib/storage.js'
|
||||
import {
|
||||
|
|
@ -793,7 +793,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
|||
const params = { pleroma_settings_store: { 'pleroma-fe': this.cache } }
|
||||
updateProfileJSON({
|
||||
params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
import { defineStore } from 'pinia'
|
||||
import { toRaw } from 'vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { storage } from 'src/lib/storage.js'
|
||||
import { updateProfileJSON } from 'src/services/api/api.service.js'
|
||||
|
|
@ -349,7 +349,7 @@ export const useUserHighlightStore = defineStore('user_highlight', {
|
|||
}
|
||||
updateProfileJSON({
|
||||
params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((user) => {
|
||||
this.initUserHighlight(user)
|
||||
this.dirty = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue