-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from goniszewski/feat/update-api-for-bookmark-ext
Feat/update API for bookmark extension
- Loading branch information
Showing
10 changed files
with
267 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/// <reference path="../pb_data/types.d.ts" /> | ||
migrate((db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("mwhpoxiiau7d76n") | ||
|
||
// add | ||
collection.schema.addField(new SchemaField({ | ||
"system": false, | ||
"id": "axufosre", | ||
"name": "screenshot", | ||
"type": "file", | ||
"required": false, | ||
"presentable": false, | ||
"unique": false, | ||
"options": { | ||
"maxSelect": 1, | ||
"maxSize": 307200, | ||
"mimeTypes": [ | ||
"image/png", | ||
"image/jpeg", | ||
"image/webp", | ||
"image/avif" | ||
], | ||
"thumbs": [ | ||
"380x144", | ||
"100x100" | ||
], | ||
"protected": false | ||
} | ||
})) | ||
|
||
return dao.saveCollection(collection) | ||
}, (db) => { | ||
const dao = new Dao(db) | ||
const collection = dao.findCollectionByNameOrId("mwhpoxiiau7d76n") | ||
|
||
// remove | ||
collection.schema.removeField("axufosre") | ||
|
||
return dao.saveCollection(collection) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,5 @@ export type Bookmark = { | |
owner: User; | ||
opened_last: null | Date; | ||
opened_times: number; | ||
screenshot: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const urlDataToBlobConverter = (urlData: string): Blob => { | ||
const splittedData = urlData.split(','); | ||
const byteCharacters = atob(splittedData[1]); | ||
const mimeString = splittedData[0].split(':')[1].split(';')[0]; | ||
const byteNumbers = new Array(byteCharacters.length); | ||
for (let i = 0; i < byteCharacters.length; i++) { | ||
byteNumbers[i] = byteCharacters.charCodeAt(i); | ||
} | ||
const byteArray = new Uint8Array(byteNumbers); | ||
|
||
const convertedBlob = new Blob([byteArray], { type: mimeString }); | ||
|
||
return convertedBlob; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.