Skip to content

Commit

Permalink
Merge pull request #14 from dereckmezquita/geo-ip-lite-replace
Browse files Browse the repository at this point in the history
Geo ip lite replace & fixed delete comment with replies
dereckmezquita authored Oct 20, 2023
2 parents e87d7f8 + 9ede6f1 commit 7db029c
Showing 12 changed files with 166 additions and 112 deletions.
30 changes: 29 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@

## bugs

- [ ] Comment then reply to comment, if delete parent get error:
- [x] Comment then reply to comment, if delete parent get error; solution, I was not populating child comments on delete.
```
1 of 2 unhandled errors
@@ -19,6 +19,34 @@ dispatchEvent
[native code]
performConcurrentWorkOnRoot
[native code]
---
[Error] TypeError: undefined is not an object (evaluating 'c.user.username')
g — 716-a31c85784980ec41.js:1:2378
ak — framework-63157d71ad419e09.js:3208:161
i — framework-63157d71ad419e09.js:6466
oD — framework-63157d71ad419e09.js:5387
(anonymous function) — framework-63157d71ad419e09.js:5376
oO — framework-63157d71ad419e09.js:5377
oE — framework-63157d71ad419e09.js:5148:99
ox — framework-63157d71ad419e09.js:5062
ox
x — framework-63157d71ad419e09.js:7461
T — framework-63157d71ad419e09.js:7498
Q (main-a568e19a92d5412a.js:1:9961)
fn (main-a568e19a92d5412a.js:1:9061)
componentDidCatch (main-a568e19a92d5412a.js:1:7502)
(anonymous function) (framework-63157d71ad419e09.js:9:70436)
lW (framework-63157d71ad419e09.js:9:51389)
uX (framework-63157d71ad419e09.js:9:90779)
e (framework-63157d71ad419e09.js:9:111108)
(anonymous function) (framework-63157d71ad419e09.js:9:111117)
oU (framework-63157d71ad419e09.js:9:111629)
ox (framework-63157d71ad419e09.js:9:95001)
ox
x (framework-63157d71ad419e09.js:33:1366)
T (framework-63157d71ad419e09.js:33:1896)
```
- [x] Cannot right click or cmd + click to open post cards in new tab.
- [x] Auth modal closes when click and drag out of modal.
11 changes: 8 additions & 3 deletions client/src/pages/myaccount.tsx
Original file line number Diff line number Diff line change
@@ -306,9 +306,10 @@ export default Account;
import { ActionButton } from '@components/comments-section/comment-styled';
import api_delete_geolocations from '@utils/api/interact/delete_geolocations';

// TODO: convert this to a grid I don't like the flexbox wrapping
const ActionContainer = styled.div`
width: 100%; /* Full width */
text-align: right; /* Align button to right */
width: 100%;
text-align: right;
`;

const GeoLocationCard = styled.div`
@@ -332,6 +333,10 @@ const GeoLocationCard = styled.div`
const GeoInfo = styled.div`
margin-bottom: 8px;
&:not(:first-child) {
margin-left: 5px;
}
& strong {
margin-right: 5px;
}
@@ -383,7 +388,7 @@ function GeoLocationsBlock({ geoLocations }: GeoLocationsBlockProps) {
<strong>Country:</strong> {location.country} {location.flag}
</GeoInfo>
<GeoInfo>
<strong>ISP:</strong> {location.isp}
<strong>Region:</strong> {location.regionName}
</GeoInfo>
<GeoInfo>
<strong>First Used:</strong> {location.firstUsed ? new Date(location.firstUsed).toLocaleString() : "???"}
2 changes: 2 additions & 0 deletions conf/next-derecksnotes-server.service
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# /etc/systemd/system/next-derecksnotes-server.service
# systemctl restart next-derecksnotes-server.service
# journalctl -u next-derecksnotes-server.service -f
# https://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1/
[Unit]
Description=next-derecksnotes-server.js - runs test subdomain server responses for next.derecksnotes.com
96 changes: 87 additions & 9 deletions server/package-lock.json

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

3 changes: 3 additions & 0 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -17,10 +17,12 @@
"bcrypt": "^5.1.1",
"connect-redis": "^6.1.3",
"cors": "^2.8.5",
"country-code-lookup": "^0.1.0",
"country-flag-icons": "^1.5.7",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"express-session": "^1.17.3",
"geoip-lite": "^1.4.7",
"module-alias": "^2.2.3",
"mongoose": "^7.5.2",
"multer": "^1.4.5-lts.1",
@@ -32,6 +34,7 @@
"devDependencies": {
"@types/bcrypt": "^5.0.0",
"@types/express": "^4.17.17",
"@types/geoip-lite": "^1.4.3",
"@types/jest": "^29.5.5",
"@types/mongoose": "^5.11.97",
"@types/multer": "^1.4.7",
6 changes: 4 additions & 2 deletions server/src/index.ts
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@ import { DatabaseConnector, MongoDBConnector } from '@utils/DatabaseConnector';
dotenv.config({ path: '../.env' });
const PORT: number = 3003;

console.log(`Detected: ${process.env.NEXT_PUBLIC_DEV_MODE === 'true' ? 'Development' : 'Production'} Mode`);

// ----------------------------------------
// Setup Redis client and session store
export const redis_options: RedisClientOptions<RedisModules, RedisFunctions, RedisScripts> = {
@@ -50,7 +52,7 @@ export async function SetUp(dbConnector: DatabaseConnector): Promise<void> {
resave: false, // forces session be saved back to the session store, even if the session was never modified during the request
saveUninitialized: false,
cookie: {
secure: !(process.env.NEXT_PUBLIC_DEV_MODE === 'true'), // HTTPS in production
secure: (process.env.NEXT_PUBLIC_DEV_MODE === 'true'), // HTTPS in production
httpOnly: false, // true, // cookie inaccessible from JavaScript running in the browser
// days * hours * minutes * seconds * milliseconds
maxAge: 30 * 24 * 60 * 60 * 1000 // 1 day in milliseconds
@@ -87,7 +89,7 @@ export async function main(): Promise<void> {

app.listen(PORT, () => {
console.log(`Server listening on port ${PORT}`);
let API_LISTENING_ON: string = process.env.NEXT_PUBLIC_DEV_MODE === 'true' ? 'http://localhost:3003' : 'https://derecksnotes.com';
let API_LISTENING_ON: string = process.env.NEXT_PUBLIC_DEV_MODE === 'true' ? 'http://localhost:3003' : 'https://next.derecksnotes.com';
console.log(`API listening on ${API_LISTENING_ON + API_PREFIX}`);
});
}
2 changes: 0 additions & 2 deletions server/src/models/Geolocation.ts
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@ const GeolocationSchema = new mongoose.Schema({
flag: String,
regionName: String,
city: String,
isp: String,
org: String,
firstUsed: Date,
lastUsed: Date
});
Loading

0 comments on commit 7db029c

Please sign in to comment.