diff --git a/.gitignore b/.gitignore
index c6968ae..3b06183 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ lib-cov
*.pid
*.gz
*.swp
+assets/
pids
logs
@@ -14,7 +15,7 @@ results
tmp
# Constants
-src/CONSTANTS.ts
+src/constants.ts
# Dependency directory
node_modules
@@ -26,4 +27,5 @@ Thumbs.db
# Ignore built files
dist/**/*
-package-lock.json
\ No newline at end of file
+package-lock.json
+yarn.lock
\ No newline at end of file
diff --git a/README.md b/README.md
index 5da4074..1e8501e 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,12 @@
-
-
+
+
Profile Preview
-
-
+
+
@@ -82,16 +82,19 @@ Inside this file, is some basic configuration you can change for your set up. Th
| Variable | Description |
| --------------------------------------------- | :---------------------: |
| `DICK_SUBMODULE = false` | Put this to true if you wish to run DICK as an ASS submoduke, false if seperate |
-| `ASSLOCATION = "../ass"` | If running DICK seperately, DICK will use this to find your ASS install folder |
-| `ASSSECURE = false` | Put this to true if you are running ASS behind a domain with HTTPS,. false if HTTP |
+| `ASS_LOCATION = "../ass"` | If running DICK seperately, DICK will use this to find your ASS install folder |
+| `ASS_SECURE = false` | Put this to true if you are running ASS behind a domain with HTTPS,. false if HTTP |
| `ASSDOMAIN = "127.0.0.1:40115"` | Put this to your ASS domain. Can be an ip, or domain for example `https://cdn.mydomain.com` |
| `STAFF_IDS = ["ass"]` | Change this to whatever your username is in your ASS `auth.json` file. Default user in ASS, is `ass` |
### Running
+
#### Development
- Open to view the development set up steps
+
+ Open to view the development set up steps
+
1. Create a folder, call it whatever you wish
2. Install, and run ASS https://github.com/tycrek/ass#installation (This will create an `ass` folder)
@@ -107,16 +110,18 @@ Inside this file, is some basic configuration you can change for your set up. Th
#### Production
- Open to view the production set up steps
-
+
+ Open to view the production set up steps
+
+
1. Create a folder, call it whatever you wish
2. Install, and run ASS https://github.com/tycrek/ass#installation (This will create an `ass` folder)
- 3. Go back into the folder you created and clone this repo `git clone https://github.com/Facinorous-420/dick`
+ 3. Go back into the folder you created and clone this repo `git clone https://github.com/Facinorous-420/dick.git`
4. Go into the newly created `dick` folder `cd dick`
5. Go into `/src` and copy `CONSTANTS.ts.example` to `CONSTANTS.ts` and edit it as needed
6. Go back to the root of `dick` and install the dependancies for the frontend, `npm i`
7. Run `npm start` to compile the code base and run DICK
-
+
When you approach the login screen, your secret key is the key generated for your account. You should not share this with anyone.
diff --git a/dick_example_1.png b/assets/dick_example_1.png
similarity index 100%
rename from dick_example_1.png
rename to assets/dick_example_1.png
diff --git a/dick_example_2.png b/assets/dick_example_2.png
similarity index 100%
rename from dick_example_2.png
rename to assets/dick_example_2.png
diff --git a/src/CONSTANTS.ts.example b/src/CONSTANTS.ts.example
deleted file mode 100644
index 09c230e..0000000
--- a/src/CONSTANTS.ts.example
+++ /dev/null
@@ -1,33 +0,0 @@
-import { templatePathBuilder } from "./utils/utils"
-
-/*
-------------------- USER CONSTANTS ------------------------
-*/
-// Variable to set DICK to run as a submodule to ASS or seperately: true = submodule | false = seperate
-export const DICK_SUBMODULE = false
-
-// * ------------------- ASS HOST INFORMATION ----------------------------
-// Boolean variable if your ASS is secured with HTTPS: true = https | false = http
-export const ASSSECURE = false
-// This is the domain your ASS is hosted at: "127.0.0.1" | "cdn.domain.com"
-export const ASSDOMAIN = "127.0.0.1:40115"
-// If running DICK in seperate mode, it will need to know where your ASS is installed
-export const ASSLOCATION = "../ass"
-
-// * ------------------- STAFF ID CONSTANTS ---------------------------- <--- this will eventually be moved away from constants
-// Array of all USERNAMES in your ASS auth.json file that will have admin access: ["ass", "dick", "frank"]
-export const STAFF_IDS = ["ass"]
-
-
-/*
-------------------- SYSTEM CONSTANTS ------------------------
-*/
-// * ------------------- TEMPLATE PATH CONSTANTS ------------------------
-export const TEMPLATE = {
- USER: templatePathBuilder("/user.ejs"),
- PUBLIC: templatePathBuilder("/public.ejs"),
- ERRORS: {
- 403: templatePathBuilder("/errors/403.ejs"),
- 404: templatePathBuilder("/errors/404.ejs")
- }
-}
diff --git a/src/Pager.ts b/src/Pager.ts
index 501e822..c453b4f 100644
--- a/src/Pager.ts
+++ b/src/Pager.ts
@@ -1,7 +1,7 @@
import { Response } from "express"
import { parseAuthFile, parseDataFile } from "./utils/assJSONStructure"
import { RenderOptions } from "./typings/Pager"
-import { ASSDOMAIN, ASSSECURE, STAFF_IDS } from "./CONSTANTS"
+import { ASS_DOMAIN, ASS_SECURE, STAFF_IDS } from "./constants"
import { convertTimestamp, formatSize } from "./utils/utils"
import { ASSUser, ASSItem } from "./typings/ASSTypes"
import { IExtendedRequest } from "./typings/express-ext"
@@ -120,8 +120,8 @@ export class Pager {
*/
const baseData = {
- assDomain: ASSDOMAIN,
- assSecure: ASSSECURE,
+ assDomain: ASS_DOMAIN,
+ assSecure: ASS_SECURE,
user: req.user,
totalSize,
totalUsers,
diff --git a/src/constants.ts.example b/src/constants.ts.example
new file mode 100644
index 0000000..c9362ad
--- /dev/null
+++ b/src/constants.ts.example
@@ -0,0 +1,40 @@
+import { templatePathBuilder } from "./utils/utils"
+
+/* ------------------- USER CONSTANTS ------------------------ */
+
+// Variable to set DICK to run as a submodule to ASS or separately
+// true = submodule | false = separate
+export const DICK_SUBMODULE = false
+
+/* ------------------- ASS HOST INFORMATION ---------------------------- */
+// Boolean variable if your ASS is secured with HTTPS
+// true = https | false = http
+export const ASS_SECURE = false
+
+// This is the domain your ASS is hosted at: "127.0.0.1" | "cdn.domain.com"
+export const ASS_DOMAIN = "127.0.0.1:40115"
+
+// If running DICK in separate mode, it will need to know where your ASS is installed
+// do note that it must be a *relative* location.
+// For example "../ass" means ass is installed in the parent directory.
+export const ASS_LOCATION = "../ass"
+
+/* ------------------- STAFF ID CONSTANTS ---------------------------- */
+// this will eventually be moved away from constants
+// Array of all USERNAMES in your ASS auth.json file that will have admin access: ["ass", "dick", "frank"]
+export const STAFF_IDS = ["ass"]
+
+
+/* ------------------- SYSTEM CONSTANTS ------------------------ */
+// Port to run the server on, change if you have something else running on that port
+export const PORT = "3000"
+
+/* ------------------- TEMPLATE PATH CONSTANTS ------------------------ */
+export const TEMPLATE = {
+ USER: templatePathBuilder("/user.ejs"),
+ PUBLIC: templatePathBuilder("/public.ejs"),
+ ERRORS: {
+ 403: templatePathBuilder("/errors/403.ejs"),
+ 404: templatePathBuilder("/errors/404.ejs")
+ }
+}
diff --git a/src/dashboard.ts b/src/dashboard.ts
index 7a27e2e..4cc4a87 100644
--- a/src/dashboard.ts
+++ b/src/dashboard.ts
@@ -8,11 +8,12 @@ import flash from 'connect-flash'
import errorHandler from "errorhandler"
import { Pager } from "./Pager"
-import { TEMPLATE } from "./CONSTANTS"
+import { TEMPLATE } from "./constants"
import { authRoutes } from "./routes/route.auth"
import { publicRoutes } from "./routes/route.public"
import { userRoutes } from "./routes/route.user"
import { adminRoutes } from "./routes/route.admin"
+import { PORT } from "./constants"
// Add async into express cause async is megachad
const app = express()
diff --git a/src/routes/route.admin.ts b/src/routes/route.admin.ts
index 294d6b3..6674c5d 100644
--- a/src/routes/route.admin.ts
+++ b/src/routes/route.admin.ts
@@ -1,6 +1,6 @@
import { Request, Response, Router } from "express"
import { authCheck, adminCheck, wrap } from "../utils/utils"
-import { TEMPLATE } from "../CONSTANTS"
+import { TEMPLATE } from "../constants"
import { Pager } from "../Pager"
export const adminRoutes = (app: Router) => {
diff --git a/src/routes/route.public.ts b/src/routes/route.public.ts
index 79ad557..cca7765 100644
--- a/src/routes/route.public.ts
+++ b/src/routes/route.public.ts
@@ -1,5 +1,5 @@
import { Request, Response, Router } from "express"
-import { TEMPLATE } from "../CONSTANTS"
+import { TEMPLATE } from "../constants"
import { Pager } from "../Pager"
export const publicRoutes = (app: Router) => {
diff --git a/src/routes/route.user.ts b/src/routes/route.user.ts
index 8ee673a..97b1eaf 100644
--- a/src/routes/route.user.ts
+++ b/src/routes/route.user.ts
@@ -1,6 +1,6 @@
import { Request, Response, Router } from "express"
import { adminCheck, authCheck, wrap } from "../utils/utils"
-import { TEMPLATE } from "../CONSTANTS"
+import { TEMPLATE } from "../constants"
import { Pager } from "../Pager"
import { parseAuthFile } from "../utils/assJSONStructure"
diff --git a/src/utils/assJSONStructure.ts b/src/utils/assJSONStructure.ts
index 322fc23..3f95cc4 100644
--- a/src/utils/assJSONStructure.ts
+++ b/src/utils/assJSONStructure.ts
@@ -1,10 +1,10 @@
-import { DICK_SUBMODULE, ASSLOCATION } from "../CONSTANTS"
+import { DICK_SUBMODULE, ASS_LOCATION } from "../constants"
import fs from "fs"
import path from "path"
import { ASSItem } from "typings/ASSTypes"
- let DATA_FILE_PATH = path.resolve(`${ASSLOCATION}/data.json`)
- let AUTH_FILE_PATH = path.resolve(`${ASSLOCATION}/auth.json`)
+ let DATA_FILE_PATH = path.resolve(`${ASS_LOCATION}/data.json`)
+ let AUTH_FILE_PATH = path.resolve(`${ASS_LOCATION}/auth.json`)
if (DICK_SUBMODULE !== false) {
DATA_FILE_PATH = path.resolve(`data.json`)
AUTH_FILE_PATH = path.resolve(`auth.json`)
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index 9584cbd..25e3d87 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -1,5 +1,5 @@
import { Log } from "@callmekory/logger"
-import { STAFF_IDS } from "../CONSTANTS"
+import { STAFF_IDS } from "../constants"
import { Response, NextFunction } from "express"
import { join, normalize } from "path"
import { IExtendedRequest } from "../typings/express-ext"