vagrant update

This commit is contained in:
2023-06-26 22:18:42 -04:00
parent 7659b77d67
commit deca906ce1
7 changed files with 634 additions and 596 deletions
+9 -6
View File
@@ -28,6 +28,8 @@ User.add = async function(data) {
data['backing'] = data['backing'] || 'redis';
console.log('set password', data)
return this.__proto__.add(data);
}catch(error){
@@ -104,17 +106,18 @@ module.exports = {User};
(async function(){
var defaultUser = 'proxyadmin2'
try{
await User.get('proxyadmin1');
console.info('proxyadmin1 user exists');
let user = await User.get(defaultUser);
}catch(error){
try{
let user = await User.add({
username:'proxyadmin1',
password: 'proxyadmin1',
created_by:'proxyadmin1'
username:defaultUser,
password: defaultUser,
created_by:defaultUser
});
console.log('proxyadmin1 created', user);
console.log(defaultUser, 'created', user);
}catch(error){
console.error(error)
}
+594 -563
View File
File diff suppressed because it is too large Load Diff
+2 -3
View File
@@ -12,14 +12,13 @@
"start": "node ./bin/www"
},
"dependencies": {
"authenticate-pam": "github:WeiAnAn/node-authenticate-pam",
"bcrypt": "^5.0.0",
"ejs": "^3.0.1",
"express": "~4.16.1",
"express": "^4.18.2",
"extend": "^3.0.2",
"ldapts": "^2.2.1",
"linux-sys-user": "^1.1.0",
"redis": "^2.8.0"
"redis": "^4.6.5"
},
"license": "MIT",
"repository": {
+12 -14
View File
@@ -5,21 +5,19 @@ const config = {
prefix: 'proxy_'
}
function client() {
return createClient(config);
}
var _client = createClient(config);
_client.connect()
const _client = client();
module.exports = {
client: client,
HGET: promisify(_client.HGET).bind(_client),
HDEL: promisify(_client.HDEL).bind(_client),
SADD: promisify(_client.SADD).bind(_client),
SREM: promisify(_client.SREM).bind(_client),
DEL: promisify(_client.DEL).bind(_client),
HSET: promisify(_client.HSET).bind(_client),
HGETALL: promisify(_client.HGETALL).bind(_client),
SMEMBERS: promisify(_client.SMEMBERS).bind(_client),
RENAME: promisify(_client.RENAME).bind(_client),
client: _client,
// HGET: promisify(_client.HGET).bind(_client),
// HDEL: promisify(_client.HDEL).bind(_client),
// SADD: promisify(_client.SADD).bind(_client),
// SREM: promisify(_client.SREM).bind(_client),
// DEL: promisify(_client.DEL).bind(_client),
// HSET: promisify(_client.HSET).bind(_client),
// HGETALL: promisify(_client.HGETALL).bind(_client),
// SMEMBERS: promisify(_client.SMEMBERS).bind(_client),
// RENAME: promisify(_client.RENAME).bind(_client),
};
+7 -3
View File
@@ -1,8 +1,11 @@
'use strict';
const client = require('../utils/redis');
const {createClient} = require('redis');
const objValidate = require('../utils/object_validate');
var client = createClient({});
client.connect()
let table = {};
@@ -20,7 +23,7 @@ table.get = async function(data){
let res = await client.HGETALL(`${this._name}_${data[this._key]}`);
// If the redis query resolved to something, prepare the data.
if(res){
if(Object.keys(res).length){
// Redis always returns strings, use the keyMap schema to turn them
// back to native values.
@@ -106,12 +109,13 @@ table.add = async function(data, noMemberAdd){
// Add the values for this entry.
for(let key of Object.keys(data)){
await client.HSET(`${this._name}_${data[this._key]}`, key, data[key]);
await client.hSet(`${this._name}_${data[this._key]}`, key, String(data[key]));
}
// return the created redis entry as entry instance.
return await this.get(data[this._key]);
} catch(error){
console.error('redis model | table.add:', error)
throw error;
}
};
+1 -1
View File
@@ -168,7 +168,7 @@
<div class="radio">
<label>
<input type="radio" name="targetssl" id="targetssl-true" value="true">
Proxt to HTTPS
Proxy to HTTPS
</label>
</div>
<div class="radio">