1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2024-12-24 16:01:20 +01:00

Merge pull request #4558 from h3poteto/remove/misskey

Drop Misskey support
This commit is contained in:
AkiraFukushima 2023-09-29 23:03:48 +09:00 committed by GitHub
commit 7a547b4724
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 35 additions and 42 deletions

View File

@ -1,4 +1,4 @@
# Whalebird
https://github.com/h3poteto/megalodon/pull/1920# Whalebird
[![Build](https://github.com/h3poteto/whalebird-desktop/actions/workflows/build.yml/badge.svg)](https://github.com/h3poteto/whalebird-desktop/actions/workflows/build.yml)
[![GitHub release](http://img.shields.io/github/release/h3poteto/whalebird-desktop.svg)](https://github.com/h3poteto/whalebird-desktop/releases)
[![Mac App Store](https://img.shields.io/itunes/v/6445864587)](https://apps.apple.com/us/app/whalebird/id6445864587)
@ -21,7 +21,6 @@ Whalebird is a Fediverse client app for desktop.
- Supporting
- Mastodon
- Pleroma
- Misskey
### Shortcuts

View File

@ -41,6 +41,9 @@ marker_home BOOLEAN NOT NULL DEFAULT false, \
marker_notifications BOOLEAN NOT NULL DEFAULT true, \
FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE)'
).run()
db.prepare(
"DELETE FROM accounts WHERE id IN (SELECT accounts.id FROM accounts INNER JOIN servers ON servers.account_id = accounts.id WHERE servers.sns = 'misskey')"
).run()
return db
}

View File

@ -5,7 +5,7 @@ export const insertServer = (
db: Database,
baseURL: string,
domain: string,
sns: 'mastodon' | 'pleroma' | 'misskey',
sns: 'mastodon' | 'pleroma',
accountId: number | null
): Promise<LocalServer> => {
return new Promise((resolve, reject) => {

View File

@ -18,7 +18,6 @@ import {
clipboard
} from 'electron'
import fs from 'fs'
import crypto from 'crypto'
import log from 'electron-log'
import windowStateKeeper from 'electron-window-state'
import simplayer from 'simplayer'
@ -385,7 +384,7 @@ async function createWindow() {
const args = minimist(process.argv.slice(process.env.NODE_ENV === 'development' ? 2 : 1))
if (args.help) {
console.log(`
Whalebird is Mastodon, Pleroma and Misskey client for desktop.
Whalebird is a Fediverse client for desktop.
Usage
$ whalebird
@ -446,6 +445,9 @@ ipcMain.handle('add-server', async (_: IpcMainInvokeEvent, domain: string) => {
if (sns === 'friendica') {
return new Promise((_resolve, reject) => reject('friendica is not supported yet'))
}
if (sns === 'misskey') {
return new Promise((_resolve, reject) => reject('misskey is not supported yet'))
}
const server = await insertServer(db, `https://${domain}`, domain, sns, null)
return server
})
@ -477,13 +479,6 @@ ipcMain.handle('authorize', async (_: IpcMainInvokeEvent, req: AuthorizeRequest)
const client = generator(sns, req.baseURL, null, 'Whalebird', proxy)
const tokenData = await client.fetchAccessToken(req.clientID, req.clientSecret, req.code, 'urn:ietf:wg:oauth:2.0:oob')
let accessToken = tokenData.access_token
if (sns === 'misskey') {
// In misskey, access token is sha256(userToken + clientSecret)
accessToken = crypto
.createHash('sha256')
.update(tokenData.access_token + req.clientSecret, 'utf8')
.digest('hex')
}
const authorizedClient = generator(sns, req.baseURL, accessToken, 'Whalebird', proxy)
const credentials = await authorizedClient.verifyAccountCredentials()
@ -792,16 +787,22 @@ ipcMain.handle('list-fonts', async (_: IpcMainInvokeEvent) => {
})
// Settings
ipcMain.handle('get-account-setting', async (_: IpcMainInvokeEvent, accountId: number): Promise<Setting> => {
const setting = await getSetting(db, accountId)
return setting
})
ipcMain.handle(
'get-account-setting',
async (_: IpcMainInvokeEvent, accountId: number): Promise<Setting> => {
const setting = await getSetting(db, accountId)
return setting
}
)
ipcMain.handle('update-account-setting', async (_: IpcMainInvokeEvent, setting: Setting): Promise<Setting> => {
console.log(setting)
const res = await createOrUpdateSetting(db, setting)
return res
})
ipcMain.handle(
'update-account-setting',
async (_: IpcMainInvokeEvent, setting: Setting): Promise<Setting> => {
console.log(setting)
const res = await createOrUpdateSetting(db, setting)
return res
}
)
// Cache
ipcMain.handle('get-cache-hashtags', async (_: IpcMainInvokeEvent) => {

View File

@ -4,7 +4,7 @@ import { LocalAccount } from '~/src/types/localAccount'
import { LocalServer } from '~src/types/localServer'
const StreamingURL = async (
sns: 'mastodon' | 'pleroma' | 'misskey',
sns: 'mastodon' | 'pleroma',
account: LocalAccount,
server: LocalServer,
proxy: ProxyConfig | false
@ -26,7 +26,7 @@ class WebSocket {
public client: MegalodonInterface
public listener: WebSocketInterface | null
constructor(sns: 'mastodon' | 'pleroma' | 'misskey', account: LocalAccount, streamingURL: string, proxy: ProxyConfig | false) {
constructor(sns: 'mastodon' | 'pleroma', account: LocalAccount, streamingURL: string, proxy: ProxyConfig | false) {
const url = streamingURL.replace(/^https:\/\//, 'wss://')
this.client = generator(sns, url, account.accessToken, 'Whalebird', proxy)
this.listener = null

View File

@ -13,8 +13,7 @@
class="authorize-form"
@submit.prevent="authorizeSubmit"
>
<p v-if="$route.query.sns === 'misskey'">{{ $t('authorize.misskey_label') }}</p>
<el-form-item :label="$t('authorize.code_label')" v-else>
<el-form-item :label="$t('authorize.code_label')">
<el-input v-model="authorizeForm.code"></el-input>
</el-form-item>
<!-- Dummy form to guard submitting with enter -->
@ -65,10 +64,7 @@ export default defineComponent({
const authorizeSubmit = async () => {
submitting.value = true
let code = authorizeForm.code
if (route.query.sns === 'misskey' && route.query.session_token) {
code = route.query.session_token.toString()
}
const code = authorizeForm.code
try {
const localAccount: LocalAccount = await win.ipcRenderer.invoke('authorize', {
serverID: route.query.server_id,

View File

@ -60,7 +60,7 @@ export default defineComponent({
const domain = ref<string>('')
const searching = ref<boolean>(false)
const allowLogin = computed(() => domain.value && form.domainName == domain.value)
const sns = ref<'mastodon' | 'pleroma' | 'misskey'>('mastodon')
const sns = ref<'mastodon' | 'pleroma'>('mastodon')
const rules = reactive<FormRules>({
domainName: [
@ -120,6 +120,9 @@ export default defineComponent({
if (res === 'friendica') {
throw new Error('Friendica is not supported')
}
if (res === 'misskey') {
throw new Error('Misskey is not supported')
}
sns.value = res
domain.value = cleanDomain
ElMessage({

View File

@ -2,7 +2,7 @@
<div id="filters">
<h2>{{ $t('settings.filters.title') }}</h2>
<div class="new-filter">
<el-button type="primary" :disabled="sns === 'misskey'">
<el-button type="primary">
<router-link :to="`/${id}/settings/filters/new`">
{{ $t('settings.filters.new.title') }}
</router-link>

View File

@ -222,9 +222,6 @@ const actions: ActionTree<HomeState, RootState> = {
if (timeline.length === 0 || timeline[0].id === 'loading-card') {
return
}
if (req.server.sns === 'misskey') {
return
}
const client = generator(req.server.sns, req.server.baseURL, req.account.accessToken, rootState.App.userAgent)
const res = await client.saveMarkers({ home: { last_read_id: timeline[0].id } })
return res.data

View File

@ -215,9 +215,6 @@ const actions: ActionTree<NotificationsState, RootState> = {
return
}
if (req.server.sns === 'misskey') {
return
}
const client = generator(req.server.sns, req.server.baseURL, req.account.accessToken, rootState.App.userAgent)
const res = await client.saveMarkers({ notifications: { last_read_id: notifications[0].id } })
if (rootState.TimelineSpace.server!.sns === 'pleroma') {

View File

@ -1,9 +1,6 @@
import { QuoteSupportMastodon } from '~/src/constants/servers/quote'
const quoteSupported = (sns: 'mastodon' | 'pleroma' | 'misskey', domain: string): boolean => {
if (sns === 'misskey') {
return true
}
const quoteSupported = (_sns: 'mastodon' | 'pleroma', domain: string): boolean => {
if (QuoteSupportMastodon.includes(domain)) {
return true
}

View File

@ -2,6 +2,6 @@ export type LocalServer = {
id: number
baseURL: string
domain: string
sns: 'mastodon' | 'pleroma' | 'misskey'
sns: 'mastodon' | 'pleroma'
accountId: number | null
}