mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-21 19:53:50 +01:00
feat: lookup post action
This commit is contained in:
parent
fce8b16144
commit
53b21cd455
@ -963,6 +963,7 @@ indexNotice: "Now indexing. This will probably take a while, please don't restar
|
||||
customKaTeXMacro: "Custom KaTeX macros"
|
||||
customKaTeXMacroDescription: "Set up macros to write mathematical expressions easily! The notation conforms to the LaTeX command definitions and is written as \\newcommand{\\name}{content} or \\newcommand{\\name}[number of arguments]{content}. For example, \\newcommand{\\add}[2]{#1 + #2} will expand \\add{3}{foo} to 3 + foo. The curly brackets surrounding the macro name can be changed to round or square brackets. This affects the brackets used for arguments. One (and only one) macro can be defined per line, and you can't break the line in the middle of the definition. Invalid lines are simply ignored. Only simple string substitution functions are supported; advanced syntax, such as conditional branching, cannot be used here."
|
||||
enableCustomKaTeXMacro: "Enable custom KaTeX macros"
|
||||
noteId: "Post ID"
|
||||
|
||||
_sensitiveMediaDetection:
|
||||
description: "Reduces the effort of server moderation through automatically recognizing NSFW media via Machine Learning. This will slightly increase the load on the server."
|
||||
|
@ -359,6 +359,32 @@ const invite = () => {
|
||||
});
|
||||
};
|
||||
|
||||
async function lookupNote() {
|
||||
const { canceled, result: q } = await os.inputText({
|
||||
title: i18n.ts.noteId,
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
os.api(
|
||||
"notes/show",
|
||||
q.startsWith("http://") || q.startsWith("https://")
|
||||
? { url: q.trim() }
|
||||
: { noteId: q.trim() },
|
||||
)
|
||||
.then((note) => {
|
||||
os.pageWindow(`/notes/${note.id}`);
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.code === "NO_SUCH_NOTE") {
|
||||
os.alert({
|
||||
type: "error",
|
||||
text: i18n.ts.notFound,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const lookup = (ev) => {
|
||||
os.popupMenu(
|
||||
[
|
||||
@ -373,7 +399,7 @@ const lookup = (ev) => {
|
||||
text: i18n.ts.note,
|
||||
icon: "ph-pencil ph-bold ph-lg",
|
||||
action: () => {
|
||||
alert("TODO");
|
||||
lookupNote();
|
||||
},
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user