mirror of
https://github.com/owainwilliams/umbPublisher.git
synced 2026-07-22 13:00:24 +00:00
Initial Commit
This commit is contained in:
commit
e7a2f1931c
42 changed files with 5095 additions and 0 deletions
10
.editorconfig
Normal file
10
.editorconfig
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
3
.eslintignore
Normal file
3
.eslintignore
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
node_modules/
|
||||
|
||||
main.js
|
||||
23
.eslintrc
Normal file
23
.eslintrc
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"env": { "node": true },
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"no-prototype-builtins": "off",
|
||||
"@typescript-eslint/no-empty-function": "off"
|
||||
}
|
||||
}
|
||||
22
.gitignore
vendored
Normal file
22
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# vscode
|
||||
.vscode
|
||||
|
||||
# Intellij
|
||||
*.iml
|
||||
.idea
|
||||
|
||||
# npm
|
||||
node_modules
|
||||
|
||||
# Don't include the compiled main.js file in the repo.
|
||||
# They should be uploaded to GitHub releases instead.
|
||||
main.js
|
||||
|
||||
# Exclude sourcemaps
|
||||
*.map
|
||||
|
||||
# obsidian
|
||||
data.json
|
||||
|
||||
# Exclude macOS Finder (System Explorer) View States
|
||||
.DS_Store
|
||||
0
.hotreload
Normal file
0
.hotreload
Normal file
1
.npmrc
Normal file
1
.npmrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
tag-version-prefix=""
|
||||
BIN
.vs/Umbracidian/CopilotIndices/17.12.53.23981/CodeChunks.db
Normal file
BIN
.vs/Umbracidian/CopilotIndices/17.12.53.23981/CodeChunks.db
Normal file
Binary file not shown.
BIN
.vs/Umbracidian/CopilotIndices/17.12.53.23981/SemanticSymbols.db
Normal file
BIN
.vs/Umbracidian/CopilotIndices/17.12.53.23981/SemanticSymbols.db
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1021
.vs/Umbracidian/config/applicationhost.config
Normal file
1021
.vs/Umbracidian/config/applicationhost.config
Normal file
File diff suppressed because it is too large
Load diff
Binary file not shown.
BIN
.vs/Umbracidian/v17/.wsuo
Normal file
BIN
.vs/Umbracidian/v17/.wsuo
Normal file
Binary file not shown.
193
.vs/Umbracidian/v17/DocumentLayout.backup.json
Normal file
193
.vs/Umbracidian/v17/DocumentLayout.backup.json
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\main.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:main.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\getPageContent.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:methods\\getPageContent.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\callUmbracoApi.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:methods\\callUmbracoApi.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\generateGuid.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:methods\\generateGuid.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\settings\\index.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:settings\\index.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\package.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:package.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\manifest.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:manifest.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 18,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:129:0:{13b12e3e-c1b4-4539-9371-4fe9a0d523fc}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:130:0:{13b12e3e-c1b4-4539-9371-4fe9a0d523fc}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:132:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:133:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:130:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:131:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:132:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:129:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:1:0:{fabf9319-47eb-497e-b8f6-d9f73fba5f55}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:2:0:{fabf9319-47eb-497e-b8f6-d9f73fba5f55}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{40ea2e6b-2121-4bb8-a43e-c83c04b51041}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "getPageContent.ts",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\getPageContent.ts",
|
||||
"RelativeDocumentMoniker": "methods\\getPageContent.ts",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\getPageContent.ts",
|
||||
"RelativeToolTip": "methods\\getPageContent.ts",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
||||
"WhenOpened": "2025-04-22T11:35:25.569Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 5,
|
||||
"Title": "package.json",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\package.json",
|
||||
"RelativeDocumentMoniker": "package.json",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\package.json",
|
||||
"RelativeToolTip": "package.json",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
|
||||
"WhenOpened": "2025-04-22T10:16:14.36Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 6,
|
||||
"Title": "manifest.json",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\manifest.json",
|
||||
"RelativeDocumentMoniker": "manifest.json",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\manifest.json",
|
||||
"RelativeToolTip": "manifest.json",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
|
||||
"WhenOpened": "2025-04-22T10:16:11.484Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "callUmbracoApi.ts",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\callUmbracoApi.ts",
|
||||
"RelativeDocumentMoniker": "methods\\callUmbracoApi.ts",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\callUmbracoApi.ts",
|
||||
"RelativeToolTip": "methods\\callUmbracoApi.ts",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAAbAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
||||
"WhenOpened": "2025-04-22T09:46:20.336Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"Title": "index.ts",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\settings\\index.ts",
|
||||
"RelativeDocumentMoniker": "settings\\index.ts",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\settings\\index.ts",
|
||||
"RelativeToolTip": "settings\\index.ts",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
||||
"WhenOpened": "2025-04-22T08:52:47.48Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "generateGuid.ts",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\generateGuid.ts",
|
||||
"RelativeDocumentMoniker": "methods\\generateGuid.ts",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\generateGuid.ts",
|
||||
"RelativeToolTip": "methods\\generateGuid.ts",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
||||
"WhenOpened": "2025-04-22T08:52:12.943Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "main.ts",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\main.ts",
|
||||
"RelativeDocumentMoniker": "main.ts",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\main.ts",
|
||||
"RelativeToolTip": "main.ts",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAABEAAAASAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
||||
"WhenOpened": "2025-04-21T19:30:30.866Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DockedWidth": 761,
|
||||
"SelectedChildIndex": -1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{004be353-6879-467c-9d1e-9ac23cdf6d49}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
231
.vs/Umbracidian/v17/DocumentLayout.json
Normal file
231
.vs/Umbracidian/v17/DocumentLayout.json
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\manifest.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:manifest.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\LICENSE||{8B382828-6202-11D1-8870-0000F87579D2}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:LICENSE||{8B382828-6202-11D1-8870-0000F87579D2}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\main.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:main.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\getPageContent.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:methods\\getPageContent.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\callUmbracoApi.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:methods\\callUmbracoApi.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\generateGuid.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:methods\\generateGuid.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\settings\\index.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:settings\\index.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\package.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}",
|
||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:package.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 16,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:129:0:{13b12e3e-c1b4-4539-9371-4fe9a0d523fc}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:130:0:{13b12e3e-c1b4-4539-9371-4fe9a0d523fc}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:132:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:133:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:130:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:131:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:132:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:129:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:1:0:{fabf9319-47eb-497e-b8f6-d9f73fba5f55}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:2:0:{fabf9319-47eb-497e-b8f6-d9f73fba5f55}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{40ea2e6b-2121-4bb8-a43e-c83c04b51041}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "LICENSE",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\LICENSE",
|
||||
"RelativeDocumentMoniker": "LICENSE",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\LICENSE",
|
||||
"RelativeToolTip": "LICENSE",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAABUAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
||||
"WhenOpened": "2025-04-22T12:27:22.444Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "README.md",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\README.md",
|
||||
"RelativeDocumentMoniker": "README.md",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\README.md",
|
||||
"RelativeToolTip": "README.md",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
|
||||
"WhenOpened": "2025-04-22T12:25:54.907Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"Title": "getPageContent.ts",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\getPageContent.ts",
|
||||
"RelativeDocumentMoniker": "methods\\getPageContent.ts",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\getPageContent.ts",
|
||||
"RelativeToolTip": "methods\\getPageContent.ts",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
||||
"WhenOpened": "2025-04-22T11:35:25.569Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 8,
|
||||
"Title": "package.json",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\package.json",
|
||||
"RelativeDocumentMoniker": "package.json",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\package.json",
|
||||
"RelativeToolTip": "package.json",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
|
||||
"WhenOpened": "2025-04-22T10:16:14.36Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "manifest.json",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\manifest.json",
|
||||
"RelativeDocumentMoniker": "manifest.json",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\manifest.json",
|
||||
"RelativeToolTip": "manifest.json",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
|
||||
"WhenOpened": "2025-04-22T10:16:11.484Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 5,
|
||||
"Title": "callUmbracoApi.ts",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\callUmbracoApi.ts",
|
||||
"RelativeDocumentMoniker": "methods\\callUmbracoApi.ts",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\callUmbracoApi.ts",
|
||||
"RelativeToolTip": "methods\\callUmbracoApi.ts",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAAbAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
||||
"WhenOpened": "2025-04-22T09:46:20.336Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 7,
|
||||
"Title": "index.ts",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\settings\\index.ts",
|
||||
"RelativeDocumentMoniker": "settings\\index.ts",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\settings\\index.ts",
|
||||
"RelativeToolTip": "settings\\index.ts",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
||||
"WhenOpened": "2025-04-22T08:52:47.48Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 6,
|
||||
"Title": "generateGuid.ts",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\generateGuid.ts",
|
||||
"RelativeDocumentMoniker": "methods\\generateGuid.ts",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\methods\\generateGuid.ts",
|
||||
"RelativeToolTip": "methods\\generateGuid.ts",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
||||
"WhenOpened": "2025-04-22T08:52:12.943Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "main.ts",
|
||||
"DocumentMoniker": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\main.ts",
|
||||
"RelativeDocumentMoniker": "main.ts",
|
||||
"ToolTip": "C:\\personal\\Obsidian\\Development\\Development\\.obsidian\\plugins\\Umbracidian\\main.ts",
|
||||
"RelativeToolTip": "main.ts",
|
||||
"ViewState": "AgIAAAcAAAAAAAAAAAAwwBEAAAASAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
||||
"WhenOpened": "2025-04-21T19:30:30.866Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DockedWidth": 761,
|
||||
"SelectedChildIndex": -1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{004be353-6879-467c-9d1e-9ac23cdf6d49}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
8
.vs/VSWorkspaceState.json
Normal file
8
.vs/VSWorkspaceState.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"ExpandedNodes": [
|
||||
"",
|
||||
"\\assets"
|
||||
],
|
||||
"SelectedNode": "\\manifest.json",
|
||||
"PreviewInSolutionExplorer": false
|
||||
}
|
||||
BIN
.vs/slnx.sqlite
Normal file
BIN
.vs/slnx.sqlite
Normal file
Binary file not shown.
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) [year] [fullname]
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
19
README.md
Normal file
19
README.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Umbracidian Plugin
|
||||
|
||||
This plugin allows you to push your Obsidian notes to Umbraco 15 as a blog post.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Within Umbraco, you need to create a new document type for your blog posts. This document type should have the following properties as a minimum:
|
||||
- Title (string)
|
||||
- BlogContent (MarkdownEditor)
|
||||
Make a note of the alias of the document type and also the alias of the properties. e.g. `obsidian`, `title`, `blogContent`.
|
||||
|
||||
<img src="./assets/doctype.png" alt="Document Type"></img>
|
||||
|
||||
Within Umbraco, you will need to create a new API user.
|
||||
|
||||
|
||||
|
||||
Within the Umbracidian settings tab, enter the URL of your Umbraco instance and the API key.
|
||||
BIN
assets/docType.png
Normal file
BIN
assets/docType.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
52
esbuild.config.mjs
Normal file
52
esbuild.config.mjs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import esbuild from "esbuild";
|
||||
import process from "process";
|
||||
import builtins from "builtin-modules";
|
||||
|
||||
const banner =
|
||||
`/*
|
||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||
if you want to view the source, please visit the github repository of this plugin
|
||||
*/
|
||||
`;
|
||||
|
||||
const prod = (process.argv[2] === "production");
|
||||
|
||||
const context = await esbuild.context({
|
||||
banner: {
|
||||
js: banner,
|
||||
},
|
||||
entryPoints: ["main.ts"],
|
||||
bundle: true,
|
||||
external: [
|
||||
"obsidian",
|
||||
"electron",
|
||||
"@codemirror/autocomplete",
|
||||
"@codemirror/collab",
|
||||
"@codemirror/commands",
|
||||
"@codemirror/language",
|
||||
"@codemirror/lint",
|
||||
"@codemirror/search",
|
||||
"@codemirror/state",
|
||||
"@codemirror/view",
|
||||
"@lezer/common",
|
||||
"@lezer/highlight",
|
||||
"@lezer/lr",
|
||||
"@types/node",
|
||||
"@types/node-fetch",
|
||||
...builtins],
|
||||
format: "cjs",
|
||||
target: "es2018",
|
||||
logLevel: "info",
|
||||
sourcemap: prod ? false : "inline",
|
||||
treeShaking: true,
|
||||
outfile: "main.js",
|
||||
minify: prod,
|
||||
loader:{".svg": "text"},
|
||||
});
|
||||
|
||||
if (prod) {
|
||||
await context.rebuild();
|
||||
process.exit(0);
|
||||
} else {
|
||||
await context.watch();
|
||||
}
|
||||
4
global.d.ts
vendored
Normal file
4
global.d.ts
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
declare module "*.svg" {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
13
icons/icons.ts
Normal file
13
icons/icons.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { addIcon } from "obsidian";
|
||||
|
||||
import umbracoLogo from "./img/umbracidian-logo.svg";
|
||||
|
||||
export class UmbracidianIcons {
|
||||
private icons = [{ iconId: "umbracidian-logo", svg: umbracoLogo }];
|
||||
|
||||
registerIcons = () => {
|
||||
this.icons.forEach(({ iconId, svg }) => {
|
||||
addIcon(iconId, svg);
|
||||
});
|
||||
};
|
||||
}
|
||||
9
icons/img/umbracidian-logo.svg
Normal file
9
icons/img/umbracidian-logo.svg
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 13 13" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;">
|
||||
<g transform="matrix(1,0,0,1,-0.169926,-0.169926)">
|
||||
<g transform="matrix(0.02,0,0,0.02,-1.3333,-1.3333)">
|
||||
<path d="M233.333,400L220.2,400C207.033,399.997 194.155,403.895 183.2,411.2L100,466.667L100,166.667C100,130.094 130.094,100 166.667,100L400,100C436.572,100 466.667,130.094 466.667,166.667L466.667,233.333M400,333.333L633.333,333.333C669.906,333.333 700,363.428 700,400L700,700L616.8,644.533C605.845,637.228 592.967,633.33 579.8,633.333L400,633.333C363.428,633.333 333.333,603.239 333.333,566.667L333.333,400C333.333,363.428 363.428,333.333 400,333.333Z" style="fill:none;fill-rule:nonzero;stroke:currentColor;stroke-width:49.68px;"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
251
main.ts
Normal file
251
main.ts
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
import { Editor, MarkdownView, Notice, Plugin, requestUrl } from 'obsidian';
|
||||
import { DEFAULT_SETTINGS, UmbracidianSettings } from "./types/index";
|
||||
import { SettingTab } from "./settings";
|
||||
import { UmbracidianIcons } from "./icons/icons";
|
||||
import { GenerateGuid } from "./methods/generateGuid";
|
||||
import { CallUmbracoApi } from "./methods/callUmbracoApi";
|
||||
|
||||
const matter = require("gray-matter");
|
||||
|
||||
|
||||
interface Frontmatter {
|
||||
title: string;
|
||||
tags: string[];
|
||||
featured: boolean;
|
||||
status: string;
|
||||
excerpt?: string;
|
||||
feature_image?: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
export default class Umbracidian extends Plugin {
|
||||
settings: UmbracidianSettings;
|
||||
|
||||
private icons = new UmbracidianIcons();
|
||||
private bearerToken: null | string = null; // Initialize bearerToken to null
|
||||
|
||||
async onload() {
|
||||
await this.loadSettings();
|
||||
|
||||
this.icons.registerIcons();
|
||||
// This creates an icon in the left ribbon.
|
||||
this.addRibbonIcon('umbracidian-logo', 'Umbracidian', async (evt: MouseEvent) => {
|
||||
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
|
||||
if (!view) {
|
||||
new Notice('No active Markdown view found.');
|
||||
return;
|
||||
}
|
||||
this.bearerToken = await this.getBearerToken();
|
||||
|
||||
const umbracoDocType = await this.getUmbracoDocType();
|
||||
await this.createObsidianNode(view, umbracoDocType);
|
||||
|
||||
});
|
||||
|
||||
// This adds an editor command that can perform some operation on the current editor instance
|
||||
this.addCommand({
|
||||
id: 'push-to-umbraco',
|
||||
name: 'Push to Umbraco command',
|
||||
editorCallback: async (editor: Editor) => {
|
||||
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
|
||||
if (!view) {
|
||||
new Notice('No active Markdown view found.');
|
||||
return;
|
||||
}
|
||||
this.bearerToken = await this.getBearerToken();
|
||||
this.getUmbracoDocType();
|
||||
const umbracoDocType = await this.getUmbracoDocType();
|
||||
await this.createObsidianNode(view, umbracoDocType);
|
||||
}
|
||||
});
|
||||
|
||||
// This adds a settings tab so the user can configure various aspects of the plugin
|
||||
this.addSettingTab(new SettingTab(this.app, this));
|
||||
}
|
||||
|
||||
onunload() {
|
||||
|
||||
}
|
||||
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
}
|
||||
|
||||
async saveSettings() {
|
||||
await this.saveData(this.settings);
|
||||
}
|
||||
|
||||
|
||||
async getUmbracoDocType(): Promise<any> {
|
||||
const docType = this.settings.blogDocTypeAlias;
|
||||
const websiteUrl = this.settings.websiteUrl;
|
||||
const token = this.bearerToken;
|
||||
const endpoint = `${websiteUrl}/umbraco/management/api/v1/item/document-type/search?query=${docType}&skip=0&take=1`;
|
||||
if (token === null) {
|
||||
new Notice('Bearer token is null. Please check your settings.');
|
||||
return null;
|
||||
}
|
||||
const obsidianDocType = await CallUmbracoApi(endpoint, token, 'GET');
|
||||
|
||||
if (obsidianDocType && obsidianDocType.items && obsidianDocType.items.length > 0) {
|
||||
console.log('Obsidian document type found:', obsidianDocType.items[0]);
|
||||
return obsidianDocType.items[0]; // Return the first document type found
|
||||
} else {
|
||||
new Notice('No Obsidian document type found.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async getBearerToken(): Promise<string | null> {
|
||||
const clientId = this.settings.clientId;
|
||||
const clientSecret = this.settings.clientSecret;
|
||||
const tokenEndpoint = `${this.settings.websiteUrl}/umbraco/management/api/v1/security/back-office/token`;
|
||||
|
||||
if (!clientId || !clientSecret || !tokenEndpoint) {
|
||||
new Notice('Missing CLIENT_ID, CLIENT_SECRET, or TOKEN_ENDPOINT in environment variables.');
|
||||
return null;
|
||||
}
|
||||
|
||||
const body = new URLSearchParams({
|
||||
grant_type: 'client_credentials',
|
||||
client_id: clientId,
|
||||
client_secret: clientSecret,
|
||||
});
|
||||
|
||||
try {
|
||||
const response = await requestUrl({
|
||||
url: tokenEndpoint,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
body: body.toString(),
|
||||
});
|
||||
|
||||
// Check if the response contains valid JSON
|
||||
if (response.json) {
|
||||
const data = response.json as { access_token: string };
|
||||
console.log('Bearer token response:', data);
|
||||
return data.access_token; // Assuming the token is in the "access_token" field
|
||||
} else {
|
||||
console.error('Empty or invalid JSON response:', response);
|
||||
new Notice('Failed to fetch bearer token.');
|
||||
return null;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching bearer token:', error);
|
||||
new Notice(`Error fetching bearer token: ${error}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async getPageContent(view: MarkdownView): Promise<Frontmatter | null> {
|
||||
|
||||
const noteFile = view.app.workspace.getActiveFile();
|
||||
if (!noteFile) {
|
||||
new Notice('No active file found.');
|
||||
return null;
|
||||
}
|
||||
|
||||
const metaMatter = this.app.metadataCache.getFileCache(noteFile)?.frontmatter;
|
||||
const pageContent = matter(view.getViewData());
|
||||
|
||||
const frontmatter = {
|
||||
title: metaMatter?.title || view.file?.basename,
|
||||
tags: metaMatter?.tags || [],
|
||||
featured: metaMatter?.featured || false,
|
||||
status: metaMatter?.published ? "published" : "draft",
|
||||
excerpt: metaMatter?.excerpt || undefined,
|
||||
feature_image: metaMatter?.feature_image || undefined,
|
||||
content: pageContent.content,
|
||||
};
|
||||
if (!frontmatter) {
|
||||
new Notice('No frontmatter found.');
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
console.log('Meta matter:', frontmatter);
|
||||
return frontmatter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async getLeafTitle(): Promise<string | null> {
|
||||
const activeLeaf = this.app.workspace.activeLeaf;
|
||||
if (activeLeaf && activeLeaf.getDisplayText) {
|
||||
return activeLeaf.getDisplayText();
|
||||
} else {
|
||||
new Notice('No active leaf found.');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async createObsidianNode(view: MarkdownView, obsidianDoctype: any): Promise<any> {
|
||||
const endpoint = `${this.settings.websiteUrl}/umbraco/management/api/v1/document`;
|
||||
const nodeId = obsidianDoctype;
|
||||
|
||||
const pageTitle = await this.getLeafTitle();
|
||||
const pageContent = await this.getPageContent(view);
|
||||
|
||||
const body = {
|
||||
"id": await GenerateGuid(),
|
||||
"parent": {
|
||||
"id": this.settings.blogParentNodeId
|
||||
},
|
||||
"documentType":
|
||||
{ "id": nodeId.id },
|
||||
"template": null,
|
||||
"values":
|
||||
[
|
||||
{
|
||||
"editorAlias": "Umbraco.TextBox",
|
||||
"alias": "title",
|
||||
"culture": null,
|
||||
"segment": null,
|
||||
"value": pageTitle
|
||||
},
|
||||
{
|
||||
"editorAias": "Umbraco.MarkdownEditor",
|
||||
"alias": this.settings.blogContentAlias,
|
||||
"culture": null,
|
||||
"segment": null,
|
||||
"value": pageContent?.content
|
||||
|
||||
|
||||
}
|
||||
],
|
||||
"variants":
|
||||
[
|
||||
{
|
||||
"culture": null,
|
||||
"segment": null,
|
||||
"state": null,
|
||||
"name": pageTitle,
|
||||
"publishDate": null,
|
||||
"createDate": null,
|
||||
"updateDate": null
|
||||
},
|
||||
]
|
||||
|
||||
};
|
||||
console.log('Body:', body);
|
||||
const token = this.bearerToken;
|
||||
if (!token) {
|
||||
new Notice('Bearer token is null. Please check your settings.');
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await CallUmbracoApi(endpoint, token, 'POST', body);
|
||||
if (response) {
|
||||
new Notice('Node created successfully!');
|
||||
}
|
||||
else {
|
||||
{
|
||||
new Notice('Failed to create node.');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
manifest.json
Normal file
11
manifest.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"id": "Umbracidian",
|
||||
"name": "Umbracidian",
|
||||
"version": "1.0.0",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "Push notes to Umbraco CMS as blog posts.",
|
||||
"author": "OwainCodes",
|
||||
"authorUrl": "https://owain.codes",
|
||||
"fundingUrl": "https://buymeacoffee.com/owaincodes",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
32
methods/callUmbracoApi.ts
Normal file
32
methods/callUmbracoApi.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { requestUrl, Notice } from 'obsidian';
|
||||
|
||||
|
||||
export async function CallUmbracoApi(endpoint: string, bearerToken: string, method = 'GET', body?: any): Promise<any> {
|
||||
|
||||
const response = await requestUrl({
|
||||
url: `${endpoint}`,
|
||||
method,
|
||||
headers: {
|
||||
'Authorization': `Bearer ${bearerToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: body ? JSON.stringify(body) : undefined,
|
||||
});
|
||||
|
||||
if (response.status === 201 || response.status === 200) {
|
||||
try {
|
||||
// Attempt to parse JSON if possible
|
||||
return response.json;
|
||||
} catch (jsonError) {
|
||||
// If JSON parsing fails, log a warning and return the raw response
|
||||
console.warn('Invalid JSON response:', response.text);
|
||||
new Notice('Invalid JSON response from API.');
|
||||
return { ok: true, status: response.status, text: response.text };
|
||||
}
|
||||
} else {
|
||||
// Handle non-OK status codes
|
||||
console.error('API call failed with status:', response.status);
|
||||
new Notice(`API call failed with status: ${response.status}`);
|
||||
|
||||
}
|
||||
}
|
||||
8
methods/generateGuid.ts
Normal file
8
methods/generateGuid.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { randomBytes } from 'crypto';
|
||||
export async function GenerateGuid(): Promise<string> {
|
||||
return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c: string) => {
|
||||
const random = parseInt(c, 10) ^ (randomBytes(1)[0] & 15 >> parseInt(c, 10) / 4);
|
||||
return random.toString(16); // convert to guid
|
||||
|
||||
});
|
||||
}
|
||||
0
methods/getPageContent.ts
Normal file
0
methods/getPageContent.ts
Normal file
2963
package-lock.json
generated
Normal file
2963
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
41
package.json
Normal file
41
package.json
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "Umbracidian",
|
||||
"version": "0.1.0",
|
||||
"description": "Send Blog Posts to Umbraco CMS via Management API",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"dev": "node esbuild.config.mjs",
|
||||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
|
||||
"version": "node version-bump.mjs && git add manifest.json versions.json"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.18.126",
|
||||
"@types/node-fetch": "^2.6.12",
|
||||
"@typescript-eslint/eslint-plugin": "5.29.0",
|
||||
"@typescript-eslint/parser": "5.29.0",
|
||||
"builtin-modules": "3.3.0",
|
||||
"esbuild": "0.17.3",
|
||||
"obsidian": "^1.8.7",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "4.7.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@umbraco/headless-client": "^0.9.0",
|
||||
"crypto": "^1.0.1",
|
||||
"dotenv": "^16.4.7",
|
||||
"gray-matter": "^4.0.3",
|
||||
"markdown-it": "^14.1.0",
|
||||
"node-fetch": "^2.7.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/obsidianmd/obsidian-sample-plugin.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/obsidianmd/obsidian-sample-plugin/issues"
|
||||
},
|
||||
"homepage": "https://github.com/obsidianmd/obsidian-sample-plugin#readme"
|
||||
}
|
||||
78
settings/index.ts
Normal file
78
settings/index.ts
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
import Umbracidian from "main";
|
||||
import { App, PluginSettingTab, Setting } from "obsidian";
|
||||
|
||||
export class SettingTab extends PluginSettingTab {
|
||||
plugin: Umbracidian;
|
||||
|
||||
constructor(app: App, plugin: Umbracidian) {
|
||||
super(app, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
display(): void {
|
||||
const {containerEl} = this;
|
||||
|
||||
containerEl.empty();
|
||||
containerEl.createEl('h2', {text: 'Umbracidian'});
|
||||
new Setting(containerEl)
|
||||
.setName('Website URL')
|
||||
.setDesc('The URL of the Umbraco website e.g. https://example.com')
|
||||
.addText(text => text
|
||||
.setPlaceholder('Enter the website URL')
|
||||
.setValue(this.plugin.settings.websiteUrl)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.websiteUrl = value;
|
||||
await this.plugin.saveSettings();
|
||||
})),
|
||||
new Setting(containerEl)
|
||||
.setName('Client ID')
|
||||
.setDesc('The client ID for the Umbraco API')
|
||||
.addText(text => text
|
||||
.setPlaceholder('')
|
||||
.setValue(this.plugin.settings.clientId)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.clientId = value;
|
||||
await this.plugin.saveSettings();
|
||||
})),
|
||||
new Setting(containerEl)
|
||||
.setName('Client Secret')
|
||||
.setDesc('The client secret for the Umbraco API')
|
||||
.addText(text => text
|
||||
.setPlaceholder('')
|
||||
.setValue(this.plugin.settings.clientSecret)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.clientSecret = value;
|
||||
await this.plugin.saveSettings();
|
||||
}).inputEl.setAttribute('type', 'password')),
|
||||
new Setting(containerEl)
|
||||
.setName('Blog Parent Node UUID')
|
||||
.setDesc('The UUID of the parent node for blog posts e.g. 00000000-0000-0000-0000-00000000000')
|
||||
.addText(text => text
|
||||
.setPlaceholder('Enter the parent node UUID')
|
||||
.setValue(this.plugin.settings.blogParentNodeId)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.blogParentNodeId = value;
|
||||
await this.plugin.saveSettings();
|
||||
})),
|
||||
new Setting(containerEl)
|
||||
.setName('DocType alias')
|
||||
.setDesc('This is the alias of the DocType you want to use for your blog posts')
|
||||
.addText(text => text
|
||||
.setPlaceholder('Enter the DocType alias')
|
||||
.setValue(this.plugin.settings.blogDocTypeAlias)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.blogDocTypeAlias = value;
|
||||
await this.plugin.saveSettings();
|
||||
})),
|
||||
new Setting(containerEl)
|
||||
.setName('Blog Content Editor alias')
|
||||
.setDesc('This should be an Umbraco.MarkdownEditor property on your page')
|
||||
.addText(text => text
|
||||
.setPlaceholder('Enter the Property alias')
|
||||
.setValue(this.plugin.settings.blogContentAlias)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.blogContentAlias = value;
|
||||
await this.plugin.saveSettings();
|
||||
}))
|
||||
}
|
||||
}
|
||||
8
styles.css
Normal file
8
styles.css
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
|
||||
This CSS file will be included with your plugin, and
|
||||
available in the app when your plugin is enabled.
|
||||
|
||||
If your plugin does not need CSS, delete this file.
|
||||
|
||||
*/
|
||||
24
tsconfig.json
Normal file
24
tsconfig.json
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"inlineSourceMap": true,
|
||||
"inlineSources": true,
|
||||
"module": "ESNext",
|
||||
"target": "ES6",
|
||||
"allowJs": true,
|
||||
"noImplicitAny": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"isolatedModules": true,
|
||||
"strictNullChecks": true,
|
||||
"lib": [
|
||||
"DOM",
|
||||
"ES5",
|
||||
"ES6",
|
||||
"ES7"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts"
|
||||
]
|
||||
}
|
||||
32
types/index.ts
Normal file
32
types/index.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
export interface UmbracidianSettings {
|
||||
mySetting: string;
|
||||
websiteUrl: string;
|
||||
blogParentNodeId: string;
|
||||
blogDocTypeAlias: string;
|
||||
clientId: string;
|
||||
clientSecret: string;
|
||||
blogContentAlias: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: UmbracidianSettings = {
|
||||
mySetting: 'default',
|
||||
blogParentNodeId: 'null',
|
||||
blogDocTypeAlias: 'BlogPost',
|
||||
websiteUrl: 'https://example.com',
|
||||
clientId: 'your-client-id',
|
||||
clientSecret: 'your-client-secret',
|
||||
blogContentAlias: 'blogContent',
|
||||
}
|
||||
|
||||
export interface ContentProp {
|
||||
title: string;
|
||||
tags?: string[];
|
||||
featured?: boolean;
|
||||
status: string;
|
||||
excerpt?: string | undefined;
|
||||
feature_image?: string;
|
||||
}
|
||||
|
||||
export interface DataProp {
|
||||
content: string;
|
||||
}
|
||||
14
version-bump.mjs
Normal file
14
version-bump.mjs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { readFileSync, writeFileSync } from "fs";
|
||||
|
||||
const targetVersion = process.env.npm_package_version;
|
||||
|
||||
// read minAppVersion from manifest.json and bump version to target version
|
||||
let manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
|
||||
const { minAppVersion } = manifest;
|
||||
manifest.version = targetVersion;
|
||||
writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t"));
|
||||
|
||||
// update versions.json with target version and minAppVersion from manifest.json
|
||||
let versions = JSON.parse(readFileSync("versions.json", "utf8"));
|
||||
versions[targetVersion] = minAppVersion;
|
||||
writeFileSync("versions.json", JSON.stringify(versions, null, "\t"));
|
||||
3
versions.json
Normal file
3
versions.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"1.0.0": "0.15.0"
|
||||
}
|
||||
Loading…
Reference in a new issue