1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Use a fixed string instead of os.hostname()

This commit is contained in:
Hideki Nakamura 2017-12-20 19:44:57 +09:00
parent c24b0c6bb4
commit 2ea2af7d2a
3 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ var settings;
var needsPermission = require("../auth").needsPermission; var needsPermission = require("../auth").needsPermission;
function getUsername(userObj) { function getUsername(userObj) {
var username = os.hostname(); var username = '.default';
if ( userObj && userObj.name ) { if ( userObj && userObj.name ) {
username = userObj.name; username = userObj.name;
} }

View File

@ -704,7 +704,7 @@ function createProject(user, metadata) {
auth = authCache.get(project,originRemote.url,username); auth = authCache.get(project,originRemote.url,username);
} }
else if (originRemote.hasOwnProperty("key_file") && originRemote.hasOwnProperty("passphrase")) { else if (originRemote.hasOwnProperty("key_file") && originRemote.hasOwnProperty("passphrase")) {
var key_file_name = (username === '_') ? os.hostname() + '_' + originRemote.key_file : username + '_' + originRemote.key_file; var key_file_name = (username === '_') ? '.default' + '_' + originRemote.key_file : username + '_' + originRemote.key_file;
authCache.set(project,originRemote.url,username,{ // TODO: hardcoded remote name authCache.set(project,originRemote.url,username,{ // TODO: hardcoded remote name
key_path: fspath.join(projectsDir, ".sshkeys", key_file_name), key_path: fspath.join(projectsDir, ".sshkeys", key_file_name),
passphrase: originRemote.passphrase passphrase: originRemote.passphrase

View File

@ -44,7 +44,7 @@ function listSSHKeys(username) {
var ret = fns.sort() var ret = fns.sort()
.filter(function(fn) { .filter(function(fn) {
var fullPath = fspath.join(sshkeyDir,fn); var fullPath = fspath.join(sshkeyDir,fn);
if (fn[0] != ".") { if (fn.length > 2 || fn[0] != ".") {
var stats = fs.lstatSync(fullPath); var stats = fs.lstatSync(fullPath);
if (stats.isFile()) { if (stats.isFile()) {
return fn.startsWith(startStr); return fn.startsWith(startStr);