Skip to content

Commit 5f2509a

Browse files
committed
Add anti-robot system to sign in and sign up page.
1 parent 41693a3 commit 5f2509a

287 files changed

Lines changed: 44062 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codesandbox/tasks.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
// These tasks will run in order when initializing your CodeSandbox project.
3+
"setupTasks": [
4+
{
5+
"name": "Installing Dependencies",
6+
"command": "yarn install --ignore-engines"
7+
}
8+
],
9+
10+
// These tasks can be run from CodeSandbox. Running one will open a log in the app.
11+
"tasks": {
12+
"build": {
13+
"name": "build",
14+
"command": "yarn build"
15+
},
16+
"development": {
17+
"name": "Development server",
18+
"command": "yarn development",
19+
"runAtStart": true,
20+
"preview": {
21+
"port": 3000
22+
}
23+
}
24+
}
25+
}

.github/workflows/build_site.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: Build and Deploy (3-Tier with Force Push)
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
schedule:
8+
# Weekly: Sunday at 3:00 AM UTC (for Beta)
9+
- cron: "0 3 * * 0"
10+
# Monthly: 1st of the month at 4:00 AM UTC (for Production)
11+
- cron: "0 4 1 * *"
12+
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
#----------------------------------------------------
20+
# JOB 1: DEVELOPMENT (Always runs on push)
21+
#----------------------------------------------------
22+
deploy_dev:
23+
name: 🚀 Deploy to 'deploy-dev' (Dev)
24+
if: github.event_name == 'push'
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-node@v4
29+
with: { node-version: 16.x }
30+
- run: |
31+
npm install
32+
npm run build
33+
- name: Commit and Push to 'deploy-dev'
34+
run: |
35+
git config --global user.name 'github-actions[bot]'
36+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
37+
git checkout -B deploy-dev
38+
git add .
39+
git add -f public
40+
git commit -m "${{ github.sha }} [Dev Deploy]" || echo "No changes to commit"
41+
git push -f origin deploy-dev
42+
43+
#----------------------------------------------------
44+
# JOB 2: BETA (Runs weekly OR on "Immediate:" push)
45+
#----------------------------------------------------
46+
deploy_beta:
47+
name: spoilers 📅 Deploy to 'deploy-beta' (Beta)
48+
# 1. CHANGED: Now also triggers on 'push' to check the commit message
49+
if: (github.event_name == 'schedule' && github.event.schedule == '0 3 * * 0') || github.event_name == 'push'
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
with: { fetch-depth: 0 }
54+
- name: Check Beta deploy logic 🧐
55+
id: check_commits
56+
run: |
57+
echo "needs_build=false" >> $GITHUB_OUTPUT # Default to false
58+
COMMIT_MSG="${{ github.event.head_commit.message }}"
59+
60+
# 2. NEW LOGIC: Check for force command first
61+
if echo "$COMMIT_MSG" | grep -qi "^Immediate:"; then
62+
echo "✅ Force deploy triggered by commit message."
63+
echo "needs_build=true" >> $GITHUB_OUTPUT
64+
65+
# 3. OLD LOGIC: Check for schedule
66+
elif [ "${{ github.event_name }}" == "schedule" ]; then
67+
echo "Running on schedule, checking for new commits..."
68+
MAIN_SHA=$(git rev-parse main)
69+
if git rev-parse --verify origin/deploy-beta >/dev/null 2>&1; then
70+
DEPLOY_MSG=$(git log origin/deploy-beta -1 --pretty=%B)
71+
LAST_DEPLOY_SHA=$(echo "$DEPLOY_MSG" | awk '{print $1}')
72+
if [ "$MAIN_SHA" == "$LAST_DEPLOY_SHA" ]; then
73+
echo "No new commits for Beta. Skipping."
74+
else
75+
echo "New commits found for Beta. Building."
76+
echo "needs_build=true" >> $GITHUB_OUTPUT
77+
fi
78+
else
79+
echo "First Beta build. Proceeding."
80+
echo "needs_build=true" >> $GITHUB_OUTPUT
81+
fi
82+
else
83+
echo "Regular push, no force command. Skipping Beta."
84+
fi
85+
shell: bash
86+
87+
- uses: actions/setup-node@v4
88+
if: steps.check_commits.outputs.needs_build == 'true'
89+
with: { node-version: 16.x }
90+
- run: |
91+
npm install
92+
npm run build
93+
if: steps.check_commits.outputs.needs_build == 'true'
94+
- name: Commit and Push to 'deploy-beta'
95+
if: steps.check_commits.outputs.needs_build == 'true'
96+
run: |
97+
git config --global user.name 'github-actions[bot]'
98+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
99+
git checkout -B deploy-beta
100+
git add .
101+
git add -f public
102+
git commit -m "${{ github.sha }} [Weekly Beta Deploy]" || echo "No changes to commit"
103+
git push -f origin deploy-beta
104+
105+
#----------------------------------------------------
106+
# JOB 3: PRODUCTION (Runs monthly, on dispatch, OR on "Immediate:" push)
107+
#----------------------------------------------------
108+
deploy_production:
109+
name: 🌍 Deploy to 'deploy-monthly' (Production)
110+
# 4. CHANGED: Also triggers on 'push' to check commit message
111+
if: (github.event_name == 'schedule' && github.event.schedule == '0 4 1 * *') || github.event_name == 'workflow_dispatch' || github.event_name == 'push'
112+
runs-on: ubuntu-latest
113+
steps:
114+
- uses: actions/checkout@v4
115+
with: { fetch-depth: 0 }
116+
- name: Check Production deploy logic 🧐
117+
id: check_commits
118+
run: |
119+
echo "needs_build=false" >> $GITHUB_OUTPUT # Default to false
120+
COMMIT_MSG="${{ github.event.head_commit.message }}"
121+
122+
# 5. NEW LOGIC: Check for force command first
123+
if echo "$COMMIT_MSG" | grep -qi "^Immediate:"; then
124+
echo "✅ Force deploy triggered by commit message."
125+
echo "needs_build=true" >> $GITHUB_OUTPUT
126+
127+
# 6. OLD LOGIC: Check for schedule or dispatch
128+
elif [ "${{ github.event_name }}" == "schedule" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
129+
echo "Running on schedule/dispatch, checking for new commits..."
130+
MAIN_SHA=$(git rev-parse main)
131+
if git rev-parse --verify origin/deploy-monthly >/dev/null 2>&1; then
132+
DEPLOY_MSG=$(git log origin/deploy-monthly -1 --pretty=%B)
133+
LAST_DEPLOY_SHA=$(echo "$DEPLOY_MSG" | awk '{print $1}')
134+
if [ "$MAIN_SHA" == "$LAST_DEPLOY_SHA" ]; then
135+
echo "No new commits for Production. Skipping."
136+
else
137+
echo "New commits found for Production. Building."
138+
echo "needs_build=true" >> $GITHUB_OUTPUT
139+
fi
140+
else
141+
echo "First Production build. Proceeding."
142+
echo "needs_build=true" >> $GITHUB_OUTPUT
143+
fi
144+
else
145+
echo "Regular push, no force command. Skipping Production."
146+
fi
147+
shell: bash
148+
149+
- uses: actions/setup-node@v4
150+
if: steps.check_commits.outputs.needs_build == 'true'
151+
with: { node-version: 16.x }
152+
- run: |
153+
npm install
154+
npm run build
155+
if: steps.check_commits.outputs.needs_build == 'true'
156+
- name: Commit and Push to 'deploy-monthly'
157+
if: steps.check_commits.outputs.needs_build == 'true'
158+
run: |
159+
git config --global user.name 'github-actions[bot]'
160+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
161+
git checkout -B deploy-monthly
162+
git add .
163+
git add -f public
164+
git commit -m "${{ github.sha }} [Monthly Production Deploy]" || echo "No changes to commit"
165+
git push -f origin deploy-monthly

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.glitchdotcom.json
2+
.node-gyp
3+
.env
4+
.glitch-assets
5+
.wget-hsts
6+
.git
7+
.data
8+
.config
9+
package-lock.json
10+
yarn.lock
11+
goorm.manifest
12+
arkain.manifest
13+
node_modules/
14+
public/
15+
counters/
16+
crashlogs/
17+
usermedia/
18+
robotcheck/

.watchmanconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"ignore_dirs":["node_modules",".next"]}

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[![Random Rants +](./wpstatic/images/randomrants-plus.svg)](https://randomrants-plus.onrender.com)
2+
3+
## What is Random Rants +?
4+
5+
Random Rants + is the next generation of Random Rants,
6+
aimed towards having new functions and is more like an actual social media site.
7+
Random Rants + also aims for the fun of the original Random Rants, so you don't get
8+
as bored easily.
9+
10+
**_Glitch.com is no longer hosting projects (and that means our Random Rants + doesn't work on glitch anymore), because of that we switched to render.com to run Random Rants +._**
11+
12+
## Preparing Supabase enviroment variables
13+
14+
Create a Supabase project and provide the following enviroment vairales:
15+
16+
- sbBucket: Your Supabase storage bucket
17+
- sbAPIKey: Your Supabase secret key or api key (I recommend secret key)
18+
- sbURL: Your Supabase project url (Needs to be like `https://projectid.supabase.co`)
19+
20+
## Installation and building
21+
22+
**_Make sure you don't skip the Supabase project stuff, as it is required to run the server._**
23+
24+
I recommend using Node.JS 16.x, then either `git clone https://github.com/Random-Rants-Chat/randomrants-plus.git` onto your computer or download by zip.
25+
26+
In the directory of package.json, run `npm install`. After that, use `npm run build` to build the website, and use `npm run start` to start up the server.
27+
28+
For auto reload: Then instead of `npm run start`, use `npm run development`. Note this works for both building and server code.
29+
30+
Go to `http://localhost:3000/` to see the functional Random Rants + site in action.
31+
32+
[![forthebadge](https://forthebadge.com/images/featured/featured-uses-html.svg)](https://forthebadge.com)
33+
[![forthebadge](https://forthebadge.com/images/featured/featured-uses-badges.svg)](https://forthebadge.com)
34+
[![forthebadge](https://forthebadge.com/images/badges/built-by-developers.svg)](https://forthebadge.com)
35+
[![forthebadge](https://forthebadge.com/images/badges/contains-tasty-spaghetti-code.svg)](https://forthebadge.com)
36+
[![forthebadge](https://forthebadge.com/images/badges/contains-breadcrumbs.svg)](https://forthebadge.com)
37+
[![forthebadge](https://forthebadge.com/images/badges/ctrl-c-ctrl-v.svg)](https://forthebadge.com)
38+
[![forthebadge](https://forthebadge.com/images/badges/designed-in-ms-paint.svg)](https://forthebadge.com)
39+
[![forthebadge](https://forthebadge.com/images/badges/not-a-bug-a-feature.svg)](https://forthebadge.com)
40+
[![forthebadge](https://forthebadge.com/images/badges/works-on-my-machine.svg)](https://forthebadge.com)
41+
[![forthebadge](https://forthebadge.com/images/badges/you-didnt-ask-for-this.svg)](https://forthebadge.com)
42+
[![forthebadge](https://forthebadge.com/images/badges/0-percent-optimized.svg)](https://forthebadge.com)
43+
[![forthebadge](https://forthebadge.com/images/badges/60-percent-of-the-time-works-every-time.svg)](https://forthebadge.com)
44+
[![forthebadge](https://forthebadge.com/images/badges/powered-by-pull-requests.svg)](https://forthebadge.com)
45+
[![forthebadge](https://forthebadge.com/images/badges/powered-by-jeffs-keyboard.svg)](https://forthebadge.com)
46+
[![forthebadge](https://forthebadge.com/images/badges/powered-by-electricity.svg)](https://forthebadge.com)
47+
[![forthebadge](https://forthebadge.com/images/badges/powered-by-coders-sweat.svg)](https://forthebadge.com)
48+
[![forthebadge](https://forthebadge.com/images/badges/uses-brains.svg)](https://forthebadge.com)

encrypt/base64.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function btoa(val) {
2+
return Buffer.from(val).toString('base64');
3+
}
4+
function atob(val) {
5+
return Buffer.from(val, 'base64').toString('ascii');
6+
}
7+
module.exports = {btoa,atob};

encrypt/index.js

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
var {atob, btoa} = require("./base64.js");
2+
3+
var accountEncrypt = {};
4+
var encryptList =
5+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890=-+)(*&^%$#@!`~'\">.<,/?\\]}[{";
6+
var numberToChar = {
7+
1: "a",
8+
2: "2",
9+
3: "b",
10+
4: "1",
11+
5: "y",
12+
6: "3",
13+
7: "9",
14+
8: "i",
15+
9: "5",
16+
0: "r",
17+
e: "3",
18+
".": "7",
19+
split: "0",
20+
};
21+
22+
function toFourDigitsString(digit) {
23+
return digit.toLocaleString("en-US", {
24+
minimumIntegerDigits: 4,
25+
useGrouping: false,
26+
});
27+
}
28+
29+
function toEncryptedNumber(numbers) {
30+
var num = numbers.toString();
31+
var tmp = "";
32+
for (var number of num) {
33+
tmp += numberToChar[number];
34+
}
35+
return tmp;
36+
}
37+
38+
function getKeyByValue(object, value) {
39+
return Object.keys(object).find((key) => object[key] === value);
40+
}
41+
42+
function fromEncryptedNumber(txt) {
43+
var num = "";
44+
for (var character of txt) {
45+
num += getKeyByValue(numberToChar, character);
46+
}
47+
return Number(num);
48+
}
49+
50+
accountEncrypt.encrypt = function (json) {
51+
try {
52+
var string = JSON.stringify(json);
53+
var base = btoa(string);
54+
var outarray = [];
55+
var shift = Math.round(Math.random() * 10);
56+
outarray.push(toEncryptedNumber(shift));
57+
var i = 0;
58+
while (i < base.length) {
59+
var value = encryptList.indexOf(base[i]) + shift;
60+
61+
outarray.push(toEncryptedNumber(value));
62+
i += 1;
63+
}
64+
return outarray.join(numberToChar.split);
65+
} catch (e) {
66+
return;
67+
}
68+
};
69+
70+
accountEncrypt.decrypt = function (string) {
71+
try {
72+
var decrypted = {};
73+
var split = string.split(numberToChar.split);
74+
var chars = "";
75+
var shift = fromEncryptedNumber(split[0]);
76+
var base = "";
77+
for (var enumber of split.slice(1, split.length)) {
78+
var num = fromEncryptedNumber(enumber);
79+
base += encryptList[num - shift];
80+
}
81+
82+
var raw = atob(base);
83+
var json = JSON.parse(raw);
84+
85+
return json;
86+
} catch (e) {
87+
return;
88+
}
89+
};
90+
91+
module.exports = accountEncrypt;
92+

0 commit comments

Comments
 (0)