cuy-cli 3.0.4 → 3.0.7
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/database.js +12 -9
- package/bin/index.js +8 -8
- package/package.json +1 -1
package/bin/database.js
CHANGED
@@ -2,17 +2,20 @@
|
|
2
2
|
const fs = require('fs')
|
3
3
|
var mysql = require('mysql');
|
4
4
|
var conn = mysql.createConnection({
|
5
|
-
host:
|
6
|
-
user:
|
7
|
-
password:
|
8
|
-
database:
|
9
|
-
port:
|
10
|
-
ssl: {
|
11
|
-
|
12
|
-
}
|
5
|
+
host: "db-mysql-sgp1-58823-do-user-11984311-0.b.db.ondigitalocean.com",
|
6
|
+
user: "doadmin",
|
7
|
+
password: "AVNS_71_BT0OkHC4TvDAPny9",
|
8
|
+
database: "cuyuniverse",
|
9
|
+
port: 25060,
|
10
|
+
// ssl: {
|
11
|
+
// ca: fs.readFileSync(__dirname + '/ca-certificate.crt')
|
12
|
+
// }
|
13
13
|
});
|
14
14
|
conn.connect(function (err) {
|
15
|
-
if (err)
|
15
|
+
if (err) return console.log('err conn', err)
|
16
16
|
console.info('connected');
|
17
17
|
});
|
18
|
+
|
19
|
+
|
20
|
+
|
18
21
|
module.exports = conn;
|
package/bin/index.js
CHANGED
@@ -44,18 +44,18 @@ const search = [
|
|
44
44
|
const cuyPost = (data) => {
|
45
45
|
if (data.description.length < 8 || data.description.length > 100) {
|
46
46
|
console.log('deskripsi terlalu panjang! min:8 max:100');
|
47
|
-
return db.destroy();
|
47
|
+
// return db.destroy();
|
48
48
|
}
|
49
49
|
|
50
50
|
if (data.hashtag.length < 2 || data.hashtag.length > 20) {
|
51
51
|
console.log('hashtag terlalu panjang! min:2 max:20');
|
52
|
-
return db.destroy();
|
52
|
+
// return db.destroy();
|
53
53
|
}
|
54
54
|
|
55
55
|
db.query(`SELECT * from users where secret='${data.secret}' AND cuycli=1`, (err, rows) => {
|
56
56
|
if (err) {
|
57
57
|
console.warn('Maaf, saat ini data yang anda masukan tidak dapat kami proses.')
|
58
|
-
return db.destroy();
|
58
|
+
// return db.destroy();
|
59
59
|
}
|
60
60
|
if (!err && rows.length > 0) {
|
61
61
|
const { username, id } = rows[0]
|
@@ -63,10 +63,10 @@ const cuyPost = (data) => {
|
|
63
63
|
if (!err) {
|
64
64
|
if (rows != null) {
|
65
65
|
console.info(`congrats ${username} :) anda berhasil membuat postingan baru. silahkan cek di https://cuyuniverse.co`);
|
66
|
-
db.destroy();
|
66
|
+
// db.destroy();
|
67
67
|
} else {
|
68
68
|
console.log('Terjadi kesalahan, saat ini anda tidak dapat membuat postingan via cuycli. Coba lagi nanti!');
|
69
|
-
db.destroy();
|
69
|
+
// db.destroy();
|
70
70
|
}
|
71
71
|
} else {
|
72
72
|
console.warn('Maaf, saat ini data yang anda masukan tidak dapat kami proses.')
|
@@ -84,15 +84,15 @@ const lastSeen = ({ username }) => {
|
|
84
84
|
last_seen = rows[0].last_seen
|
85
85
|
if (last_seen == null) {
|
86
86
|
console.info(`${username} belum pernah login`);
|
87
|
-
db.destroy();
|
87
|
+
// db.destroy();
|
88
88
|
} else {
|
89
89
|
console.info(`${username} terahir terlihat pada ${last_seen}`);
|
90
|
-
db.destroy();
|
90
|
+
// db.destroy();
|
91
91
|
}
|
92
92
|
}
|
93
93
|
else {
|
94
94
|
console.warn('Maaf, saat ini data yang anda masukan tidak dapat kami proses.')
|
95
|
-
return db.destroy();
|
95
|
+
// return db.destroy();
|
96
96
|
}
|
97
97
|
})
|
98
98
|
}
|