Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F1374850
index.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
index.ts
View Options
const
os
:
any
=
require
(
"os"
);
const
fs
:
any
=
require
(
"fs"
);
const
path
:
any
=
require
(
"path"
);
const
util
:
any
=
require
(
"util"
);
const
axios
:
any
=
require
(
"axios"
);
// User-defined options
const
API
:
string
=
"https://hub.sealcode.org/api/"
;
const
queryKey
:
string
=
"dTaNeNuwKB7l"
;
const
readFile
=
util
.
promisify
(
fs
.
readFile
);
const
writeFile
=
util
.
promisify
(
fs
.
writeFile
);
const
exec
=
util
.
promisify
(
require
(
"child_process"
).
exec
);
interface
Task
{
description
:
any
;
cmd
:
string
;
}
async
function
resolveAPIToken
()
:
Promise
<
string
>
{
let
config
=
await
readFile
(
path
.
resolve
(
os
.
homedir
(),
".arcrc"
));
config
=
JSON
.
parse
(
config
);
return
config
.
hosts
[
API
].
token
;
}
async
function
getData
()
:
Promise
<
Object
>
{
let
results
:
{
[
key
:
string
]
:
Task
}
=
{};
try
{
let
apiToken
=
await
resolveAPIToken
();
let
res
=
await
axios
.
get
(
API
+
"maniphest.search"
,
{
data
:
`api.token=
${
apiToken
}
&queryKey=
${
queryKey
}
`
,
});
res
.
data
.
result
.
data
.
forEach
((
item
:
any
)
=>
{
let
taskID
=
"T"
+
item
.
id
;
results
[
taskID
]
=
{
description
:
item
.
fields
.
name
,
cmd
:
`xdg-open https://hub.sealcode.org/
${
taskID
}
`
,
};
});
}
catch
(
err
)
{
throw
err
;
}
return
results
;
}
async
function
main
()
{
let
data
=
await
getData
();
try
{
await
writeFile
(
path
.
resolve
(
os
.
homedir
(),
".config/rofi-json-menu"
),
JSON
.
stringify
(
data
)
);
}
catch
(
err
)
{
throw
err
;
}
exec
(
"rofi -modi json-menu -show json-menu"
);
}
main
();
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Tue, Feb 25, 14:21 (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
610584
Default Alt Text
index.ts (1 KB)
Attached To
Mode
rROFI Roficator
Attached
Detach File
Event Timeline
Log In to Comment