@@ -20,7 +20,9 @@ import { hostname, userInfo } from "os";
2020import PQueue from "p-queue" ;
2121import { basename , extname , resolve } from "path" ;
2222import { pathToFileURL } from "url" ;
23+
2324import { Watch , WatchV2 , toWatchlistV2 } from "../watch-list" ;
25+ import { getUploadOnceAvailable } from "./platform" ;
2426
2527( async ( ) => {
2628 if ( process . env . npm_lifecycle_event !== "start" ) {
@@ -99,6 +101,9 @@ import { Watch, WatchV2, toWatchlistV2 } from "../watch-list";
99101 } ,
100102 { role : "quit" } ,
101103 { type : "separator" } ,
104+ ...( getUploadOnceAvailable ( ) && gyazoAccessToken
105+ ? [ { label : "Upload" , click : uploadOnce } ]
106+ : [ ] ) ,
102107 ...( queueLength
103108 ? [
104109 {
@@ -165,6 +170,15 @@ import { Watch, WatchV2, toWatchlistV2 } from "../watch-list";
165170 } ) ;
166171 } ;
167172
173+ const uploadOnce = async ( ) => {
174+ const { filePaths } = await dialog . showOpenDialog ( {
175+ properties : [ "openFile" , "multiSelections" ] ,
176+ } ) ;
177+ for ( const filePath of filePaths ) {
178+ receive ( { path : filePath , opensNewTab : false , checksFileID : false } ) ;
179+ }
180+ } ;
181+
168182 const receive = async ( event : WatchV2 & { checksFileID : boolean } ) => {
169183 const ext = extname ( event . path ) ;
170184 switch ( ext ) {
0 commit comments