From 2a44edae012b85ac670561495e969e71afc2a8a4 Mon Sep 17 00:00:00 2001 From: kyrea Date: Sun, 24 Nov 2024 23:05:43 +0530 Subject: [PATCH 1/4] Added unique constraint to URL fields in Schemas with similar models --- src/models/schemas/Angry.js | 3 +-- src/models/schemas/Baka.js | 3 +-- src/models/schemas/Bite.js | 3 +-- src/models/schemas/Blush.js | 3 +-- src/models/schemas/Bonk.js | 3 +-- src/models/schemas/Bored.js | 3 +-- src/models/schemas/Bully.js | 3 +-- src/models/schemas/Bye.js | 3 +-- src/models/schemas/Chase.js | 3 +-- src/models/schemas/Cheer.js | 3 +-- src/models/schemas/Cringe.js | 3 +-- src/models/schemas/Cry.js | 3 +-- src/models/schemas/Cuddle.js | 3 +-- src/models/schemas/Dab.js | 3 +-- src/models/schemas/Dance.js | 3 +-- src/models/schemas/Die.js | 3 +-- src/models/schemas/Disgust.js | 3 +-- src/models/schemas/Facepalm.js | 3 +-- src/models/schemas/Feed.js | 3 +-- src/models/schemas/Glomp.js | 3 +-- src/models/schemas/Happy.js | 3 +-- src/models/schemas/Hi.js | 3 +-- src/models/schemas/Highfive.js | 3 +-- src/models/schemas/Hold.js | 3 +-- src/models/schemas/Hug.js | 3 +-- src/models/schemas/Kick.js | 3 +-- src/models/schemas/Kill.js | 3 +-- src/models/schemas/Kissu.js | 3 +-- src/models/schemas/Laugh.js | 3 +-- src/models/schemas/Lick.js | 3 +-- src/models/schemas/Love.js | 3 +-- src/models/schemas/Lurk.js | 3 +-- src/models/schemas/Midfing.js | 3 +-- src/models/schemas/Nervous.js | 3 +-- src/models/schemas/Nom.js | 3 +-- src/models/schemas/Nope.js | 3 +-- src/models/schemas/Nuzzle.js | 3 +-- src/models/schemas/Panic.js | 3 +-- src/models/schemas/Pat.js | 3 +-- src/models/schemas/Peck.js | 3 +-- src/models/schemas/Poke.js | 3 +-- src/models/schemas/Pout.js | 3 +-- src/models/schemas/Punch.js | 3 +-- src/models/schemas/Run.js | 3 +-- src/models/schemas/Sad.js | 3 +-- src/models/schemas/Shoot.js | 3 +-- src/models/schemas/Shrug.js | 3 +-- src/models/schemas/Sip.js | 3 +-- src/models/schemas/Slap.js | 3 +-- src/models/schemas/Sleepy.js | 3 +-- src/models/schemas/Smile.js | 3 +-- src/models/schemas/Smug.js | 3 +-- src/models/schemas/Stab.js | 3 +-- src/models/schemas/Stare.js | 3 +-- src/models/schemas/Suicide.js | 3 +-- src/models/schemas/Tease.js | 3 +-- src/models/schemas/Think.js | 3 +-- src/models/schemas/Thumbsup.js | 3 +-- src/models/schemas/Tickle.js | 3 +-- src/models/schemas/Triggered.js | 3 +-- src/models/schemas/Wag.js | 3 +-- src/models/schemas/Wave.js | 3 +-- src/models/schemas/Wink.js | 2 +- 63 files changed, 63 insertions(+), 125 deletions(-) diff --git a/src/models/schemas/Angry.js b/src/models/schemas/Angry.js index d07b36a..63ba8ca 100644 --- a/src/models/schemas/Angry.js +++ b/src/models/schemas/Angry.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const AngrySchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Angry', AngrySchema); - diff --git a/src/models/schemas/Baka.js b/src/models/schemas/Baka.js index 7170d80..ab3e397 100644 --- a/src/models/schemas/Baka.js +++ b/src/models/schemas/Baka.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const BakaSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Baka', BakaSchema); - diff --git a/src/models/schemas/Bite.js b/src/models/schemas/Bite.js index e9779cc..217daf1 100644 --- a/src/models/schemas/Bite.js +++ b/src/models/schemas/Bite.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const BiteSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Bite', BiteSchema); - diff --git a/src/models/schemas/Blush.js b/src/models/schemas/Blush.js index 3c93b45..ee0c99d 100644 --- a/src/models/schemas/Blush.js +++ b/src/models/schemas/Blush.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const BlushSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Blush', BlushSchema); - diff --git a/src/models/schemas/Bonk.js b/src/models/schemas/Bonk.js index 2ccf49f..600179b 100644 --- a/src/models/schemas/Bonk.js +++ b/src/models/schemas/Bonk.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const BonkSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Bonk', BonkSchema); - diff --git a/src/models/schemas/Bored.js b/src/models/schemas/Bored.js index 8c55c62..04b859a 100644 --- a/src/models/schemas/Bored.js +++ b/src/models/schemas/Bored.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const BoredSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Bored', BoredSchema); - diff --git a/src/models/schemas/Bully.js b/src/models/schemas/Bully.js index 31a4a0c..8700f5b 100644 --- a/src/models/schemas/Bully.js +++ b/src/models/schemas/Bully.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const BullySchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Bully', BullySchema); - diff --git a/src/models/schemas/Bye.js b/src/models/schemas/Bye.js index d847743..e11a21d 100644 --- a/src/models/schemas/Bye.js +++ b/src/models/schemas/Bye.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const ByeSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Bye', ByeSchema); - diff --git a/src/models/schemas/Chase.js b/src/models/schemas/Chase.js index a3c33da..74a3f8e 100644 --- a/src/models/schemas/Chase.js +++ b/src/models/schemas/Chase.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const ChaseSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Chase', ChaseSchema); - diff --git a/src/models/schemas/Cheer.js b/src/models/schemas/Cheer.js index 01274fb..db560b8 100644 --- a/src/models/schemas/Cheer.js +++ b/src/models/schemas/Cheer.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const CheerSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Cheer', CheerSchema); - diff --git a/src/models/schemas/Cringe.js b/src/models/schemas/Cringe.js index a6860f7..ee02ee3 100644 --- a/src/models/schemas/Cringe.js +++ b/src/models/schemas/Cringe.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const CringeSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Cringe', CringeSchema); - diff --git a/src/models/schemas/Cry.js b/src/models/schemas/Cry.js index cd328a4..ae324e4 100644 --- a/src/models/schemas/Cry.js +++ b/src/models/schemas/Cry.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const CrySchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Cry', CrySchema); - diff --git a/src/models/schemas/Cuddle.js b/src/models/schemas/Cuddle.js index 18e90be..8e8b023 100644 --- a/src/models/schemas/Cuddle.js +++ b/src/models/schemas/Cuddle.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const CuddleSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Cuddle', CuddleSchema); - diff --git a/src/models/schemas/Dab.js b/src/models/schemas/Dab.js index 4eaea99..27ad202 100644 --- a/src/models/schemas/Dab.js +++ b/src/models/schemas/Dab.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const DabSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Dab', DabSchema); - diff --git a/src/models/schemas/Dance.js b/src/models/schemas/Dance.js index 90c0ad3..a306c16 100644 --- a/src/models/schemas/Dance.js +++ b/src/models/schemas/Dance.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const DanceSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Dance', DanceSchema); - diff --git a/src/models/schemas/Die.js b/src/models/schemas/Die.js index e1b2d90..51fe1f4 100644 --- a/src/models/schemas/Die.js +++ b/src/models/schemas/Die.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const DieSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Die', DieSchema); - diff --git a/src/models/schemas/Disgust.js b/src/models/schemas/Disgust.js index 2fe2e14..8c09b5a 100644 --- a/src/models/schemas/Disgust.js +++ b/src/models/schemas/Disgust.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const DisgustSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Disgust', DisgustSchema); - diff --git a/src/models/schemas/Facepalm.js b/src/models/schemas/Facepalm.js index 6d1d1e9..34921df 100644 --- a/src/models/schemas/Facepalm.js +++ b/src/models/schemas/Facepalm.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const FacepalmSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Facepalm', FacepalmSchema); - diff --git a/src/models/schemas/Feed.js b/src/models/schemas/Feed.js index 63d1838..4ea7862 100644 --- a/src/models/schemas/Feed.js +++ b/src/models/schemas/Feed.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const FeedSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Feed', FeedSchema); - diff --git a/src/models/schemas/Glomp.js b/src/models/schemas/Glomp.js index 5972c29..447fae4 100644 --- a/src/models/schemas/Glomp.js +++ b/src/models/schemas/Glomp.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const GlompSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Glomp', GlompSchema); - diff --git a/src/models/schemas/Happy.js b/src/models/schemas/Happy.js index 245fb57..7ff4bfa 100644 --- a/src/models/schemas/Happy.js +++ b/src/models/schemas/Happy.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const HappySchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Happy', HappySchema); - diff --git a/src/models/schemas/Hi.js b/src/models/schemas/Hi.js index 73eed45..c872e50 100644 --- a/src/models/schemas/Hi.js +++ b/src/models/schemas/Hi.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const HiSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Hi', HiSchema); - diff --git a/src/models/schemas/Highfive.js b/src/models/schemas/Highfive.js index 1260672..e4b67c9 100644 --- a/src/models/schemas/Highfive.js +++ b/src/models/schemas/Highfive.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const HighfiveSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Highfive', HighfiveSchema); - diff --git a/src/models/schemas/Hold.js b/src/models/schemas/Hold.js index 91c1c3a..10e5159 100644 --- a/src/models/schemas/Hold.js +++ b/src/models/schemas/Hold.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const HoldSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Hold', HoldSchema); - diff --git a/src/models/schemas/Hug.js b/src/models/schemas/Hug.js index 1efa54f..d011f1d 100644 --- a/src/models/schemas/Hug.js +++ b/src/models/schemas/Hug.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const HugSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Hug', HugSchema); - diff --git a/src/models/schemas/Kick.js b/src/models/schemas/Kick.js index c2c7254..95edf11 100644 --- a/src/models/schemas/Kick.js +++ b/src/models/schemas/Kick.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const KickSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Kick', KickSchema); - diff --git a/src/models/schemas/Kill.js b/src/models/schemas/Kill.js index fbd441f..fddaa23 100644 --- a/src/models/schemas/Kill.js +++ b/src/models/schemas/Kill.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const KillSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Kill', KillSchema); - diff --git a/src/models/schemas/Kissu.js b/src/models/schemas/Kissu.js index c2603f1..8fb91dd 100644 --- a/src/models/schemas/Kissu.js +++ b/src/models/schemas/Kissu.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const KissuSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Kissu', KissuSchema); - diff --git a/src/models/schemas/Laugh.js b/src/models/schemas/Laugh.js index 6fcdf54..82091bc 100644 --- a/src/models/schemas/Laugh.js +++ b/src/models/schemas/Laugh.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const LaughSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Laugh', LaughSchema); - diff --git a/src/models/schemas/Lick.js b/src/models/schemas/Lick.js index 7e5526a..d78b7f0 100644 --- a/src/models/schemas/Lick.js +++ b/src/models/schemas/Lick.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const LickSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Lick', LickSchema); - diff --git a/src/models/schemas/Love.js b/src/models/schemas/Love.js index a47119b..0121a0a 100644 --- a/src/models/schemas/Love.js +++ b/src/models/schemas/Love.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const LoveSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Love', LoveSchema); - diff --git a/src/models/schemas/Lurk.js b/src/models/schemas/Lurk.js index 77b53c7..f4d746d 100644 --- a/src/models/schemas/Lurk.js +++ b/src/models/schemas/Lurk.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const LurkSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Lurk', LurkSchema); - diff --git a/src/models/schemas/Midfing.js b/src/models/schemas/Midfing.js index 905f037..0bf79a8 100644 --- a/src/models/schemas/Midfing.js +++ b/src/models/schemas/Midfing.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const MidfingSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Midfing', MidfingSchema); - diff --git a/src/models/schemas/Nervous.js b/src/models/schemas/Nervous.js index 4cc18a1..0f690bc 100644 --- a/src/models/schemas/Nervous.js +++ b/src/models/schemas/Nervous.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const NervousSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Nervous', NervousSchema); - diff --git a/src/models/schemas/Nom.js b/src/models/schemas/Nom.js index e0ee996..c3ea140 100644 --- a/src/models/schemas/Nom.js +++ b/src/models/schemas/Nom.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const NomSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Nom', NomSchema); - diff --git a/src/models/schemas/Nope.js b/src/models/schemas/Nope.js index 933b78c..b825ebd 100644 --- a/src/models/schemas/Nope.js +++ b/src/models/schemas/Nope.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const NopeSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Nope', NopeSchema); - diff --git a/src/models/schemas/Nuzzle.js b/src/models/schemas/Nuzzle.js index c7d0d52..b7e4342 100644 --- a/src/models/schemas/Nuzzle.js +++ b/src/models/schemas/Nuzzle.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const NuzzleSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Nuzzle', NuzzleSchema); - diff --git a/src/models/schemas/Panic.js b/src/models/schemas/Panic.js index bc56563..e102dc4 100644 --- a/src/models/schemas/Panic.js +++ b/src/models/schemas/Panic.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const PanicSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Panic', PanicSchema); - diff --git a/src/models/schemas/Pat.js b/src/models/schemas/Pat.js index 4f23c59..c4aafa2 100644 --- a/src/models/schemas/Pat.js +++ b/src/models/schemas/Pat.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const PatSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Pat', PatSchema); - diff --git a/src/models/schemas/Peck.js b/src/models/schemas/Peck.js index ef146b6..5e904b7 100644 --- a/src/models/schemas/Peck.js +++ b/src/models/schemas/Peck.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const PeckSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Peck', PeckSchema); - diff --git a/src/models/schemas/Poke.js b/src/models/schemas/Poke.js index 924d5c9..128a11e 100644 --- a/src/models/schemas/Poke.js +++ b/src/models/schemas/Poke.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const PokeSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Poke', PokeSchema); - diff --git a/src/models/schemas/Pout.js b/src/models/schemas/Pout.js index cf08cef..0519a5c 100644 --- a/src/models/schemas/Pout.js +++ b/src/models/schemas/Pout.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const PoutSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Pout', PoutSchema); - diff --git a/src/models/schemas/Punch.js b/src/models/schemas/Punch.js index 6e44d36..7d715ac 100644 --- a/src/models/schemas/Punch.js +++ b/src/models/schemas/Punch.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const PunchSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Punch', PunchSchema); - diff --git a/src/models/schemas/Run.js b/src/models/schemas/Run.js index 4ae898f..1cdd27a 100644 --- a/src/models/schemas/Run.js +++ b/src/models/schemas/Run.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const RunSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Run', RunSchema); - diff --git a/src/models/schemas/Sad.js b/src/models/schemas/Sad.js index a2575c5..831d687 100644 --- a/src/models/schemas/Sad.js +++ b/src/models/schemas/Sad.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const SadSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Sad', SadSchema); - diff --git a/src/models/schemas/Shoot.js b/src/models/schemas/Shoot.js index 497bf3b..65831c6 100644 --- a/src/models/schemas/Shoot.js +++ b/src/models/schemas/Shoot.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const ShootSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Shoot', ShootSchema); - diff --git a/src/models/schemas/Shrug.js b/src/models/schemas/Shrug.js index d45f88e..e273df3 100644 --- a/src/models/schemas/Shrug.js +++ b/src/models/schemas/Shrug.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const ShrugSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Shrug', ShrugSchema); - diff --git a/src/models/schemas/Sip.js b/src/models/schemas/Sip.js index d2cc6d0..ebae89d 100644 --- a/src/models/schemas/Sip.js +++ b/src/models/schemas/Sip.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const SipSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Sip', SipSchema); - diff --git a/src/models/schemas/Slap.js b/src/models/schemas/Slap.js index de1ffde..088fc52 100644 --- a/src/models/schemas/Slap.js +++ b/src/models/schemas/Slap.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const SlapSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Slap', SlapSchema); - diff --git a/src/models/schemas/Sleepy.js b/src/models/schemas/Sleepy.js index 85fa26d..b522310 100644 --- a/src/models/schemas/Sleepy.js +++ b/src/models/schemas/Sleepy.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const SleepySchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Sleepy', SleepySchema); - diff --git a/src/models/schemas/Smile.js b/src/models/schemas/Smile.js index 8b74524..212bea9 100644 --- a/src/models/schemas/Smile.js +++ b/src/models/schemas/Smile.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const SmileSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Smile', SmileSchema); - diff --git a/src/models/schemas/Smug.js b/src/models/schemas/Smug.js index 5467a87..3b63510 100644 --- a/src/models/schemas/Smug.js +++ b/src/models/schemas/Smug.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const SmugSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Smug', SmugSchema); - diff --git a/src/models/schemas/Stab.js b/src/models/schemas/Stab.js index c2e942b..117534d 100644 --- a/src/models/schemas/Stab.js +++ b/src/models/schemas/Stab.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const StabSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Stab', StabSchema); - diff --git a/src/models/schemas/Stare.js b/src/models/schemas/Stare.js index 4201df9..e8ebfdc 100644 --- a/src/models/schemas/Stare.js +++ b/src/models/schemas/Stare.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const StareSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Stare', StareSchema); - diff --git a/src/models/schemas/Suicide.js b/src/models/schemas/Suicide.js index 709b9f7..af2821f 100644 --- a/src/models/schemas/Suicide.js +++ b/src/models/schemas/Suicide.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const SuicideSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Suicide', SuicideSchema); - diff --git a/src/models/schemas/Tease.js b/src/models/schemas/Tease.js index 331e870..3348f43 100644 --- a/src/models/schemas/Tease.js +++ b/src/models/schemas/Tease.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const TeaseSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Tease', TeaseSchema); - diff --git a/src/models/schemas/Think.js b/src/models/schemas/Think.js index 055f982..2f09f16 100644 --- a/src/models/schemas/Think.js +++ b/src/models/schemas/Think.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const ThinkSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Think', ThinkSchema); - diff --git a/src/models/schemas/Thumbsup.js b/src/models/schemas/Thumbsup.js index 6537d2e..117e713 100644 --- a/src/models/schemas/Thumbsup.js +++ b/src/models/schemas/Thumbsup.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const ThumbsupSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Thumbsup', ThumbsupSchema); - diff --git a/src/models/schemas/Tickle.js b/src/models/schemas/Tickle.js index 9fbc747..b432831 100644 --- a/src/models/schemas/Tickle.js +++ b/src/models/schemas/Tickle.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const TickleSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Tickle', TickleSchema); - diff --git a/src/models/schemas/Triggered.js b/src/models/schemas/Triggered.js index 451f205..e9ed1af 100644 --- a/src/models/schemas/Triggered.js +++ b/src/models/schemas/Triggered.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const TriggeredSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Triggered', TriggeredSchema); - diff --git a/src/models/schemas/Wag.js b/src/models/schemas/Wag.js index 7e7a624..fa4c84c 100644 --- a/src/models/schemas/Wag.js +++ b/src/models/schemas/Wag.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const WagSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Wag', WagSchema); - diff --git a/src/models/schemas/Wave.js b/src/models/schemas/Wave.js index ba293b0..03f7e50 100644 --- a/src/models/schemas/Wave.js +++ b/src/models/schemas/Wave.js @@ -3,8 +3,7 @@ const { Schema, model } = mongoose; const WaveSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Wave', WaveSchema); - diff --git a/src/models/schemas/Wink.js b/src/models/schemas/Wink.js index 8cc8209..4b87098 100644 --- a/src/models/schemas/Wink.js +++ b/src/models/schemas/Wink.js @@ -3,7 +3,7 @@ const { Schema, model } = mongoose; const WinkSchema = new Schema({ _id: { type: Number }, - url: { type: String, required: true }, + url: { type: String, required: true, unique: true }, }); export default model('Wink', WinkSchema); From 0d0bb48baeddb7790009b918d4f0ef75fc6456a0 Mon Sep 17 00:00:00 2001 From: kyrea Date: Mon, 25 Nov 2024 01:39:53 +0530 Subject: [PATCH 2/4] Added NEW getUser and processUserSessionAndUpdate routes --- src/routes/v4/internal/user.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/routes/v4/internal/user.js b/src/routes/v4/internal/user.js index 8319fcf..c000a0a 100644 --- a/src/routes/v4/internal/user.js +++ b/src/routes/v4/internal/user.js @@ -1,5 +1,10 @@ import { Router } from 'express'; -import { userEndpoint, retrieveUserProfile, updateUserToken } from '../../../controllers/v4/internal/user.js'; +import { + retrieveUserProfile, + updateUserToken, + processUserSessionAndUpdate, + getUser, +} from '../../../controllers/v4/internal/user.js'; import createRateLimiter from '../../../middlewares/rateLimit.js'; const router = Router(); @@ -31,7 +36,8 @@ router * @apiSuccess {function} middleware Express middleware function that handles rate limiting. * */ - .post(createRateLimiter(), userEndpoint); + .post(createRateLimiter(), processUserSessionAndUpdate) + .get(createRateLimiter(), getUser); router .route('/profile/:id') From 1bd925b122bfe3d48a530462631e371b3b60b65b Mon Sep 17 00:00:00 2001 From: kyrea Date: Mon, 25 Nov 2024 01:41:21 +0530 Subject: [PATCH 3/4] Refactor user session handling and update endpoints to v4 API --- src/controllers/v4/internal/user.js | 144 ++++++++++++++++++---------- 1 file changed, 92 insertions(+), 52 deletions(-) diff --git a/src/controllers/v4/internal/user.js b/src/controllers/v4/internal/user.js index b8a2c7c..f69a0ac 100644 --- a/src/controllers/v4/internal/user.js +++ b/src/controllers/v4/internal/user.js @@ -61,81 +61,121 @@ const updateUserToken = async (req, res, next) => { }; /** - * Handles user-related operations based on the HTTP method. + * Processes user session by creating a new user if one doesn't exist, + * updating tokens if applicable, and handling authentication. * - * @param {Object} req - Express request object. - * @param {Object} res - Express response object. - * @param {Function} next - Express next middleware function. + * @param {Object} req - Express request object containing headers and body. + * @param {Object} res - Express response object for sending responses. + * @param {Function} next - Express next middleware function for error handling. + * @returns {Object} - JSON response indicating success or failure. */ -const userEndpoint = async (req, res, next) => { +const processUserSessionAndUpdate = async (req, res, next) => { try { - const { body, headers, method } = req; + const { headers, body } = req; + const { token, id, email, 'access-token': access_token } = body; const { key } = headers; - // Check for valid access key in headers + // Validate access key if (!key || key !== process.env.ACCESS_KEY) { - return res.status(401).json({ - message: 'Unauthorized', - }); + return res.status(401).json({ message: 'Unauthorized' }); } - if (method === 'POST') { - const { token, id } = body; + // Validate User ID + if (!id) { + return res.status(400).json({ message: 'User ID is required' }); + } - // Check for required fields in the request body - if (!token || !id) { + // Check if the user exists + const existingUser = await Users.findOne({ _id: id }); + + if (!existingUser) { + // If the user doesn't exist, ensure required fields are provided + if (!email || !access_token) { return res.status(400).json({ - message: 'Token and User ID are required in the request body', + message: 'Email and access-token are required for new users', }); } - // Update user's token in the database - await Users.updateOne( - { _id: { $eq: id } }, - { $set: { token: token } }, - { upsert: true }, // Create the document if it doesn't exist - ); - - return res.status(200).json({ - message: 'Token updated successfully', + // Create a new user with a generated token + const generatedToken = generateToken(id, process.env.HMAC_KEY); + const newUser = { + _id: id, + email, + token: generatedToken, + access_token, + password: crypto.randomBytes(22).toString('base64'), // Generate a random password + }; + + await Users.create(newUser); + + return res.status(201).json({ + message: 'User created successfully', + token: newUser.token, }); - } else if (method === 'GET') { - const { id, email } = headers; + } else { + // If the user exists, update the token if provided, and access-token if available + const updates = {}; + if (token) updates.token = token; + if (access_token) updates.access_token = access_token; - // Check for required User ID in the headers - if (!id) { - return res.status(400).json({ - message: 'User ID missing in the request body', - }); + if (Object.keys(updates).length > 0) { + await Users.updateOne({ _id: id }, { $set: updates }); } - // Fetch user details based on the provided user ID - const user = await Users.findOne({ _id: { $eq: id } }); + if (token) { + return res.status(200).json({ message: 'Token updated successfully', token: token }); + } else { + return res.status(200).json({ message: 'Logging successfully', token: existingUser.token }); + } + } + } catch (error) { + console.error('Error in processUserSessionAndUpdate :', error.message); + return next(error); + } +}; - if (!user) { - // If user not found, create a new user with the provided ID and token - const newUser = { - _id: id, - email: email, - password: crypto.randomBytes(22).toString('base64'), - token: generateToken(id, process.env.HMAC_KEY), - // Add other fields in the "newUser" object based on your schema - }; +/** + * Fetches user data by ID, validates the access key, and updates the access token if provided. + * + * @param {Object} req - Express request object containing headers. + * @param {Object} res - Express response object for sending responses. + * @param {Function} next - Express next middleware function for error handling. + * @returns {Object} - JSON response with user token or error message. + */ +const getUser = async (req, res, next) => { + try { + const { headers } = req; + const { key } = headers; - await Users.create(newUser); + // Validate access key + if (!key || key !== process.env.ACCESS_KEY) { + return res.status(401).json({ message: 'Unauthorized' }); + } - return res.status(201).json(newUser.token); - } + const { id, email, 'access-token': access_token } = headers; - return res.status(200).json(user.token); - } else { - return res.status(405).json({ - message: 'Method Not Allowed', - }); + // Validate User ID + if (!id) { + return res.status(400).json({ message: 'User ID is required' }); + } + + // Find user by ID + const user = await Users.findOne({ _id: id }); + + if (!user) { + return res.status(404).json({ message: 'User not found' }); } + + // Update user's access token + if (access_token) { + await Users.updateOne({ _id: id }, { $set: { access_token } }); + } + + return res.status(200).json({ token: user.token }); } catch (error) { - return next(error); + console.error('Error in getUser:', error.message); + return res.status(500).json({ message: 'Internal Server Error' }); } }; -export { userEndpoint, retrieveUserProfile, updateUserToken }; +export { retrieveUserProfile, updateUserToken, processUserSessionAndUpdate, getUser }; From ab6ebc8da3d55fc2af307c6cf06a10b40bea0934 Mon Sep 17 00:00:00 2001 From: kyrea Date: Mon, 25 Nov 2024 01:51:57 +0530 Subject: [PATCH 4/4] Bumped the version --- package-lock.json | 203 ++++++++++++++++++++++++---------------------- package.json | 2 +- 2 files changed, 108 insertions(+), 97 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7f3c23b..e324dee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "waifu.it", - "version": "4.7.0", + "version": "4.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "waifu.it", - "version": "4.7.0", + "version": "4.8.0", "license": "AGPLv3", "dependencies": { "chalk": "^4.1.2", @@ -40,9 +40,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.0.tgz", - "integrity": "sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw==", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.0.tgz", + "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", "dev": true, "dependencies": { "regenerator-runtime": "^0.14.0" @@ -88,11 +88,11 @@ } }, "node_modules/@types/node": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.1.0.tgz", - "integrity": "sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw==", + "version": "22.9.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.3.tgz", + "integrity": "sha512-F3u1fs/fce3FFk+DAxbxc78DF8x0cY09RRL8GnXLmkJ1jvx3TtPdWoTT5/NiYfI5ASqXBmfqJi9dZ3gxMx4lzw==", "dependencies": { - "undici-types": "~6.13.0" + "undici-types": "~6.19.8" } }, "node_modules/@types/triple-beam": { @@ -153,9 +153,9 @@ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, "node_modules/async": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", - "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==" }, "node_modules/asynckit": { "version": "0.4.0", @@ -214,9 +214,9 @@ "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" }, "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.5", @@ -226,7 +226,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.11.0", + "qs": "6.13.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -562,9 +562,9 @@ } }, "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", "engines": { "node": ">= 0.6" } @@ -708,9 +708,9 @@ "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==" }, "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "engines": { "node": ">= 0.8" } @@ -735,9 +735,9 @@ } }, "node_modules/escalade": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", - "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, "engines": { "node": ">=6" @@ -765,36 +765,36 @@ } }, "node_modules/express": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "version": "4.21.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.1.tgz", + "integrity": "sha512-YSFlK1Ee0/GC8QaO91tHcDxJiE/X4FbpAyQWkxAvG6AXCuR65YzK8ua6D9hvi/TzUfZMpc+BwuM1IPw8fmQBiQ==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.2", + "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.6.0", + "cookie": "0.7.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.2.0", + "finalhandler": "1.3.1", "fresh": "0.5.2", "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", + "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", + "path-to-regexp": "0.1.10", "proxy-addr": "~2.0.7", - "qs": "6.11.0", + "qs": "6.13.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", + "send": "0.19.0", + "serve-static": "1.16.2", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", @@ -922,12 +922,12 @@ } }, "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", "dependencies": { "debug": "2.6.9", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", @@ -944,9 +944,9 @@ "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" }, "node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.2.tgz", + "integrity": "sha512-sJe+TQb2vIaIyO783qN6BlMYWMw3WBOHA1Ay2qxsnjuafEOQFJ2JakedOQirT6D5XPRxDvS7AHYyem9fTpb4LQ==", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -1302,9 +1302,9 @@ } }, "node_modules/logform": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/logform/-/logform-2.6.1.tgz", - "integrity": "sha512-CdaO738xRapbKIMVn2m4F6KTj4j7ooJ8POVnebSgKo3KBz5axNXRAL7ZdRjIV6NOr2Uf4vjtRkxrFETOioCqSA==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.7.0.tgz", + "integrity": "sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ==", "dependencies": { "@colors/colors": "1.6.0", "@types/triple-beam": "^1.3.2", @@ -1345,9 +1345,12 @@ "optional": true }, "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/methods": { "version": "1.1.2", @@ -1571,9 +1574,9 @@ } }, "node_modules/nodemon": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.4.tgz", - "integrity": "sha512-wjPBbFhtpJwmIeY2yP7QF+UKzPfltVGtfce1g/bB15/8vCGZj8uxD62b/b9M9/WVgme0NZudpownKN+c0plXlQ==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.7.tgz", + "integrity": "sha512-hLj7fuMow6f0lbB0cD14Lz2xNjwsyruH251Pk4t/yIitCFJbmY1myuLlHm/q06aST4jg6EgAh74PIBBrRqpVAQ==", "dev": true, "dependencies": { "chokidar": "^3.5.2", @@ -1599,12 +1602,12 @@ } }, "node_modules/nodemon/node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -1625,9 +1628,9 @@ } }, "node_modules/nodemon/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "node_modules/nodemon/node_modules/supports-color": { @@ -1668,9 +1671,9 @@ } }, "node_modules/object-inspect": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", - "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "version": "1.13.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz", + "integrity": "sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==", "engines": { "node": ">= 0.4" }, @@ -1790,9 +1793,9 @@ } }, "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", + "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -1853,11 +1856,11 @@ "dev": true }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -2008,9 +2011,9 @@ ] }, "node_modules/safe-stable-stringify": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", - "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", "engines": { "node": ">=10" } @@ -2045,9 +2048,9 @@ } }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", @@ -2067,6 +2070,14 @@ "node": ">= 0.8.0" } }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/send/node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -2088,14 +2099,14 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "dependencies": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.18.0" + "send": "0.19.0" }, "engines": { "node": ">= 0.8.0" @@ -2319,9 +2330,9 @@ } }, "node_modules/tslib": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true }, "node_modules/type-is": { @@ -2343,9 +2354,9 @@ "dev": true }, "node_modules/undici-types": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.13.0.tgz", - "integrity": "sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==" + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" }, "node_modules/unpipe": { "version": "1.0.0", @@ -2412,21 +2423,21 @@ } }, "node_modules/winston": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.13.1.tgz", - "integrity": "sha512-SvZit7VFNvXRzbqGHsv5KSmgbEYR5EiQfDAL9gxYkRqa934Hnk++zze0wANKtMHcy/gI4W/3xmSDwlhf865WGw==", + "version": "3.17.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.17.0.tgz", + "integrity": "sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw==", "dependencies": { "@colors/colors": "^1.6.0", "@dabh/diagnostics": "^2.0.2", "async": "^3.2.3", "is-stream": "^2.0.0", - "logform": "^2.6.0", + "logform": "^2.7.0", "one-time": "^1.0.0", "readable-stream": "^3.4.0", "safe-stable-stringify": "^2.3.1", "stack-trace": "0.0.x", "triple-beam": "^1.3.0", - "winston-transport": "^4.7.0" + "winston-transport": "^4.9.0" }, "engines": { "node": ">= 12.0.0" @@ -2450,11 +2461,11 @@ } }, "node_modules/winston-transport": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.7.1.tgz", - "integrity": "sha512-wQCXXVgfv/wUPOfb2x0ruxzwkcZfxcktz6JIMUaPLmcNhO4bZTwA/WtDWK74xV3F2dKu8YadrFv0qhwYjVEwhA==", + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.9.0.tgz", + "integrity": "sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==", "dependencies": { - "logform": "^2.6.1", + "logform": "^2.7.0", "readable-stream": "^3.6.2", "triple-beam": "^1.3.0" }, diff --git a/package.json b/package.json index a5a8ab5..c9b3269 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "waifu.it", - "version": "4.7.0", + "version": "4.8.0", "description": "Random API Serving Anime stuff", "author": "Aeryk", "private": true,