forked from jsnbuchanan/crowd-funder-for-time-pwa
fix image server references for tests (2 tests failing: missing function & looking for registration prompt for unregistered user)
This commit is contained in:
@@ -365,35 +365,41 @@
|
||||
<div v-if="loadingLimits" class="text-center">
|
||||
Checking… <fa icon="spinner" class="fa-spin"></fa>
|
||||
</div>
|
||||
<div>
|
||||
<div class="mb-4 text-center">
|
||||
{{ limitsMessage }}
|
||||
</div>
|
||||
<div v-if="!!endorserLimits?.nextWeekBeginDateTime">
|
||||
<div>
|
||||
<p class="text-sm">
|
||||
You have done
|
||||
<b>{{ endorserLimits.doneClaimsThisWeek }} claims</b> out of
|
||||
<b>{{ endorserLimits.maxClaimsPerWeek }}</b> for this week. Your
|
||||
claims counter resets at
|
||||
<b>{{ endorserLimits?.doneClaimsThisWeek || "?" }} claims</b> out of
|
||||
<b>{{ endorserLimits?.maxClaimsPerWeek || "?" }}</b> for this week.
|
||||
Your claims counter resets at
|
||||
<b class="whitespace-nowrap">{{
|
||||
readableDate(endorserLimits.nextWeekBeginDateTime)
|
||||
readableDate(endorserLimits?.nextWeekBeginDateTime)
|
||||
}}</b>
|
||||
</p>
|
||||
<p class="mt-3 text-sm">
|
||||
You have done
|
||||
<b>{{ endorserLimits.doneRegistrationsThisMonth }} registrations</b>
|
||||
out of <b>{{ endorserLimits.maxRegistrationsPerMonth }}</b> for this
|
||||
month.
|
||||
<i>(You cannot register anyone else on your first day.)</i>
|
||||
<b
|
||||
>{{
|
||||
endorserLimits?.doneRegistrationsThisMonth || "?"
|
||||
}}
|
||||
registrations</b
|
||||
>
|
||||
out of
|
||||
<b>{{ endorserLimits?.maxRegistrationsPerMonth || "?" }}</b> for this
|
||||
this month.
|
||||
<i>(You cannot register anyone on your first day.)</i>
|
||||
Your registration counter resets at
|
||||
<b class="whitespace-nowrap">
|
||||
{{ readableDate(endorserLimits.nextMonthBeginDateTime) }}
|
||||
{{ readableDate(endorserLimits?.nextMonthBeginDateTime) }}
|
||||
</b>
|
||||
</p>
|
||||
<p class="mt-3 text-sm" v-if="!!imageLimits">
|
||||
<p class="mt-3 text-sm">
|
||||
You have uploaded
|
||||
<b>{{ imageLimits?.doneImagesThisWeek }} images</b> out of
|
||||
<b>{{ imageLimits?.maxImagesPerWeek }}</b> for this week. Your image
|
||||
counter resets at
|
||||
<b>{{ imageLimits?.doneImagesThisWeek || "?" }} images</b> out of
|
||||
<b>{{ imageLimits?.maxImagesPerWeek || "?" }}</b> for this week. Your
|
||||
image counter resets at
|
||||
<b class="whitespace-nowrap">{{
|
||||
readableDate(imageLimits?.nextWeekBeginDateTime)
|
||||
}}</b>
|
||||
@@ -1215,7 +1221,7 @@ export default class AccountViewView extends Vue {
|
||||
}
|
||||
|
||||
readableDate(timeStr: string) {
|
||||
return timeStr.substring(0, timeStr.indexOf("T"));
|
||||
return timeStr ? timeStr.substring(0, timeStr.indexOf("T")) : "?";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1230,11 +1236,11 @@ export default class AccountViewView extends Vue {
|
||||
this.publicHex = identity.keys[0].publicKeyHex;
|
||||
this.publicBase64 = Buffer.from(this.publicHex, "hex").toString("base64");
|
||||
this.derivationPath = identity.keys[0].meta?.derivationPath as string;
|
||||
await this.checkLimitsFor(this.activeDid);
|
||||
await this.checkLimits();
|
||||
} else if (account?.publicKeyHex) {
|
||||
this.publicHex = account.publicKeyHex as string;
|
||||
this.publicBase64 = Buffer.from(this.publicHex, "hex").toString("base64");
|
||||
await this.checkLimitsFor(this.activeDid);
|
||||
await this.checkLimits();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1598,11 +1604,13 @@ export default class AccountViewView extends Vue {
|
||||
}
|
||||
|
||||
/**
|
||||
* Use "checkLimits" instead.
|
||||
*
|
||||
* Asynchronously checks rate limits for the given identity.
|
||||
*
|
||||
* Updates component state variables `limits`, `limitsMessage`, and `loadingLimits`.
|
||||
*/
|
||||
public async checkLimitsFor(did: string) {
|
||||
private async checkLimitsFor(did: string) {
|
||||
this.loadingLimits = true;
|
||||
this.limitsMessage = "";
|
||||
|
||||
@@ -1632,9 +1640,15 @@ export default class AccountViewView extends Vue {
|
||||
);
|
||||
}
|
||||
}
|
||||
const imageResp = await fetchImageRateLimits(this.axios, did);
|
||||
if (imageResp.status === 200) {
|
||||
this.imageLimits = imageResp.data;
|
||||
try {
|
||||
const imageResp = await fetchImageRateLimits(this.axios, did);
|
||||
if (imageResp.status === 200) {
|
||||
this.imageLimits = imageResp.data;
|
||||
} else {
|
||||
this.limitsMessage = "You don't have access to upload images.";
|
||||
}
|
||||
} catch {
|
||||
this.limitsMessage = "You cannot upload images.";
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -1739,6 +1753,14 @@ export default class AccountViewView extends Vue {
|
||||
try {
|
||||
const headers = await getHeaders(this.activeDid);
|
||||
this.passkeyExpirationDescription = tokenExpiryTimeDescription();
|
||||
if (
|
||||
window.location.hostname === "localhost" &&
|
||||
!DEFAULT_IMAGE_API_SERVER.includes("localhost")
|
||||
) {
|
||||
console.log(
|
||||
"Using shared image API server, so only users on that server can play with images.",
|
||||
);
|
||||
}
|
||||
const response = await this.axios.delete(
|
||||
DEFAULT_IMAGE_API_SERVER +
|
||||
"/image/" +
|
||||
|
||||
Reference in New Issue
Block a user