Skip to content

Commit

Permalink
migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
geryonghost committed Sep 24, 2024
1 parent 621be30 commit 8a36582
Show file tree
Hide file tree
Showing 83 changed files with 1,071 additions and 479 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.DS_STORE
app/node_modules

**/node_modules
**/nodemon.json
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ If you would like to continue the work, feel free to continue working with our l
## Struggles
- We have limited input to create valuable models.

## Help
We would like to move this project forward, but need help being able to use AI to scrape websites efficiently and cost effectively.

# Development
## Install Dependencies
Local applications
Expand Down
31 changes: 31 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
appHost = process.env.host
appEnvironment = process.env.environment

const express = require('express')
const vhost = require('vhost')

const app = express()

// Define your different apps for each domain
const marketing = require('./marketing/server')
const application = require('./application/server')

// Use vhost middleware to route requests based on domain
if (appEnvironment == 'dev') {
app.use(vhost('dev.behavio.cc', marketing))
app.use(vhost('dev.app.behavio.cc', application))
} else {
// app.use(vhost('behavio.cc', marketing))
// app.use(vhost('app.behavio.cc', application))

// app.use(
// vhost('www.behavio.cc', function (req, res) {
// res.set('location', 'https://behavio.cc')
// res.status(301).send()
// })
// )
}
// Add a default route or handle unrecognized domains
app.listen(3000, appHost, () => {
console.log('Server is running on port 3000')
})
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions app/application/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
User-agent: ChatGPT-User
Disallow: /

User-agent: *
Disallow: /
3 changes: 1 addition & 2 deletions app/scripts/db.js → app/application/scripts/db.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// const databaseConnectionString = process.env.databaseConnectionString
const databaseConnectionString = 'mongodb://localhost:27017'
const databaseConnectionString = process.env.databaseConnectionString

const { MongoClient } = require('mongodb')

Expand Down
2 changes: 1 addition & 1 deletion app/scripts/logic.js → app/application/scripts/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const lunarEmoji = {
'First Quarter': '🌓',
'Waxing Gibbous': '🌔',
'Full Moon': '🌕',
'Waning Gibboud': '🌖',
'Waning Gibbous': '🌖',
'Last Quarter': '🌗',
'Waning Crescent': '🌘',
}
Expand Down
38 changes: 22 additions & 16 deletions app/server.js → app/application/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const appEnvironment = process.env.environment
const appStatus = process.env.status

const express = require('express')
const app = express()
const appPort = '3000'
const { render } = require('ejs')

const session = require('express-session')
Expand Down Expand Up @@ -28,13 +30,17 @@ app.use(
app.get('', async (req, res) => {
// req.session.loggedin = true
// req.session.team = 'Mill Street'
if (req.session.loggedin) {
const pageTitle = 'Behavio'
const entries = await logic.getEntries(req.session.team)
res.render('index', { pageTitle: pageTitle, entries: entries })
if (appStatus != 'maintenance') {
if (req.session.loggedin) {
const pageTitle = 'Behavio'
const entries = await logic.getEntries(req.session.team)
res.render('index', { pageTitle: pageTitle, entries: entries })

Check warning

Code scanning / CodeQL

Information exposure through a stack trace Medium

This information exposed to the user depends on
stack trace information
.
} else {
const pageTitle = 'Login'
res.redirect('/login')
}
} else {
const pageTitle = 'Login'
res.redirect('/login')
res.render('maintenance')
}
})

Expand Down Expand Up @@ -64,30 +70,34 @@ app.post('/addentry', async (req, res) => {
app.post('/auth', async (req, res) => {
// let username = request.body.username;
let password = req.body.password
console.log(password)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This logs sensitive data returned by
an access to password
as clear text.
This logs sensitive data returned by
an access to password
as clear text.
// // if (username && password) {
if (password) {
const client = getClient()
console.log(client)
const db = client.db(databaseName)

const users = db.collection('accounts')
try {
const filter = { team: 'Dev Team', password: password }
const filter = { team: 'Mill Street', password: password }
console.log(filter)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This logs sensitive data returned by
an access to password
as clear text.
This logs sensitive data returned by
an access to password
as clear text.
This logs sensitive data returned by
an access to password
as clear text.
const user = await users.findOne(filter)
console.log(user)
if (user != null) {
req.session.loggedin = true
req.session.team = user.team
req.session.zipcode = user.zipcode
res.redirect('/')
} else {
const error = 'Bad login'
console.error('Error', 'Bad login')
console.error('BEH:Error', 'Bad login')
}
} catch (error) {
console.error('Error', error)
console.error('BEH:Error', error)
}
} else {
const error = 'Empty login'
console.error('Error', 'Empty Login')
console.error('BEH:Error', 'Empty Login')
}
})

Expand All @@ -96,8 +106,4 @@ app.get('*', function (req, res) {
res.redirect('/')
})

// Start the server
app.listen(appPort, () => {
console.log(`Server listening on port ${appPort}`);
});

module.exports = app
9 changes: 9 additions & 0 deletions app/application/views/inc/footer.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<footer>
<div class="text-center p-4">
<% const currentYear = new Date().getFullYear() %>
&#169; <%=currentYear%> Behavio.cc</a><br /><br />
<a href="https://www.flaticon.com/free-icons/behaviour" title="behaviour icons">Behaviour icons created by Vectors Tank - Flaticon</a>
</div>
</footer>
</body>
</html>
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions app/application/views/maintenance.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<%- include('inc/header.ejs') %>

<div style="text-align: center; max-width: 400px; margin: 0 auto; padding: 0px;">
<p>
<i class="fa-solid fa-screwdriver-wrench fa-2xl"></i><br /><br />
We are undergoing maintenance<br />We will be back online soon
</p>
</div>

<%- include('inc/footer.ejs') %>
12 changes: 12 additions & 0 deletions app/marketing/public/css/bootstrap.min.css

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/marketing/public/img/favicon/apple-icon.png
2 changes: 2 additions & 0 deletions app/marketing/public/img/favicon/browserconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig><msapplication><tile><square70x70logo src="/ms-icon-70x70.png"/><square150x150logo src="/ms-icon-150x150.png"/><square310x310logo src="/ms-icon-310x310.png"/><TileColor>#ffffff</TileColor></tile></msapplication></browserconfig>
Binary file added app/marketing/public/img/favicon/favicon.ico
Binary file not shown.
41 changes: 41 additions & 0 deletions app/marketing/public/img/favicon/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "App",
"icons": [
{
"src": "/android-icon-36x36.png",
"sizes": "36x36",
"type": "image/png",
"density": "0.75"
},
{
"src": "/android-icon-48x48.png",
"sizes": "48x48",
"type": "image/png",
"density": "1.0"
},
{
"src": "/android-icon-72x72.png",
"sizes": "72x72",
"type": "image/png",
"density": "1.5"
},
{
"src": "/android-icon-96x96.png",
"sizes": "96x96",
"type": "image/png",
"density": "2.0"
},
{
"src": "/android-icon-144x144.png",
"sizes": "144x144",
"type": "image/png",
"density": "3.0"
},
{
"src": "/android-icon-192x192.png",
"sizes": "192x192",
"type": "image/png",
"density": "4.0"
}
]
}
7 changes: 7 additions & 0 deletions app/marketing/public/js/bootstrap.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions app/marketing/public/js/fontawesome.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/marketing/public/js/jquery.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/public/robots.txt → app/marketing/public/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Disallow: /
User-agent: *
Disallow: /

Sitemap: https://behavio.comtily.com/sitemap.xml
Sitemap: https://behavio.cc/sitemap.xml
Loading

0 comments on commit 8a36582

Please sign in to comment.