Skip to content

Commit a0c6141

Browse files
committed
address comments from Obsidian review
1 parent 299334f commit a0c6141

5 files changed

Lines changed: 18 additions & 24 deletions

File tree

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44

55
An Obsidian plugin to publish posts to https://write.as.
66

7+
## Disclosure
8+
9+
1. This plugin publishes content using the Internet
10+
2. This plugin requires an account with https://write.as
11+
712
## How?
813

914
1. Set your username and password in the plugin settings
1015
2. Add `writeas_collection` into your frontmatter, set it to a collection/blog
11-
that you own
16+
that you own (this **must** be set)
1217
3. Run `Publish/update to writeas` (or use alt+shift+p)
18+
4. The plugin will add the ID and the post URL to your frontmatter. Subsequent publish commands will then update the same post.
1319

1420
## API Documentation
1521

16-
See https://developers.write.as/docs/api/#retrieve-a-post
22+
See https://developers.write.as/docs

main.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default class WriteasPlugin extends Plugin {
5050

5151
async handleFile(file: TFile) {
5252
let c = new WriteasClient(this.settings.writeasUser, this.settings.writeasPassword);
53-
this.app.vault.read(file).then(async lines => {
53+
this.app.vault.cachedRead(file).then(async lines => {
5454
var content = this.app.metadataCache.getFileCache(file);
5555
if (content?.frontmatter && content.frontmatter[COLL_KEY]) {
5656
let coll = content.frontmatter[COLL_KEY]
@@ -71,12 +71,14 @@ export default class WriteasPlugin extends Plugin {
7171
res = await c.updatePost(post_body, id)
7272
if (res === undefined) {
7373
new Notice("Failed to update post. Does it exist?")
74+
return;
7475
}
7576
c.getPost(id);
7677
} else {
7778
res = await c.publishPost(post_body, content.frontmatter[COLL_KEY])
7879
if (res === undefined) {
7980
new Notice("Failed to publish, does the collection exist?")
81+
return;
8082
}
8183
const keys: Record<string, string> = { 'writeas_url': res['url'].replace('http', 'https'), '_writeas_id': res['id'] }
8284
this.updateFrontmatter(file, keys)
@@ -101,22 +103,6 @@ export default class WriteasPlugin extends Plugin {
101103
}
102104
}
103105

104-
class SampleModal extends Modal {
105-
constructor(app: App) {
106-
super(app);
107-
}
108-
109-
onOpen() {
110-
const { contentEl } = this;
111-
contentEl.setText('Woah!');
112-
}
113-
114-
onClose() {
115-
const { contentEl } = this;
116-
contentEl.empty();
117-
}
118-
}
119-
120106
class SettingTab extends PluginSettingTab {
121107
plugin: WriteasPlugin;
122108

manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"id": "writeas-publisher",
3+
"version": "1.0.1",
34
"name": "Writeas Blog Publisher",
4-
"version": "1.0.0",
55
"minAppVersion": "0.15.0",
66
"description": "This is a plugin for Obsidian to publish a note to a collection on write.as. Set your username and password in settings. Set `writeas_collection` as your alias in your frontmatter and publish!",
77
"author": "encima",
88
"authorUrl": "https://github.com/encima/obsidian-writeas-plugin",
99
"isDesktopOnly": false
10-
}
10+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "writeas-publisher",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "This is a plugin for Obsidian to publish to a collection on write.as. Set your username and password in settings. Set `writeas_collection` as your alias in your frontmatter and publish!",
55
"main": "main.js",
66
"scripts": {
@@ -22,4 +22,4 @@
2222
"typescript": "4.7.4"
2323
},
2424
"dependencies": {}
25-
}
25+
}

versions.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"1.0.0": "0.15.0"
2+
"1.0.0": "0.15.0",
3+
"1.0.1": "0.15.0",
4+
"undefined": "0.15.0"
35
}

0 commit comments

Comments
 (0)