Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tags: [intro]

# Introduction

Hello there, I am Security Hammer. I will guide and help you to setup various modules of mine (`Verification`, `Moderation` etc). In case, if something is unclear, feel free to ask in Support Server. Let's get started.
Hello there, I am Security Hammer. I will guide and help you to setup various modules of mine (`Verification`, `Moderation` etc). In case, if something is unclear, feel free to ask in [Support Server](https://api.shbot.tk/discord). Let's get started.

### Inviting Me

Expand All @@ -32,6 +32,6 @@ Slash commands are not yet implemented.

### Guides

[!ref icon="shield-check" text="Verification Setup"](../guides/Verification)
[!ref icon="shield-check" text="Verification Setup"](./guides/Verification)

More to be come :sad:
More under progress :+1:
30 changes: 30 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

CYANBG="46m"
CYAN="\e[96m"
RED="\e[31m"
GREEN="\e[32m"
END="\e[0m"
BOLDCYAN="\e[1;${CYANBG}"
WORKSPACE="${BOLDCYAN}[Docs]${END}"
BUILDMSG="${WORKSPACE} ${CYAN}Starting to build the project...${END}"
BUILDSUCCESS="${WORKSPACE} ${GREEN}Build success.${END}"
MOVING="${WORKSPACE} ${CYAN}Moving service worker to root from /resources${END}"
INJECTING="${WORKSPACE} ${CYAN}Injecting Service Worker Registry${END}"
INJECTINGSUCCESS="${WORKSPACE} ${GREEN}Injecting success.${END}"
STARTING="${WORKSPACE} ${CYAN}Starting to serve the files.${END}"
ERROR="${WORKSPACE} ${RED}There was error. EXITING${END}"

echo -e "${BUILDMSG}"
(npx retype build && echo -e "${BUILDSUCCESS}") || ( echo -e "${ERROR}" && sleep 3 && exit 1)
exitcode=$?
if [ $exitcode != 0 ]; then exit $exitcode; fi


echo -e "${MOVING}"
mv build/resources/js/service-worker.js build
echo -e "${INJECTING}"
node prebuilder.mjs
echo -e "${INJECTINGSUCCESS}"
echo -e "${STARTING}"
# npx retype run
45 changes: 43 additions & 2 deletions guides/Verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,46 @@ tags: [verification]

# Verification

!!!danger In Progress
This section is being written.
!!!danger Work In Progress
This section is being written.
!!!
## Introduction
Alright, lets get started setting up without wasting time. Before you setup, it's important to know how I work.

- [X] User joins the server is given `Unverified Role`
- [X] They clicks verify button in `Verification Channel`.
- [X] I will then try to DM them captcha and if fail to DM, I will reply the error in channel.
- [X] They will type the given captcha in my DM.
- [X] On correct captcha within given `Time`, they will be verified and
- `Unverified Role` will be removed from them.
- `Verified Role` will be added to them.
- [X] If they fail to do so, they will undergo `Action` set by you.
- [X] If they don't click the verify button,
- I will wait for `Idle Time` hoping they will click the button.
- If they don't do so in given time, `Idle Action` will be taken on them, again set by you.

Okay that's lots of confusing :sparkles: terms :sparkles:. Don't worry, I am here to explain one by one :)

!!!danger Before we start...
I really hope you know how to manage roles, channels and most importantly dealing with their permission. If you don't, refer this video by [!badge text="Y0ken's Domain"](https://www.youtube.com/channel/UC4negHehVJxHKwnxX5dck5g).

[!button variant="info" target="blank" icon="link-external" text="Youtube"](https://www.youtube.com/watch?v=X1MGtTJWytg)
!!!

## Unverified Role
When a user joins your server, they will be given `Unverified Role` which will restrict them to see channels and their content. I will shortly discuss how to set them up. But you might be wondering now, what if I have *Membership Gating* which will be bypassed if user is given role? That's correct, that's why I will auto-adapt if there is any sort of gating. So, if there is one I will wait for them to complete the membership, and then give them unverified role otherwise I will add the role directly.

### Setting up Unverified Role
Here comes the important part that is setting up. I will break this in few steps.
- **Step 1:**
Create a role which you want to be given to unverified users or use an existing one, let's call it `Unverified Role`.
- **Step 2:**
Next step is setting permission for `Unverified Role`. All you have to do is select channel/category, go to settings, and then select `Permissions` tab.
- **Step 3:**
Select the `Unverified Role` from *Step 1*. Find the `Read Messages` permission and set it to `Deny` (you can refer the screenshot below). Save and it's done!!!

| ![Unverified Role](../resources/images/UnverifiedRole.png) |
|:--:|
| *Setting Unverified Role's Permission in Category* |

In short, it is role given to new users joining which will prevent them from seeing the channels.
18 changes: 11 additions & 7 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"dependencies": {
"retypeapp": "^1.10.0"
"retypeapp": "^1.11.0"
},
"name": "docs",
"description": "Documentation/guide for Security Hammer.",
"version": "0.0.1-beta",
"main": "",
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "npx retype build & move build\\resources\\js\\service-worker.js build & node prebuilder.mjs & npx retype run"
},
"repository": {
"type": "git",
Expand Down
12 changes: 12 additions & 0 deletions prebuilder.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { writeFile } from 'fs/promises';

/*if ('serviceWorker' in navigator) {
console.log('[Service Worker] Registering the worker.');
navigator.serviceWorker.register('./service-worker.js', {scope: '/'}).then(() => console.log('CLIENT: service worker registration complete.'), err =>
console.log('CLIENT: service worker registration failure.' + err));
} else {
console.log('CLIENT: service worker is not supported.');
}*/
const data = '"serviceWorker"in navigator?(console.log("[Service Worker] Registering the worker."),navigator.serviceWorker.register("../service-worker.js").then(()=>console.log("[Service Worker] Registration complete."),e=>console.log("[Service Worker] Coudn\'t register because "+e))):console.log("[Service Worker] Browser not supported.");';

writeFile('./build/resources/js/retype.js', data, { flag: 'a'})
Binary file added resources/images/UnverifiedRole.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions resources/js/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const CacheVersion = 'v0.0.1'

files = [
'/',
'/404',
'/resources/css/retype.css',
'/resources/js/config.js',
'/resources/js/lunr.js',
'/resorces/js/retype.js',
'/resources/js/search.json',
'/resources/images/unverifiedrole.png',
'/guides/verification/'
]

self.addEventListener("install", e => {
console.log('[SW]: Installing and caching resources.');
e.waitUntil(caches.open(CacheVersion + '-cache').then(cache => {
return cache.addAll(files)
})
.then(function() {
console.log('[SW]: Installated Successfully!');
})
);
});

self.addEventListener("activate", e => {
console.log('[SW] Validating the cache and activating.');

e.waitUntil(caches.keys().then(function (keys) {
return Promise.all(
keys.filter(function (key) {
return !key.startsWith(CacheVersion);
})
.map(function (key) {
return caches.delete(key);
})
);
})
.then(function() {
console.log('[SW]: Validated and Activated.');
})
);
});

self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).then(function(response) {
return response || fetch(event.request);
})
);
});
4 changes: 2 additions & 2 deletions retype.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
input: .
output: ./build
url: https://shbot.onrender.com
url: https://shguide.onrender.com
branding:
title: Security Hammer
label: v2.0
label: beta
edit:
repo: https://github.com/Security-Hammer/docs
label: Edit on Github
Expand Down