From 243f24a985d8a3417cd709b40dff73dcc742a703 Mon Sep 17 00:00:00 2001 From: Jacob Williams Date: Sat, 6 Jul 2024 12:28:31 -0700 Subject: [PATCH] Ignore some typescript errors that seem spurious. Add license file. --- LICENSE | 7 +++++++ manifest.json | 2 +- src/generation.ts | 5 +++++ src/imgtags.ts | 4 ++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..59cd6ab --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2024 Jacob Williams + +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. diff --git a/manifest.json b/manifest.json index c085eeb..e5cbc06 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "auto-image-alt", "name": "Automatic Image Alt-Text Generator", - "version": "1.0.0", + "version": "1.0.1", "minAppVersion": "0.15.0", "description": "Adds alt-text to images using generative AI.", "author": "Jacob Williams", diff --git a/src/generation.ts b/src/generation.ts index 91e736c..b4dcc57 100644 --- a/src/generation.ts +++ b/src/generation.ts @@ -19,14 +19,18 @@ export class AltGen { }; if (fetchReq?.body) { + // @ts-ignore obsidianReq.body = fetchReq.body; } else if (init?.body) { + // @ts-ignore obsidianReq.body = init.body; } if (fetchReq?.headers) { + // @ts-ignore obsidianReq.headers = {...fetchReq.headers}; } else if (init?.headers) { + // @ts-ignore obsidianReq.headers = {...init.headers}; } if (obsidianReq.headers) { @@ -78,6 +82,7 @@ export class AltGen { content: [ { type: 'image', + // @ts-ignore source: { type: 'base64', media_type: mediaType, data: Buffer.from(imageData).toString('base64') }, }, { diff --git a/src/imgtags.ts b/src/imgtags.ts index cfccd5a..41c2f51 100644 --- a/src/imgtags.ts +++ b/src/imgtags.ts @@ -15,9 +15,13 @@ export function locateImages(text: string): ImageTag[] { for (let match of text.matchAll(regex)) { result.push({ target: match[2], + // @ts-ignore tagBegin: match.indices[0][0], + // @ts-ignore tagEnd: match.indices[0][1], + // @ts-ignore altBegin: match.indices[1][0], + // @ts-ignore altEnd: match.indices[1][1], }); }