diff --git a/client-next/public/js/particles-config.js b/client-next/public/js/particles-config.js new file mode 100644 index 0000000..ffca089 --- /dev/null +++ b/client-next/public/js/particles-config.js @@ -0,0 +1,42 @@ +particlesJS('background', { + particles: { + number: { value: 80, density: { enable: true, value_area: 800 } }, + color: { value: '#ffffff' }, + shape: { type: 'circle' }, + opacity: { + value: 0.5, + random: false, + anim: { enable: false } + }, + size: { + value: 3, + random: true, + anim: { enable: false } + }, + line_linked: { + enable: true, + distance: 150, + color: '#ffffff', + opacity: 0.4, + width: 1 + }, + move: { + enable: true, + speed: 6, + direction: 'none', + random: false, + straight: false, + out_mode: 'out', + bounce: false + } + }, + interactivity: { + detect_on: 'canvas', + events: { + onhover: { enable: true, mode: 'repulse' }, + onclick: { enable: true, mode: 'push' }, + resize: true + } + }, + retina_detect: true + }); \ No newline at end of file diff --git a/client/js/avatar.js b/client/js/avatar.js index 97fd905..061dcad 100644 --- a/client/js/avatar.js +++ b/client/js/avatar.js @@ -310,6 +310,7 @@ function updateWearButton(type, itemId, isWearing) { function loadUserAvatar() { const token = localStorage.getItem('token'); + console.log("hahaahsha"); $.ajax({ url: '/api/avatar', method: 'GET', @@ -318,10 +319,8 @@ function loadUserAvatar() { }, success: function (avatar) { if (avatar.shirt && avatar.shirt._id) { - updateAvatarDisplay('shirt', avatar.shirt); - updateCurrentlyWearing('shirt', avatar.shirt); - updateWearButton('shirt', avatar.shirt._id, true); - } + wearItem('shirt', avatar.shirtId); + } }, error: function (xhr, status, error) { console.error('Error loading avatar:', error); diff --git a/server/functions/api/models/User.js b/server/functions/api/models/User.js index 58762e9..a056dd1 100644 --- a/server/functions/api/models/User.js +++ b/server/functions/api/models/User.js @@ -38,6 +38,15 @@ const userSchema = new mongoose.Schema({ verificationToken: { type: String, }, + avatar: { + shirt: { type: mongoose.Schema.Types.ObjectId, ref: 'Asset', default: null }, + pants: { type: mongoose.Schema.Types.ObjectId, ref: 'Asset', default: null }, + hat: { type: mongoose.Schema.Types.ObjectId, ref: 'Asset', default: null }, + gear: { type: mongoose.Schema.Types.ObjectId, ref: 'Asset', default: null }, + heads: { type: mongoose.Schema.Types.ObjectId, ref: 'Asset', default: null }, + face: { type: mongoose.Schema.Types.ObjectId, ref: 'Asset', default: null }, + tshirts: { type: mongoose.Schema.Types.ObjectId, ref: 'Asset', default: null } + }, signupDate: { type: Date, default: () => moment().tz('America/New_York').toDate(), diff --git a/server/functions/api/routes/avatar.js b/server/functions/api/routes/avatar.js index ed13270..75e9698 100644 --- a/server/functions/api/routes/avatar.js +++ b/server/functions/api/routes/avatar.js @@ -7,6 +7,9 @@ const Asset = require('../models/Asset'); // Get current avatar router.get('/', authenticateToken, async (req, res) => { + res.set('Cache-Control', 'no-cache'); + res.set('Pragma', 'no-cache'); + res.set('Expires', '0'); try { console.log('Fetching avatar for userId:', req.user.userId); const user = await User.findOne({ userId: req.user.userId }).select('avatar'); @@ -96,4 +99,4 @@ router.put('/', authenticateToken, async (req, res) => { } }); -module.exports = router; \ No newline at end of file +module.exports = router;