Browse Source

bump to v 0.3.10, fix image upload on Chrome

pull/117/head
Trent Larson 4 months ago
parent
commit
36d2e41fea
  1. 14
      CHANGELOG.md
  2. 12
      README.md
  3. 4
      package-lock.json
  4. 2
      package.json
  5. 2
      src/components/PhotoDialog.vue
  6. 2
      src/main.ts
  7. 47
      src/views/SharedPhotoView.vue
  8. 11
      sw_scripts/additional-scripts.js

14
CHANGELOG.md

@ -10,7 +10,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Nothing - Nothing
## [0.3.9] - 2024.04-28 ## [0.3.10] - 2024.05.11
### Added
- Share an image
- Choose a file on the device for a profile image
### Changed in DB or environment
- Nothing
## [0.3.9] - 2024.04.28 - 874e717e698b93a1ace9f588e675b8a3dccd7617
### Added ### Added
- Offers on contacts page - Offers on contacts page
- Checks on front page until they show as registered - Checks on front page until they show as registered
@ -24,7 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Nothing - Nothing
## [0.3.8] - 2024.04-20 - 15c026c80ce03a26cae3ff80b0888934c101c7e2 ## [0.3.8] - 2024.04.20 - 15c026c80ce03a26cae3ff80b0888934c101c7e2
### Added ### Added
- Profile image for user - Profile image for user
### Fixed ### Fixed
@ -33,7 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Nothing - Nothing
## [0.3.7] - 2024.04-10 - cf18f1543a700d62a5f9e764905a4aafe1fb229b ## [0.3.7] - 2024.04.10 - cf18f1543a700d62a5f9e764905a4aafe1fb229b
### Added ### Added
- Filter on home page feed - Filter on home page feed
- Ability to set time of daily notification - Ability to set time of daily notification

12
README.md

@ -16,28 +16,30 @@ We have pkgx.dev set up in package.json, so you can use `dev` to set up the dev
npm install npm install
``` ```
### Compiles and hot-reloads for development ### Compile and hot-reloads for development
``` ```
npm run dev npm run dev
``` ```
### Builds the production app ### Build the test & production app
``` ```
npm run serve npm run serve
``` ```
### Lints and fixes files ### Lint and fix files
``` ```
npm run lint npm run lint
``` ```
### Compiles and minifies for production ### Compile and minify for test & production
* If there are DB changes: before updating the test server, open browser(s) with current version to test DB migrations. * If there are DB changes: before updating the test server, open browser(s) with current version to test DB migrations.
* When deploying to a different domain, look at the "domain" note in the additional-scripts.js file.
* `npx prettier --write ./sw_scripts/` * `npx prettier --write ./sw_scripts/`
* Update the project.task.yaml & CHANGELOG.md & the version in package.json, run `npm install`. * Update the ClickUp tasks & CHANGELOG.md & the version in package.json, run `npm install`.
* Record what version is currently on production. * Record what version is currently on production.

4
package-lock.json

@ -1,12 +1,12 @@
{ {
"name": "TimeSafari", "name": "TimeSafari",
"version": "0.3.10-beta", "version": "0.3.10",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "TimeSafari", "name": "TimeSafari",
"version": "0.3.10-beta", "version": "0.3.10",
"dependencies": { "dependencies": {
"@dicebear/collection": "^5.4.1", "@dicebear/collection": "^5.4.1",
"@dicebear/core": "^5.4.1", "@dicebear/core": "^5.4.1",

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "TimeSafari", "name": "TimeSafari",
"version": "0.3.10-beta", "version": "0.3.10",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

2
src/components/PhotoDialog.vue

@ -378,7 +378,7 @@ export default class PhotoDialog extends Vue {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Error", title: "Error",
text: "There was an error saving the picture. Please try again.", text: "There was an error saving the picture.",
}, },
5000, 5000,
); );

2
src/main.ts

@ -13,6 +13,7 @@ import { library } from "@fortawesome/fontawesome-svg-core";
import { import {
faArrowLeft, faArrowLeft,
faArrowRight, faArrowRight,
faArrowRotateBackward,
faArrowUpRightFromSquare, faArrowUpRightFromSquare,
faBan, faBan,
faBitcoinSign, faBitcoinSign,
@ -77,6 +78,7 @@ import {
library.add( library.add(
faArrowLeft, faArrowLeft,
faArrowRight, faArrowRight,
faArrowRotateBackward,
faArrowUpRightFromSquare, faArrowUpRightFromSquare,
faBan, faBan,
faBitcoinSign, faBitcoinSign,

47
src/views/SharedPhotoView.vue

@ -35,6 +35,7 @@
Cancel Cancel
</button> </button>
</div> </div>
<PhotoDialog ref="photoDialog" />
</div> </div>
<div class="flex justify-center"> <div class="flex justify-center">
@ -52,8 +53,10 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import axios from "axios";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import PhotoDialog from "@/components/PhotoDialog.vue";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
import { import {
DEFAULT_IMAGE_API_SERVER, DEFAULT_IMAGE_API_SERVER,
@ -64,9 +67,8 @@ import { db } from "@/db/index";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import { getIdentity } from "@/libs/util"; import { getIdentity } from "@/libs/util";
import { accessToken } from "@/libs/crypto"; import { accessToken } from "@/libs/crypto";
import axios from "axios";
@Component({ components: { QuickNav } }) @Component({ components: { PhotoDialog, QuickNav } })
export default class SharedPhotoView extends Vue { export default class SharedPhotoView extends Vue {
$notify!: (notification: NotificationIface, timeout?: number) => void; $notify!: (notification: NotificationIface, timeout?: number) => void;
@ -123,15 +125,19 @@ export default class SharedPhotoView extends Vue {
}); });
} }
async recordProfile() { recordProfile() {
await this.sendToImageServer(IMAGE_TYPE_PROFILE).then((url) => { (this.$refs.photoDialog as PhotoDialog).open(
if (url) { async (imgUrl) => {
db.settings.update(MASTER_SETTINGS_KEY, { db.settings.update(MASTER_SETTINGS_KEY, {
profileImageUrl: url, profileImageUrl: imgUrl,
}); });
this.$router.push({ name: "account" }); this.$router.push({ name: "account" });
} },
}); true,
IMAGE_TYPE_PROFILE,
this.imageBlob,
this.imageFileName,
);
} }
async cancel() { async cancel() {
@ -159,16 +165,37 @@ export default class SharedPhotoView extends Vue {
); );
formData.append("claimType", imageType); formData.append("claimType", imageType);
console.log(
"Sending image to server",
formData,
headers,
DEFAULT_IMAGE_API_SERVER + "/image",
);
const response = await axios.post( const response = await axios.post(
DEFAULT_IMAGE_API_SERVER + "/image", DEFAULT_IMAGE_API_SERVER + "/image",
formData, formData,
{ headers }, { headers },
); );
if (response?.data?.url) {
this.imageBlob = undefined; this.imageBlob = undefined;
this.imageFileName = undefined; this.imageFileName = undefined;
result = response.data.url as string;
} else {
console.error("Problem uploading the image", response.data);
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text:
"There was a problem saving the picture. " +
(response?.data?.message || ""),
},
5000,
);
}
this.uploading = false; this.uploading = false;
result = response.data.url as string;
} catch (error) { } catch (error) {
console.error("Error uploading the image", error); console.error("Error uploading the image", error);
this.$notify( this.$notify(
@ -176,7 +203,7 @@ export default class SharedPhotoView extends Vue {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Error", title: "Error",
text: "There was an error saving the picture. Please try again.", text: "There was an error saving the picture.",
}, },
5000, 5000,
); );

11
sw_scripts/additional-scripts.js

@ -135,8 +135,15 @@ self.addEventListener("notificationclick", (event) => {
self.addEventListener("fetch", (event) => { self.addEventListener("fetch", (event) => {
logConsoleAndDb("Service worker got fetch event.", event); logConsoleAndDb("Service worker got fetch event.", event);
// Regular requests not related to Web Share Target. // Bypass any regular requests not related to Web Share Target
if (event.request.method !== "POST") { // and also requests that are not exactly to the timesafari.app
// (because Chrome will send subdomain requests like image-api.timesafari.app through this service worker).
if (
event.request.method !== "POST" ||
(event.request.url.hostname !== "timesafari.app" &&
event.request.url.hostname !== "test.timesafari.app" &&
event.request.url.hostname !== "localhost")
) {
event.respondWith(fetch(event.request)); event.respondWith(fetch(event.request));
return; return;
} }

Loading…
Cancel
Save