Skip to content

Commit

Permalink
Merge pull request #314 from COS301-SE-2021/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Siocnarff authored Oct 13, 2021
2 parents f7dad50 + 0a49641 commit 455eb38
Show file tree
Hide file tree
Showing 21 changed files with 25,217 additions and 354 deletions.
Binary file added docs/assets/Abstr_Icon_Light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
171 changes: 171 additions & 0 deletions docs/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
html{
height: 100%;
}

body {
background: #242424;
height: 100%;
font-family: 'Montserrat', sans-serif;
color: #fffcf5;
}

a {
text-decoration: none;
color: white;
}

a:hover {
color: #00a0b4;
}

a:active {
color: #00a0b4;
}

.header {
text-align: center;
margin-top: 100px;
font-family: "Trebuchet MS",sans-serif;
font-size: 50px;
color: #3AA1A0;
}

.under-construction {
text-align: center;
font-family: "Trebuchet MS", sans-serif;
font-size: 40px;
color: #cfdbd5;
}

.navbar {
position: fixed;
display: grid;
grid-template-columns: 4fr 2.5fr;
font-family: 'Montserrat', sans-serif;
font-size: large;
color: white;
background-color: #1b1b1b;
position: fixed;
top: 0;
left: 0;
width: 100%;
}

.links-all {
float: right;
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
width: fit-content;
}

.link-each {
font-size: small;
padding: 1em;
margin-top: auto;
margin-bottom: auto;
}

.logo-name {
display: flex;
text-align: center;
vertical-align: center;
}

.data {
font-weight: bolder;
color: white;
}

.sleuth {
font-weight: lighter;
}

.icon {
max-height: 1.8em;
margin-top: 0.8em;
margin-left: 1em;
margin-right: 0.5em;
}

.software-name{
font-size: 100px;
margin-top: 5%;
}

.slogan{
font-size: 20px;
}

.btn {
margin-top: 10%;
background-color: #00a0b4;
border: none;
color: white;
padding: 12px 30px;
cursor: pointer;
font-size: 20px;
border-radius: 5px;
}

.btn:hover {
background-color: #00899b;
}

.scroll-prompt {
position: absolute;
bottom: 30px;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
width: 100%;
font-size: 20px;
}

#download, #quickstart, #about, #email {
height: 100%;
padding-top: 50px !important;
}

#email-iframe {
margin-left: 28%;
}

#footer {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
width: 100%;
margin: 0;
background: #1b1b1b;
height: 30%;
position: absolute;
left: 0;
padding: 3em;
color: #adadad;
}

#download {
text-align: center;
display: grid;
grid-template-columns: 1fr 1fr;
padding-top: 0 !important;
}

.download-left-contents{
grid-column-end: 2;
margin-top: auto;
margin-bottom: auto;
}

.navbar-links {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}

.navbar-link-header {

}

.navbar-lastblock {
vertical-align: baseline;
}
79 changes: 79 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>DataSleuth</title>
<link rel="stylesheet" href="css/style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

</head>
<body>
<div class="navbar">
<div class="logo-name">
<img class="icon" src="assets/DataSleuth.ico">
<p class="data">Data</p><p class="sleuth">Sleuth</p>
</div>
<div class="links-all">
<a href="#quickstart" class="link-each">Quick Start</a>
<a href="https://drive.google.com/file/d/1pZ2Y5PCp1jZfZqYpx5ywBA2PufoYv558/view?usp=sharing" class="link-each">
User Manual
</a>
<a href="https://drive.google.com/file/d/1LkTb7nyWl4yDHMWl6UJxoQzqnlALx7sm/view?usp=sharing" class="link-each">
Technical Guide
</a>
<a href="" class="link-each">Repository</a>
</div>
</div>

<div id="download">
<div class="download-left-contents">
<div class="software-name">
<span><b>Data</b>Sleuth</span>
</div>
<div class="slogan">
<span>A way to sleuth all your favourite resources</span>
</div>
<button class="btn"><i class="fa fa-download" aria-hidden="true"></i> Download</button>
</div>
<div class="scroll-prompt">
<span id="scroll_text">Learn More</span><br>
<i class="fa fa-angle-double-down bounce" aria-hidden="true" style="color: lightgray; padding-top: 10px;"></i>
</div>
</div>
<div id="quickstart">
<h1>Quickstart appears here</h1>
</div>
<div id="about">
<h1>About appears here, explaining the system and providing a video</h1>
</div>
<div id="email">
<!-- <h1>email form placed here</h1>-->
<iframe
id="email-iframe"
src="https://docs.google.com/forms/d/e/1FAIpQLSeMTa7OGzqqVEphNPUg96gZfenDY-vAx0PX7wVNVXf3fY1nNQ/viewform?embedded=true"
width="640"
height="640"
frameborder="0"
marginheight="0"
marginwidth="100"
>Loading…</iframe>
</div>
<div id="footer">
<div class="logo-name">
<img class="icon" src="assets/Abstr_Icon_Light.png">
<p class="data">Abstraction</p>
</div>
<div class="navbar-links">
<p class="navbar-link-header">TEAM</p>
<p></p>
</div>
<div class="navbar-lastblock">Oct 2021</div>
</div>
<script src="index.js"></script>
</body>
</html>
4 changes: 0 additions & 4 deletions packages/api/src/general/generalFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ export function highlightSearchTerms(content: string, searchTerms: string[]): st
for (let term of searchTerms) {
let index: number = extractedContent.indexOf(term);
while (index !== -1) {
console.log(term);
if (!contained(positions, {start: index, end: index + term.length})) {
positions.push({start: index, end: index + term.length});
}
Expand Down Expand Up @@ -220,14 +219,11 @@ function updateIndicesFrom(index: number, indices: number[], amount: number): nu
function contained(positions: { start: number; end: number }[], newPosition: { start: number; end: number }): boolean {
for (let pos of positions) {
if (pos.start <= newPosition.start && newPosition.start <= pos.end) {
console.log("Contained");
return true;
}
if (pos.start <= newPosition.end && newPosition.end <= pos.end) {
console.log("Contained");
return true;
}
}
console.log("Not contained");
return false;
}
50 changes: 46 additions & 4 deletions packages/api/src/services/FileDataSource.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
statusMessage
} from "../general/generalFunctions";
import {DefaultHttpResponse, StatusMessage} from "../models/response/general.interfaces";
import {whiteList} from "../general/whiteList";

class FileDataSourceService {

Expand Down Expand Up @@ -152,7 +151,7 @@ class FileDataSourceService {
* @async
*/
async updateDatasources(): Promise<void> {
const [fileDataList, repositoryErr] = fileDataSourceRepository.getAllDataSources();
const [fileDataList, repositoryErr] = fileDataSourceRepository.getAllDataSources();
if (repositoryErr) {
return;
}
Expand Down Expand Up @@ -201,8 +200,51 @@ class FileDataSourceService {
const openTag: string = '<' + searchTermIdentifier + 'open>';
const closeTag: string = '<' + searchTermIdentifier + 'close>';
let extension: string = fileName.split('.').pop();
whiteList.hasOwnProperty(extension.toLocaleLowerCase())
if (whiteList.hasOwnProperty(extension.toLocaleLowerCase())) {
if (
[
"ts",
"js",
"java",
"dart",
"php",
"py",
"cpp",
"vue",
"html",
"css",
"yml",
"json",
"xml",
"c",
"go",
"pl",
"swift",
"scala",
"r",
"m",
"h",
"ino",
"matlab",
"rs",
"kt",
"groovy",
"s",
"asm",
"jl",
"cobol",
"scm",
"vbs",
"hs",
"hack",
"ada",
"lua",
"lisp",
"sh",
"clj",
"d",
"lgo"
].indexOf(extension.toLowerCase()) !== -1
) {
let searchTerms: string[] = this.getSearchTerms(snippet, searchTermIdentifier);
if (snippet.indexOf(openTag) > snippet.indexOf("\n")) {
snippet = snippet.substring(snippet.indexOf("\n"), snippet.length);
Expand Down
17 changes: 12 additions & 5 deletions packages/api/src/services/User.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class UserService {
}

sendEncodedRegistrationKeyToUser(users: { uuid: string; }[]) {
const userResult = userRepository.getUsers(users);
const userResult: any[] = userRepository.getUsers(users);
const pendingUsers = userRepository.getPendingUsers(userResult);
for (let pendingUser of pendingUsers) {
let encodedRegistrationKey: string = UserService.encodeRegistrationKey(
Expand All @@ -252,7 +252,11 @@ class UserService {
pendingUser["single_use_registration_token"],
pendingUser["secret"]
);
this.sendEmail(pendingUser["email"], encodedRegistrationKey);
this.sendEmail(
pendingUser["email"],
encodedRegistrationKey,
userResult.find(user => user["email"] === pendingUser["email"])["first_name"]
);
}
if (pendingUsers.length !== users.length) {
return {
Expand All @@ -270,7 +274,7 @@ class UserService {
};
}

private sendEmail(address: string, registrationToken: string) {
private sendEmail(address: string, registrationToken: string, name: string) {
let transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
Expand All @@ -282,8 +286,11 @@ class UserService {
let mailOptions = {
from: process.env.EMAIL_ADDRESS,
to: address,
subject: 'Registration key for data sleuth',
text: registrationToken
subject: 'Registration key for DataSleuth',
text: `Dear ${name},\n\nPlease find below your registration token for the DataSleuth app:\n` +
registrationToken +
`\n\nYou can simply copy the token into the "Registration String" field in the app and click connect.` +
`\n\nHappy Sleuthing!!\nDataSleuth Team`
};

transporter.sendMail(mailOptions, function (error, info) {
Expand Down
Loading

0 comments on commit 455eb38

Please sign in to comment.