Refactoring about how proxy fetching happens
This commit is contained in:
@@ -33,11 +33,11 @@ export async function indexLinks({ name, tree }: IndexTreeEvent) {
|
||||
pageMeta[k] = v;
|
||||
}
|
||||
// Don't index meta data starting with $
|
||||
// for (const key in pageMeta) {
|
||||
// if (key.startsWith("$")) {
|
||||
// delete pageMeta[key];
|
||||
// }
|
||||
// }
|
||||
for (const key in pageMeta) {
|
||||
if (key.startsWith("$")) {
|
||||
delete pageMeta[key];
|
||||
}
|
||||
}
|
||||
// console.log("Extracted page meta data", pageMeta);
|
||||
await index.set(name, "meta:", pageMeta);
|
||||
}
|
||||
|
||||
@@ -357,6 +357,15 @@ function render(
|
||||
};
|
||||
}
|
||||
return null;
|
||||
case "Escape": {
|
||||
return {
|
||||
name: "span",
|
||||
attrs: {
|
||||
class: "escape",
|
||||
},
|
||||
body: t.children![0].text!.slice(1),
|
||||
};
|
||||
}
|
||||
// Text
|
||||
case undefined:
|
||||
return t.text!;
|
||||
|
||||
+3
-11
@@ -8,20 +8,15 @@ export async function publishCommand() {
|
||||
const text = await editor.getText();
|
||||
const pageName = await editor.getCurrentPage();
|
||||
const tree = await markdown.parseMarkdown(text);
|
||||
const { $share } = await extractFrontmatter(tree);
|
||||
let { $share } = await extractFrontmatter(tree);
|
||||
if (!$share) {
|
||||
await editor.flashNotification("Saved.");
|
||||
// Nothing to do here
|
||||
return;
|
||||
}
|
||||
if (!Array.isArray($share)) {
|
||||
await editor.flashNotification(
|
||||
"$share front matter must be an array.",
|
||||
"error",
|
||||
);
|
||||
return;
|
||||
$share = [$share];
|
||||
}
|
||||
await editor.flashNotification("Sharing...");
|
||||
// Delegate actual publishing to the server
|
||||
try {
|
||||
await publish(pageName, $share);
|
||||
await editor.flashNotification("Done!");
|
||||
@@ -31,9 +26,6 @@ export async function publishCommand() {
|
||||
}
|
||||
|
||||
async function publish(pageName: string, uris: string[]) {
|
||||
if (!Array.isArray(uris)) {
|
||||
uris = [uris];
|
||||
}
|
||||
for (const uri of uris) {
|
||||
const publisher = uri.split(":")[0];
|
||||
const results = await events.dispatchEvent(
|
||||
|
||||
Reference in New Issue
Block a user