✨ Migrated to deta from imgur for image-storing
This commit is contained in:
@@ -40,11 +40,14 @@
|
||||
|
||||
const checkIfAllQuestionImagesComplyWithRegex = (questions: Array<Question>) => {
|
||||
let NoteverythingValid = false;
|
||||
const regex = /^https:\/\/i\.imgur\.com\/.{7}.(jpg|png|gif)$/;
|
||||
// const regex = /^https:\/\/i\.imgur\.com\/.{7}.(jpg|png|gif)$/;
|
||||
// const local_regex = /^http(|s):\/\/\w*(|:)\d*\/api\/v1\/storage\/download\/.{36}--.{36}$/g;
|
||||
const main_regex =
|
||||
/^(http(|s):\/\/\w*(|:)\d*\/api\/v1\/storage\/download\/.{36}--.{36}|https:\/\/i\.imgur\.com\/.{7}.(jpg|png|gif))$/;
|
||||
for (let i = 0; i < questions.length; i++) {
|
||||
const question = questions[i];
|
||||
if (question.image && !regex.test(question.image)) {
|
||||
console.log('not valid');
|
||||
|
||||
if (question.image && !main_regex.test(question.image)) {
|
||||
NoteverythingValid = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,11 @@
|
||||
</div>
|
||||
{#if question.image !== null}
|
||||
<div>
|
||||
<img src={question.image} class="w-full h-full object-cover" alt="Question image" />
|
||||
<img
|
||||
src={question.image}
|
||||
class="h-2/5 object-cover mx-auto mb-8"
|
||||
alt="Content for Question"
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{#if timer_res !== '0'}
|
||||
|
||||
Reference in New Issue
Block a user