Skip to content

Commit

Permalink
fix: disable expiration check
Browse files Browse the repository at this point in the history
  • Loading branch information
SharzyL committed Mar 10, 2024
1 parent e905dcf commit 16a8d5c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/index.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ window.addEventListener('load', () => {
const pasteNotEmpty = inputType === 'edit'
? pasteEditArea.prop('value').length > 0
: file !== null
const expirationNotShort = expiration.length === 0 || parseInt(expiration) >= 60
const expirationValid = true // TODO: verify it
const nameValid = urlType !== 'custom' || NAME_REGEX.test(customName)
const adminUrlValid = urlType !== 'admin' || isAdminUrlLegal(adminUrl)

if (pasteNotEmpty && expirationNotShort && nameValid && adminUrlValid) {
if (pasteNotEmpty && expirationValid && nameValid && adminUrlValid) {
submitButton.addClass('enabled')
submitButton.prop('title', '')
} else {
submitButton.removeClass('enabled')
if (!pasteNotEmpty) {
submitButton.prop('title', 'Cannot upload empty paste')
} else if (!expirationNotShort) {
} else if (!expirationValid) {
submitButton.prop('title', 'Expiration should be more than 60 seconds')
} else if (!nameValid) {
submitButton.prop('title', `The customized URL should satisfy regex ${NAME_REGEX}`)
Expand Down Expand Up @@ -180,7 +180,7 @@ window.addEventListener('load', () => {
updateButtons()
})

// submit the form
// submit the form
submitButton.on('click', () => {
if (submitButton.hasClass('enabled')) {
if (urlType === 'admin') {
Expand Down

0 comments on commit 16a8d5c

Please sign in to comment.