-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New database migration and upcoming 3.0.0 WIP
- Loading branch information
Showing
18 changed files
with
439 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,6 @@ node_modules | |
ssl | ||
.env | ||
gencert.sh | ||
gencert.bat | ||
npm-debug.log | ||
AutoConfig.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"defaultEnv": "local", | ||
"local": { | ||
"driver": "mysql", | ||
"user": { | ||
"ENV": "DB_USER" | ||
}, | ||
"password": { | ||
"ENV": "DB_PASS" | ||
}, | ||
"database": { | ||
"ENV": "DB_NAME" | ||
}, | ||
"host": { | ||
"ENV": "DB_HOST" | ||
}, | ||
"port": { | ||
"ENV": "DB_PORT" | ||
}, | ||
"multipleStatements": true | ||
}, | ||
"sql-file": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
'use strict'; | ||
|
||
var dbm; | ||
var type; | ||
var seed; | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var Promise; | ||
|
||
/** | ||
* We receive the dbmigrate dependency from dbmigrate initially. | ||
* This enables us to not have to rely on NODE_PATH. | ||
*/ | ||
exports.setup = function (options, seedLink) { | ||
dbm = options.dbmigrate; | ||
type = dbm.dataType; | ||
seed = seedLink; | ||
Promise = options.Promise; | ||
}; | ||
|
||
exports.up = function (db) { | ||
var filePath = path.join(__dirname, 'sqls', '20230226134401-v3-up.sql'); | ||
return new Promise(function (resolve, reject) { | ||
fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) { | ||
if (err) return reject(err); | ||
console.log('received data: ' + data); | ||
|
||
resolve(data); | ||
}); | ||
}) | ||
.then(function (data) { | ||
return db.runSql(data); | ||
}); | ||
}; | ||
|
||
exports.down = function (db) { | ||
var filePath = path.join(__dirname, 'sqls', '20230226134401-v3-down.sql'); | ||
return new Promise(function (resolve, reject) { | ||
fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) { | ||
if (err) return reject(err); | ||
console.log('received data: ' + data); | ||
|
||
resolve(data); | ||
}); | ||
}) | ||
.then(function (data) { | ||
return db.runSql(data); | ||
}); | ||
}; | ||
|
||
exports._meta = { | ||
"version": 1 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
'use strict'; | ||
|
||
var dbm; | ||
var type; | ||
var seed; | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var Promise; | ||
|
||
/** | ||
* We receive the dbmigrate dependency from dbmigrate initially. | ||
* This enables us to not have to rely on NODE_PATH. | ||
*/ | ||
exports.setup = function(options, seedLink) { | ||
dbm = options.dbmigrate; | ||
type = dbm.dataType; | ||
seed = seedLink; | ||
Promise = options.Promise; | ||
}; | ||
|
||
exports.up = function(db) { | ||
var filePath = path.join(__dirname, 'sqls', '20230226183114-v3-data-up.sql'); | ||
return new Promise( function( resolve, reject ) { | ||
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){ | ||
if (err) return reject(err); | ||
console.log('received data: ' + data); | ||
|
||
resolve(data); | ||
}); | ||
}) | ||
.then(function(data) { | ||
return db.runSql(data); | ||
}); | ||
}; | ||
|
||
exports.down = function(db) { | ||
var filePath = path.join(__dirname, 'sqls', '20230226183114-v3-data-down.sql'); | ||
return new Promise( function( resolve, reject ) { | ||
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){ | ||
if (err) return reject(err); | ||
console.log('received data: ' + data); | ||
|
||
resolve(data); | ||
}); | ||
}) | ||
.then(function(data) { | ||
return db.runSql(data); | ||
}); | ||
}; | ||
|
||
exports._meta = { | ||
"version": 1 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "commonjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
Downgrading from version 3.0.0 | ||
https://github.com/ptrumpis/snap-camera-server/releases/tag/v3.0.0 | ||
*/ | ||
ALTER TABLE `lenses` MODIFY COLUMN `mirrored` tinyint(1) unsigned NOT NULL DEFAULT '0'; | ||
ALTER TABLE `unlocks` MODIFY COLUMN `mirrored` tinyint(1) unsigned NOT NULL DEFAULT '0'; | ||
|
||
ALTER TABLE `lenses` DROP COLUMN `web_import`; | ||
ALTER TABLE `unlocks` DROP COLUMN `web_import`; | ||
|
||
DROP TABLE `users`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
Upgrading to version 3.0.0 | ||
https://github.com/ptrumpis/snap-camera-server/releases/tag/v3.0.0 | ||
*/ | ||
ALTER TABLE `lenses` MODIFY COLUMN `mirrored` tinyint(1) unsigned NOT NULL DEFAULT 0; | ||
ALTER TABLE `unlocks` MODIFY COLUMN `mirrored` tinyint(1) unsigned NOT NULL DEFAULT 0; | ||
|
||
ALTER TABLE `lenses` ADD COLUMN `web_import` tinyint(1) unsigned NOT NULL DEFAULT 0; | ||
ALTER TABLE `unlocks` ADD COLUMN `web_import` tinyint(1) unsigned NOT NULL DEFAULT 0; | ||
|
||
CREATE TABLE IF NOT EXISTS `users` ( | ||
`obfuscated_user_slug` varchar(32) NOT NULL, | ||
`user_display_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, | ||
PRIMARY KEY (`obfuscated_user_slug`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* | ||
Downgrading from version 3.0.0 | ||
https://github.com/ptrumpis/snap-camera-server/releases/tag/v3.0.0 | ||
*/ | ||
TRUNCATE TABLE `users`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
/* | ||
Upgrading to version 3.0.0 | ||
https://github.com/ptrumpis/snap-camera-server/releases/tag/v3.0.0 | ||
*/ | ||
|
||
SET NAMES utf8mb4; | ||
|
||
/* Users from static lenses inside ./json */ | ||
INSERT INTO `users` (`obfuscated_user_slug`, `user_display_name`) VALUES | ||
('-ajbF70UJUgEjejohNN56A', 'Paige Piskin'), | ||
('-eyzVOk9ttpPQAOo66lHRA', 'Chania'), | ||
('-F1dFgabW6MqmeOklvGtTg', 'adem'), | ||
('-jYwAMbQOscjfh5HM_cw6w', 'jp pirie'), | ||
('06HmsfvgmQwDgQ_ryQ1ckg', 'Ananda Permata'), | ||
('1fy8Eb21zaKKq4E1epVdtQ', 'Sahda Ardelia'), | ||
('1j_nJyKhfG9mrIjUvyfIKw', 'Ashlesha Malla'), | ||
('31sV2MssC8Nq6ReiwJ6YUQ', 'Natasya 💕'), | ||
('3chbd_ha0QS9wkEWUMYYdA', 'kevinr'), | ||
('3ngPLjXWv9Lb_zok5B1eTg', 'Jennifer Natania✨'), | ||
('5clGW9WsSNVppTmWR_q4Zg', 'City Of Pinellas Park'), | ||
('5Yn3ZlmJ9Mo2jR_Er6Wh-w', 'MAC Cosmetics'), | ||
('65cA6mqs18t8VSHh7gtXLQ', 'alexia♡'), | ||
('6B4QwckvtchOE9uveLfhqQ', 'Beauty Lab'), | ||
('6BKB_s3yj6e8fdBEBqJS0w', '@vvalyya'), | ||
('6dldaUDkFogb-V-fEeTCWw', 'Sunny Bahadurpuria🎥'), | ||
('7HihiPm22AND9EfWih2zUg', 'CyreneQ'), | ||
('7q3Wv3hLZkr5enFqjIliHw', 'sashandiana'), | ||
('7t4m9hgxEP0Ao-eD8g7e0g', 'Mahi 🤍'), | ||
('7tPOwg6qpMrM3BzLUKYDAQ', 'Yug'), | ||
('8bZiHDZ2lkZ_HX8HEK8nqQ', 'prishilla🧜♀️'), | ||
('8jdX8KcovnlkbRZjhMTVhQ', 'Prabhjot Singh'), | ||
('988xFUpkV9_XfFLXC_vg5w', '🔥Michael Sean🔥'), | ||
('9b8Fa6NtVevkpXI5o9YAYQ', 'Preston Little'), | ||
('9ye4ciCKGlDyZVq4-89PRQ', 'Peddler Job'), | ||
('a_tDZXQelvLSavwIBmNe9A', 'Maxim Kuzlin'), | ||
('AJ_yd07DWP7V8neBTDcKrg', '👻s0w_night👁'), | ||
('aJuCWJBVeSn-im02OCy_FQ', 'Thang Tran'), | ||
('AMmg1WVHZfRdEkKp9gDWdw', 'nat🦋'), | ||
('apEDW38RCDkvovnO3qVHaQ', 'ChAR Digital'), | ||
('B_XY2YzrJ6cqDpBqNJ-Uwg', 'natalie suto'), | ||
('b9HrvDyNShO0HZhAediJVw', 'Ger Killeen'), | ||
('bpELY9ZztX991zcutYHsQg', 'ger👻😻👄🐥🌈'), | ||
('C7kwvOcFLQsZ1P9qjTihNg', 'Rakuten Viber'), | ||
('D7aJ6hBd4INVeuP1a_mvmQ', 'Locvs Solvs'), | ||
('D8wQDX1qyGm_bNcGsphTag', 'bangers & mash'), | ||
('DcezIBD_eWYsmX6XCciHEQ', 'Edu Fdz'), | ||
('ddA2N4_PmVXa0of5DfJVbA', 'P4 : ✨'), | ||
('DGk0HFVUxnnqpn5oOSBezQ', 'Radosław'), | ||
('DJCtogUJfROtvv-3Dws5Qg', 'Feliciaangela'), | ||
('DnJzjhdXGRl9ygofG1EpTQ', 'وسـواس 😈'), | ||
('e7Qk8-nhiXWexo9kJQZmVw', 'Malani✨'), | ||
('ebnKbmwtCDHfSSh4X58GJg', 'Tony🤔'), | ||
('fFoWQbarTwv72L8LwTcJCA', 'jasmine w the totoro hoodie pwq'), | ||
('fWd83qqZXsMkdgOzPlyRBg', 'Ruzgar 🇮🇶🇹🇷📷'), | ||
('FYb-NedgP5g16ig7hGfXZA', 'matty.platty'), | ||
('fzsTXYMxQyS8PYkaG9N0Fg', 'call me Pai'), | ||
('HcW9tbmyFJYeORJsKUep6w', 'awesome_paul01'), | ||
('HfIKQOvNby-s1pQuwYHQsg', 'Sergio Ibagy'), | ||
('HHiWlwFRXbkw7hNm13_9NQ', 'Azeem'), | ||
('HLCiJKS15SQ7N2oxZByNpg', 'Henry 🌊'), | ||
('hRA20nRLvMFgIhhbvR0gmA', 'Bakari Mustafa'), | ||
('HyJp0dmsbCR208j34fFylw', 'Juan Catfish'), | ||
('i2BeX240qssrE4fbZmofYw', 'Tim Ventrex'), | ||
('I2hlt1Bl_PfJM4gvEG6YHw', 'Rachel'), | ||
('ivC6Xu3ufT36_utw_NkpMg', 'mueeha ♡'), | ||
('IxESYpTmpSWq8BJ_f1dmBw', 'Jason O'), | ||
('K0QU6iFUeddGbpiM5izL1g', 'Kazumasa Miyauchi'), | ||
('kfYJXQs78H0EbGk-ntF1cw', 'Kriptk'), | ||
('kG5xAaKQpPtZHWuFjlO1RA', 'Sayaka Kikuchi'), | ||
('kseHVh1ATuH4FeHF1PmzTQ', 'Flat Pixel'), | ||
('L4ew0_p_Ud01b_fP8lHwhQ', 'agreeable greg'), | ||
('l51VcJyRafmp35w0ttI9og', 'stevani'), | ||
('LW3sf6dqcWa9clR0ELlEXw', 'Noel Mavrinac (☞゚ヮ゚)☞'), | ||
('m6Kpj4xluplDrxpFz8ZoKA', 'Nazrana ✪'), | ||
('Mgij34SkW7T7Z-ARrSoGWg', 'Rotem F'), | ||
('mPq3_NDaC31-R524-uK2Ug', 'will'), | ||
('N0QpWJsv5ZHaaOxTCxO0Tg', 'Kahi Saleem'), | ||
('nBUDSgxliHuU6azutQk-Nw', 'Ken Ng'), | ||
('ndrEpblpBtLFjomWs-q44g', 'Ilza Duarte'), | ||
('NiG7ufdsgqa35MtDEOJNJA', 'nique ✨'), | ||
('o5Cb1ebdDrOmRsGpACIB5g', 'Amelia'), | ||
('ov5X8QavywNA55BFuqbEng', 'Miguel'), | ||
('OXNLz-Z411bcrcu53FVfiA', 'metha👀'), | ||
('p7xH5th1y_2nBzvKZjgUGw', 'Helen Breznik'), | ||
('pflMoK4gTzRkqw2_hODkzA', 'Jacob Garbarz'), | ||
('puvO75-ufr1vZQ9Th3GcVQ', 'Colleen Maroney'), | ||
('Q-jl1Kan6eQq9RQjQIgxeg', 'Ansh Patel'), | ||
('q3xJv_ERkWnWQKmT754noQ', 'iPhone Prro 📱'), | ||
('Q9itJgTKgQTPcufiZf0Xng', 'Rikkert'), | ||
('qhz_EB_xn9M7kWGgfgnQEw', 'Caroline Charles'), | ||
('qUTSplMPOkdJUtjlh5zhVw', 'Phoebe Layton'), | ||
('R3Znlc7fl9-tavQazMFOrg', 'Omar\'s | 😂 ميمز'), | ||
('R9sxvSrUA5VRSGB62ByzNw', 'Byte'), | ||
('RLkWKrwq3JXCppOD8O3y0Q', 'QReal'), | ||
('RlXGr0LbVhH-Goy0Frg6Dw', 'Queennie M'), | ||
('Rmc0TvS-MHNOuH8RMwvY_Q', 'Sudi'), | ||
('roFDOnm2bDxjyhaK1T1Vgg', 'izaa'), | ||
('RZEkhB4Nnh7d6lz_-anLQQ', 'Phil Walton'), | ||
('s-zTMkHA6zggtdWx8Z6eFA', 'Snap Inc.'), | ||
('s5_Sinjc5zpZmZ1o1wf0dg', 'Under25 NIFT Chennai'), | ||
('T1vsw2vF1U9qprLg3AkbFw', 'G G🖤'), | ||
('T67w4fzjtC_-pbuSobsg3A', 'Rachel'), | ||
('tUPQD4tGMIPsTNitpAvM0A', 'Bahar Erunsal'), | ||
('UAaBpehQUCtNoZ_zeYHG8A', 'Alya🍫'), | ||
('uBCq9WiwqyzorYDsjltcVw', 'taya travo💜'), | ||
('UjBLh89581Qtra3dzsmVNw', 'Shania'), | ||
('uRCohAWP9EFCDvAu4bGzcQ', 'Fiery_Flames'), | ||
('uRztZ-_XuSQVQaDuB06X4Q', 'Dan 🫠🫣🫥'), | ||
('v0dXSkhfcssZwR7RIruE6w', 'Kathy;)'), | ||
('vaJRT7FjIry5NhGfBRs_Aw', 'Grant Shain'), | ||
('Vatv_ZhOy6WrIM9uqQForA', 'Rhonda'), | ||
('vfCTxoJTHUvWJbQK2sh1Uw', 'Peder'), | ||
('vNH1A435pixgdMvBC-jQvQ', 'aram k'), | ||
('Vtc-_iL9xRXQznBrAeqIUA', 'Hayley 😇'), | ||
('WeVzwlHtpzd1PY4gB10v9A', 'justin crx❤️🔥'), | ||
('Wi8X7SUi7OqJEGgPA_Rnbw', 'Lentera'), | ||
('wjLsCc1SzxkKGOebXXc8Xg', 'Under25 AdKh'), | ||
('WptD9bu6UrZkVE_eEwJnUQ', 'jay patel 💸'), | ||
('xK1aYSy1R4i31JI7wIK4kw', 'SHOOQ'), | ||
('XwR0kJCERYQI_9LWFPoIKA', 'KD'), | ||
('XyfVlq_sJVuzkJc4cFzikg', 'Jinnie the Wew'), | ||
('y1e0Zlc4153wwxY2XX2rDw', 'Aoepng'), | ||
('yEoLxdQ2L_tWQNu-cdkeMg', 'Sam Finding'), | ||
('ZB6hgoG35TXTTFLR-Wb0WA', 'Superfan'), | ||
('zc3CUJJ-GSrbPv63y9yjGw', 'Leoni Angela'), | ||
('zKIEZlItWcAQ_WFm8N9NQw', 'linus isaksson🏖'), | ||
('zNY45R4zBSahj3Iqg3u8aA', 'chris Thordsen'), | ||
('zPFOx8_J3wliiFzb5I5i3Q', 'Sudin Naik ✪'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "commonjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"type": "module", | ||
"name": "snap-camera-server", | ||
"version": "2.0.6", | ||
"version": "3.0.0-alpha-1", | ||
"description": "Host your own Snap Camera private server", | ||
"keywords": [ | ||
"snapchat", | ||
|
@@ -15,7 +15,7 @@ | |
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "ptrumpis <[email protected]>", | ||
"author": "Patrick Trumpis <[email protected]>", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ptrumpis/snap-camera-server.git" | ||
|
@@ -25,6 +25,8 @@ | |
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"db-migrate": "1.0.0-beta.18", | ||
"db-migrate-mysql": "^2.2.0", | ||
"dotenv": "^16.0.3", | ||
"express": "^4.18.2", | ||
"formidable": "^2.1.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.