Skip to content

Commit

Permalink
Ignore some typescript errors that seem spurious. Add license file.
Browse files Browse the repository at this point in the history
  • Loading branch information
brokensandals committed Jul 6, 2024
1 parent 60cd992 commit 243f24a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 5 additions & 0 deletions src/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -78,6 +82,7 @@ export class AltGen {
content: [
{
type: 'image',
// @ts-ignore
source: { type: 'base64', media_type: mediaType, data: Buffer.from(imageData).toString('base64') },
},
{
Expand Down
4 changes: 4 additions & 0 deletions src/imgtags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
});
}
Expand Down

0 comments on commit 243f24a

Please sign in to comment.