diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 91ca840..842caae 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -92,7 +92,7 @@ jobs: run: | VERSION=$(git describe --tags --abbrev=0) - TAG_MESSAGE=$(git tag -l --format='%(contents)' "$VERSION") + TAG_MESSAGE=$(git tag -l --format='%(contents)' "$VERSION" | sed '/-----BEGIN PGP SIGNATURE-----/,$d') if [ -n "$TAG_MESSAGE" ]; then TAG_VERSION=$(echo "$TAG_MESSAGE" | head -1 | sed 's/Release //' | sed 's/^[[:space:]]*//') diff --git a/src/app/Services/Hostelworld/Api/AvailabilityClient.ts b/src/app/Services/Hostelworld/Api/AvailabilityClient.ts index b2e279f..e42da53 100644 --- a/src/app/Services/Hostelworld/Api/AvailabilityClient.ts +++ b/src/app/Services/Hostelworld/Api/AvailabilityClient.ts @@ -47,7 +47,7 @@ export class AvailabilityClient { await Promise.all(daysAfterToCheck.map(async days => { const fromWithDaysAdded: Date = dateAddDays(from, days) - const toWithFromPlus3Days: Date = dateAddDays(fromWithDaysAdded, 2) + const toWithFromPlus3Days: Date = dateAddDays(fromWithDaysAdded, 3) await delay(randomNumber(0, 3) * 100) @@ -112,9 +112,12 @@ export class AvailabilityClient { availability: HostelworldPropertyAvailability ): void { for (const dorm of availability.rooms.dorms) { + const capacity: number = Number(dorm.capacity) + if (!capacity) continue + dorm.totalBedsAvailable = Math.ceil( - dorm.totalBedsAvailable / Number(dorm.capacity) - ) * Number(dorm.capacity) + dorm.totalBedsAvailable / capacity + ) * capacity } } diff --git a/src/app/Services/Hostelworld/Patchers/PropertyCardComponentPatcher.ts b/src/app/Services/Hostelworld/Patchers/PropertyCardComponentPatcher.ts index ae11da9..4fd4e34 100644 --- a/src/app/Services/Hostelworld/Patchers/PropertyCardComponentPatcher.ts +++ b/src/app/Services/Hostelworld/Patchers/PropertyCardComponentPatcher.ts @@ -50,7 +50,7 @@ export class PropertyCardComponentPatcher { Object.defineProperty(component.__vue__, 'stayingAvatars', { configurable: true, get: () => staying, - set: () => emptyFunction + set: emptyFunction }) } } diff --git a/src/app/Services/Hostelworld/Patchers/SearchPropertyListComponentPatcher.ts b/src/app/Services/Hostelworld/Patchers/SearchPropertyListComponentPatcher.ts index a6a4ae3..ab120b7 100644 --- a/src/app/Services/Hostelworld/Patchers/SearchPropertyListComponentPatcher.ts +++ b/src/app/Services/Hostelworld/Patchers/SearchPropertyListComponentPatcher.ts @@ -20,7 +20,7 @@ export class SearchPropertyListComponentPatcher { Object.defineProperty(component, 'propertiesPerPage', { configurable: true, get: () => maxPossiblePropertiesFromRequest, - set: () => emptyFunction + set: emptyFunction }) } @@ -40,7 +40,7 @@ export class SearchPropertyListComponentPatcher { Object.defineProperty(component, 'displayFeaturedProperties', { configurable: true, get: () => displayFeaturedProperties, - set: () => emptyFunction + set: emptyFunction }) } diff --git a/src/app/Utils/HttpClient.ts b/src/app/Utils/HttpClient.ts index 18d37b9..86d66f3 100644 --- a/src/app/Utils/HttpClient.ts +++ b/src/app/Utils/HttpClient.ts @@ -61,7 +61,7 @@ export class HttpClient { const hasNotExpired: boolean = await this.storage.hasNotExpired(cacheKey) if (hasNotExpired) return - const content: string = await response.text() + const content: string = await response.clone().text() const cacheTimeInMs: number = (cacheInMinutes ?? this.defaultCacheTimeInMinutes) * 60 * 1000 return this.storage.put(cacheKey, content, cacheTimeInMs) diff --git a/src/app/Utils/Utils.ts b/src/app/Utils/Utils.ts index 5f351cb..b4c73cd 100644 --- a/src/app/Utils/Utils.ts +++ b/src/app/Utils/Utils.ts @@ -73,9 +73,15 @@ export function shallowEqual (object1: Record, object2: Record< if (object1Keys.length !== object2Keys.length) return false for (const key of object1Keys) { - if (object2Keys.includes(key) && object1[key] === object2[key]) continue + if (!object2Keys.includes(key)) return false - return false + const value1: unknown = object1[key] + const value2: unknown = object2[key] + + if (value1 instanceof RegExp && value2 instanceof RegExp && + value1.source === value2.source && value1.flags === value2.flags) continue + + if (value1 !== value2) return false } return true diff --git a/src/app/Utils/XHRRequestInterceptor/CustomXMLHttpRequest.ts b/src/app/Utils/XHRRequestInterceptor/CustomXMLHttpRequest.ts index 027dded..38466f4 100644 --- a/src/app/Utils/XHRRequestInterceptor/CustomXMLHttpRequest.ts +++ b/src/app/Utils/XHRRequestInterceptor/CustomXMLHttpRequest.ts @@ -38,7 +38,7 @@ export class CustomXMLHttpRequest extends XMLHttpRequest { return super.onloadend } - set onloadend (callback: (event: ProgressEvent) => void | null) { + set onloadend (callback: ((event: ProgressEvent) => void) | null) { super.onloadend = event => { CustomXMLHttpRequest.interceptCallback?.(this, 'loadend') callback?.(event)