@@ -18,7 +18,6 @@ import {
18
18
clipboard
19
19
} from 'electron'
20
20
import fs from 'fs'
21
- import crypto from 'crypto'
22
21
import log from 'electron-log'
23
22
import windowStateKeeper from 'electron-window-state'
24
23
import simplayer from 'simplayer'
@@ -385,7 +384,7 @@ async function createWindow() {
385
384
const args = minimist ( process . argv . slice ( process . env . NODE_ENV === 'development' ? 2 : 1 ) )
386
385
if ( args . help ) {
387
386
console . log ( `
388
- Whalebird is Mastodon, Pleroma and Misskey client for desktop.
387
+ Whalebird is a Fediverse client for desktop.
389
388
390
389
Usage
391
390
$ whalebird
@@ -446,6 +445,9 @@ ipcMain.handle('add-server', async (_: IpcMainInvokeEvent, domain: string) => {
446
445
if ( sns === 'friendica' ) {
447
446
return new Promise ( ( _resolve , reject ) => reject ( 'friendica is not supported yet' ) )
448
447
}
448
+ if ( sns === 'misskey' ) {
449
+ return new Promise ( ( _resolve , reject ) => reject ( 'misskey is not supported yet' ) )
450
+ }
449
451
const server = await insertServer ( db , `https://${ domain } ` , domain , sns , null )
450
452
return server
451
453
} )
@@ -477,13 +479,6 @@ ipcMain.handle('authorize', async (_: IpcMainInvokeEvent, req: AuthorizeRequest)
477
479
const client = generator ( sns , req . baseURL , null , 'Whalebird' , proxy )
478
480
const tokenData = await client . fetchAccessToken ( req . clientID , req . clientSecret , req . code , 'urn:ietf:wg:oauth:2.0:oob' )
479
481
let accessToken = tokenData . access_token
480
- if ( sns === 'misskey' ) {
481
- // In misskey, access token is sha256(userToken + clientSecret)
482
- accessToken = crypto
483
- . createHash ( 'sha256' )
484
- . update ( tokenData . access_token + req . clientSecret , 'utf8' )
485
- . digest ( 'hex' )
486
- }
487
482
488
483
const authorizedClient = generator ( sns , req . baseURL , accessToken , 'Whalebird' , proxy )
489
484
const credentials = await authorizedClient . verifyAccountCredentials ( )
@@ -792,16 +787,22 @@ ipcMain.handle('list-fonts', async (_: IpcMainInvokeEvent) => {
792
787
} )
793
788
794
789
// Settings
795
- ipcMain . handle ( 'get-account-setting' , async ( _ : IpcMainInvokeEvent , accountId : number ) : Promise < Setting > => {
796
- const setting = await getSetting ( db , accountId )
797
- return setting
798
- } )
799
-
800
- ipcMain . handle ( 'update-account-setting' , async ( _ : IpcMainInvokeEvent , setting : Setting ) : Promise < Setting > => {
801
- console . log ( setting )
802
- const res = await createOrUpdateSetting ( db , setting )
803
- return res
804
- } )
790
+ ipcMain . handle (
791
+ 'get-account-setting' ,
792
+ async ( _ : IpcMainInvokeEvent , accountId : number ) : Promise < Setting > => {
793
+ const setting = await getSetting ( db , accountId )
794
+ return setting
795
+ }
796
+ )
797
+
798
+ ipcMain . handle (
799
+ 'update-account-setting' ,
800
+ async ( _ : IpcMainInvokeEvent , setting : Setting ) : Promise < Setting > => {
801
+ console . log ( setting )
802
+ const res = await createOrUpdateSetting ( db , setting )
803
+ return res
804
+ }
805
+ )
805
806
806
807
// Cache
807
808
ipcMain . handle ( 'get-cache-hashtags' , async ( _ : IpcMainInvokeEvent ) => {
0 commit comments