Browse Source

Moved files around to work with nodejs static routes.

pull/11/head
Jeffery Russell 5 years ago
parent
commit
aba5902f0a
41 changed files with 8 additions and 54704 deletions
  1. +5
    -0
      configManager.js
  2. +0
    -179
      js/friendsGraph.js
  3. +0
    -44
      js/githubAPI.js
  4. +0
    -27
      js/profileGen.js
  5. BIN
      js/vis/img/network/acceptDeleteIcon.png
  6. BIN
      js/vis/img/network/addNodeIcon.png
  7. BIN
      js/vis/img/network/backIcon.png
  8. BIN
      js/vis/img/network/connectIcon.png
  9. BIN
      js/vis/img/network/cross.png
  10. BIN
      js/vis/img/network/cross2.png
  11. BIN
      js/vis/img/network/deleteIcon.png
  12. BIN
      js/vis/img/network/downArrow.png
  13. BIN
      js/vis/img/network/editIcon.png
  14. BIN
      js/vis/img/network/leftArrow.png
  15. BIN
      js/vis/img/network/minus.png
  16. BIN
      js/vis/img/network/plus.png
  17. BIN
      js/vis/img/network/rightArrow.png
  18. BIN
      js/vis/img/network/upArrow.png
  19. BIN
      js/vis/img/network/zoomExtends.png
  20. +0
    -34
      js/vis/vis-graph3d.min.js
  21. +0
    -1
      js/vis/vis-network.min.css
  22. +0
    -42
      js/vis/vis-network.min.js
  23. +0
    -1
      js/vis/vis-timeline-graph2d.min.css
  24. +0
    -40
      js/vis/vis-timeline-graph2d.min.js
  25. +0
    -1448
      js/vis/vis.css
  26. +0
    -52833
      js/vis/vis.js
  27. +0
    -0
      js/vis/vis.js.map
  28. +0
    -1
      js/vis/vis.map
  29. +0
    -1
      js/vis/vis.min.css
  30. +0
    -46
      js/vis/vis.min.js
  31. +0
    -0
      public/GraphTest.html
  32. +0
    -0
      public/about.css
  33. +0
    -0
      public/about.html
  34. +0
    -0
      public/fonts/Comfortaa-Bold.ttf
  35. +0
    -0
      public/fonts/Comfortaa-Light.ttf
  36. +0
    -0
      public/fonts/Comfortaa-Regular.ttf
  37. +0
    -0
      public/icon.svg
  38. +0
    -0
      public/index.html
  39. +0
    -0
      public/logo.svg
  40. +0
    -0
      public/style.css
  41. +3
    -7
      server.js

+ 5
- 0
configManager.js View File

@ -28,6 +28,11 @@ module.exports=
getClientSecret: function() getClientSecret: function()
{ {
return config.clientSecret; return config.clientSecret;
},
getSessionSecret: function()
{
return config.sessionSecret;
} }
}; };

+ 0
- 179
js/friendsGraph.js View File

@ -1,179 +0,0 @@
var nodes;
var edges;
const options = {
nodes: {
borderWidth:4,
size:30,
color: {
border: '#222222',
background: '#666666'
},
font:{color:'#eeeeee'}
},
edges: {
color: 'lightgray'
}
};
function alreadyInGraph(userID)
{
for(var i = 0; i < nodes.length; i++)
{
if(nodes[i].id === userID)
{
return true;
}
}
return false;
}
function addPersonToGraph(profileData)
{
nodes.push(
{
id:profileData.id,
name:profileData.login,
shape: 'circularImage',
image:profileData.avatar_url
});
}
function addFriends(username, apiPath)
{
return new Promise(function(resolve, reject)
{
queryAPIByUser(apiPath, username, function(data)
{
for(var i = 0; i < data.length; i++)
{
if(!alreadyInGraph(data[i].id))
{
addPersonToGraph(data[i]);
}
}
resolve();
},
function(error)
{
reject(error);
})
});
}
function addConnection(person1, person2)
{
edges.push(
{
from: person1.id,
to: person2.id
});
}
function processUserConnections(userName)
{
return new Promise(function(resolve, reject)
{
queryAPIByUser(API_FOLLOWING, userName,
function(data)
{
for(var i = 0; i < data.length; i++)
{
}
queryAPIByUser(API_FOLLOWERS, userName, function(data2)
{
for(var i = 0; i < data2.length; i++)
{
}
resolve();
},
function(error)
{
reject(error);
});
},
function(error)
{
reject(error);
})
});
}
function createConnections()
{
return new Promise(function(resolve, reject)
{
var prom = [];
for(var i = 0; i < nodes.length; i++)
{
prom.push(processUserConnections(nodes[i].name));
}
Promise.all(prom).then(function()
{
resolve();
}).catch(function(error)
{
reject(error);
});
});
}
function addSelfToGraph(username)
{
return new Promise(function(resolve, reject)
{
queryAPIByUser("", username, function(data)
{
addPersonToGraph(data);
resolve();
},
function(error)
{
reject(error);
});
});
}
function createFriendsGraph(username, containerName, graphsTitle)
{
nodes = [];
edges = [];
addSelfToGraph(username).then(function()
{
addFriends(username, API_FOLLOWERS).then(function()
{
addFriends(username, API_FOLLOWING).then(function()
{
createConnections().then(function()
{
var container = document.getElementById(containerName);
var data =
{
nodes: nodes,
edges: edges
};
var network = new vis.Network(container, data, options);
});
});
})
}).catch(function(error)
{
console.log(error);
$("#" + graphsTitle).html("Error Fetching Data From API");
});
}

+ 0
- 44
js/githubAPI.js View File

@ -1,44 +0,0 @@
/**
* Simple file which uses jQuery's ajax
* calls to make it easier to get data
* from the github api.
*
* @author Jeffery Russell 2-16-19
*/
const APIROOT = "https://api.github.com";
const API_USER_PATH = "/users/";
const API_FOLLOWING = "/following";
const API_FOLLOWERS = "/followers";
const API_REPOSITORIES = "/repos";
const API_ORGANIZATIONS = "/orgs";
/**
* Builds a query for the github rest api and
* allows you to get at the data using a
* callback which gives you a json object.
*
* @param apiPath the path on the github api ie API_FOLLOWING
* @param user the username to query
* @param successCallBack callback to complete when data is returned
* @param errorCallBack callback which is invoked on error
*/
function queryAPIByUser(apiPath, user, successCallBack, errorCallBack) {
const urlpath = APIROOT + API_USER_PATH + user + apiPath;
console.log(urlpath);
$.ajax({
type:'GET',
url: urlpath,
crossDomain: true,
dataType: "json",
success: successCallBack,
error:errorCallBack
});
}

+ 0
- 27
js/profileGen.js View File

@ -1,27 +0,0 @@
function profileGen(username, container) {
queryAPIByUser("", username, (data) => {
console.log(data);
html =
"<div> \
<img src=\""+data.avatar_url+"\"></img> \
<h1>"+data.name+"</h1> \
<h2>"+data.login+"</h2> \
<p>Followers: "+data.followers+"</p> \
<p>Following: "+data.following+"</p> \
<p>"+(data.bio != null ? "Bio: "+data.bio : "")+"</p> \
<p>"+(data.location != null ? "Location: "+data.location : "")+"</p> \
<p>"+(data.email != null ? "Email: "+data.email : "")+"</p> \
<p>"+(data.blog != null ? "Site: "+data.blog : "")+"</p> \
<p>"+(data.company != null ? "Company: "+data.company : "")+"</p> \
<a href=\""+data.html_url+"\">"+data.html_url+"</h2> \
<h2></h2> \
</div>"
$("#"+container).html(html);
}, () => {
console.log("error");
});
}
function parseOrgs(oranization_url) {
}

BIN
js/vis/img/network/acceptDeleteIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
js/vis/img/network/addNodeIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
js/vis/img/network/backIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
js/vis/img/network/connectIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
js/vis/img/network/cross.png View File

Before After
Width: 7  |  Height: 7  |  Size: 18 KiB

BIN
js/vis/img/network/cross2.png View File

Before After
Width: 5  |  Height: 5  |  Size: 17 KiB

BIN
js/vis/img/network/deleteIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
js/vis/img/network/downArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
js/vis/img/network/editIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
js/vis/img/network/leftArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
js/vis/img/network/minus.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.0 KiB

BIN
js/vis/img/network/plus.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.2 KiB

BIN
js/vis/img/network/rightArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
js/vis/img/network/upArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
js/vis/img/network/zoomExtends.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

+ 0
- 34
js/vis/vis-graph3d.min.js
File diff suppressed because it is too large
View File


+ 0
- 1
js/vis/vis-network.min.css
File diff suppressed because it is too large
View File


+ 0
- 42
js/vis/vis-network.min.js
File diff suppressed because it is too large
View File


+ 0
- 1
js/vis/vis-timeline-graph2d.min.css
File diff suppressed because it is too large
View File


+ 0
- 40
js/vis/vis-timeline-graph2d.min.js
File diff suppressed because it is too large
View File


+ 0
- 1448
js/vis/vis.css
File diff suppressed because it is too large
View File


+ 0
- 52833
js/vis/vis.js
File diff suppressed because it is too large
View File


+ 0
- 0
js/vis/vis.js.map View File


+ 0
- 1
js/vis/vis.map
File diff suppressed because it is too large
View File


+ 0
- 1
js/vis/vis.min.css
File diff suppressed because it is too large
View File


+ 0
- 46
js/vis/vis.min.js
File diff suppressed because it is too large
View File


GraphTest.html → public/GraphTest.html View File


about.css → public/about.css View File


about.html → public/about.html View File


fonts/Comfortaa-Bold.ttf → public/fonts/Comfortaa-Bold.ttf View File


fonts/Comfortaa-Light.ttf → public/fonts/Comfortaa-Light.ttf View File


fonts/Comfortaa-Regular.ttf → public/fonts/Comfortaa-Regular.ttf View File


icon.svg → public/icon.svg View File


index.html → public/index.html View File


logo.svg → public/logo.svg View File


style.css → public/style.css View File


+ 3
- 7
server.js View File

@ -11,7 +11,7 @@ const app = express();
/**Initializes sessions for login */ /**Initializes sessions for login */
app.use(session( app.use(session(
{ secret: configLoader.getConfiguration().sessionSecret,
{ secret: configLoader.getSessionSecret(),
cookie: { maxAge: 6000000 }} cookie: { maxAge: 6000000 }}
)); ));
@ -19,11 +19,7 @@ app.use(session(
app.use(express.urlencoded()); //for easy retrieval of post and get data app.use(express.urlencoded()); //for easy retrieval of post and get data
app.use(express.json()); app.use(express.json());
app.use(express.static(__dirname,'css'));
app.use(express.static(__dirname, 'js'));
app.use(express.static(__dirname, 'img'));
app.use(express.static('html'));
app.use(express.static(__dirname, 'fonts'));
app.use(express.static('public'));
const routes = require('./routes'); const routes = require('./routes');
@ -32,5 +28,5 @@ app.use('/', routes);
app.listen(configLoader.getConfiguration().port, () => app.listen(configLoader.getConfiguration().port, () =>
console.log(`App listening on port ${configLoader.getConfiguration().port}!`)
console.log(`App listening on port ${configLoader.getPort()}!`)
); );

Loading…
Cancel
Save