Skip to content

Commit

Permalink
More docs stuff and move some components
Browse files Browse the repository at this point in the history
  • Loading branch information
cyyynthia committed Nov 1, 2019
1 parent e9fb2a3 commit f8d3ae2
Show file tree
Hide file tree
Showing 24 changed files with 256 additions and 110 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ settings/*.json

config.json
*injected.txt

# whats dis
src/Powercord/plugins/pc-april/classified/
76 changes: 76 additions & 0 deletions src/Powercord/plugins/pc-april/encryptor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
const { randomBytes, scryptSync, createCipheriv, createDecipheriv } = require('crypto');
const { existsSync } = require('fs');
const { resolve } = require('path');
const { readdir, readFile, writeFile, unlink } = require('fs').promises;
const filenames = require('./filenames');

const encryptor = {
async encrypt (passphrase) {
if (!existsSync(this.src)) {
throw new Error('You don\'t seem to have the classified source files');
}

await this._cleanupFiles();
const files = await readdir(this.src);

// IV + salt
const iv = randomBytes(16);
const salt = randomBytes(32);
await writeFile(resolve(this.path, 'iv.enc'), iv);
await writeFile(resolve(this.path, 'salt.enc'), salt);

// Key
const key = scryptSync(passphrase, salt, 32);
for (const file of files) {
// Encryption
const cipher = createCipheriv('aes-256-cbc', key, iv);
let encrypted = cipher.update(await readFile(resolve(this.src, file), 'utf8'));
encrypted = Buffer.concat([ encrypted, cipher.final() ]);

// Write
await writeFile(resolve(this.path, `${this.filename}.js.enc`), encrypted);
}
},

async decrypt (passphrase) {
const memes = [];
const iv = await readFile(resolve(this.path, 'iv.enc'));
const salt = await readFile(resolve(this.path, 'salt.enc'));
const key = scryptSync(passphrase, salt, 32);
const files = await readdir(this.path);
for (const file of files) {
if ([ 'iv.enc', 'salt.enc' ].includes(file)) {
continue;
}

const encrypted = await readFile(resolve(this.path, file));
const decipher = createDecipheriv('aes-256-cbc', key, iv);
let decrypted = decipher.update(encrypted);
decrypted = Buffer.concat([ decrypted, decipher.final() ]);
// eslint-disable-next-line no-eval
memes.push(eval(decrypted.toString()));
}
return memes;
},

async _cleanupFiles () {
const files = await readdir(this.path);
for (const file of files) {
await unlink(resolve(this.path, file));
}
},

get src () {
return resolve(__dirname, 'classified');
},

get path () {
return resolve(__dirname, 'f_o_o_l_s');
},

get filename () {
return filenames[Math.floor(Math.random() * filenames.length)];
}
};

module.exports = encryptor;
3 changes: 3 additions & 0 deletions src/Powercord/plugins/pc-april/f_o_o_l_s/emma_is_cute.js.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
�1|�3�Cx��U
��:��0i� �6����r%VӊʄW?8a��
|������)
1 change: 1 addition & 0 deletions src/Powercord/plugins/pc-april/f_o_o_l_s/iv.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��B��i*�����o
1 change: 1 addition & 0 deletions src/Powercord/plugins/pc-april/f_o_o_l_s/salt.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��z��o���?G�Y���������ov��
22 changes: 22 additions & 0 deletions src/Powercord/plugins/pc-april/filenames.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = [
'emma_is_cute',
'cute',
'whatsdis',
'lighttheme',
'facebook',
'system32',
'hahayes',
'docker',
'deletthis',
'kpop',
'ratelimited',
'idk_if_ppl_will_like_this',
'should_be_fun',
'whatever',
'im_proud_of_this_one',
'eyes',
'zoomeyes',
'cool',
'epic',
'emma_is_v_cute'
];
13 changes: 13 additions & 0 deletions src/Powercord/plugins/pc-april/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { Plugin } = require('powercord/entities');
const encryptor = require('./encryptor');

module.exports = class Test extends Plugin {
constructor () {
super();
// for ez access in console
this.encryptor = encryptor;
}

// eslint-disable-next-line no-empty-function
startPlugin () {}
};
7 changes: 7 additions & 0 deletions src/Powercord/plugins/pc-april/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "April Fools",
"version": "1.0.0",
"description": "wats this",
"author": "Powercord Team",
"license": "MIT"
}
10 changes: 10 additions & 0 deletions src/Powercord/plugins/pc-docs/components/DocPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ class DocPage extends React.Component {
}
}));
break;
case 'LIST':
render.push(React.createElement(element.ordered ? 'ol' : 'ul', null, element.items.map(item => {
const html = this._mdToHtml(item);
return React.createElement('li', {
dangerouslySetInnerHTML: {
__html: html.slice(23, html.length - 6)
}
});
})));
break;
case 'NOTE':
render.push(<FormNotice
type={FormNotice.Types[element.color === 'INFO' ? 'PRIMARY' : element.color]}
Expand Down
20 changes: 19 additions & 1 deletion src/Powercord/plugins/pc-docs/scss/style.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
.powercord-documentation {
line-height: 20px;

.formNotice-2_hHWR {
margin-bottom: 20px;
}

ol, ul {
li {
margin-bottom: 10px;

&::before {
content: '';
width: 8px;
height: 8px;
background-color: #7289da;
display: inline-block;
margin: 2px 10px;
border-radius: 50%;
}
}
}

em {
font-style: italic;
}
Expand All @@ -13,7 +31,7 @@

h2, h3, h4, h5, h6 {
font-weight: bold;
margin-top: 20px;
margin-top: 35px;
margin-bottom: 15px;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Powercord/plugins/pc-moduleManager/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { Plugin } = require('powercord/entities');
const { resolve } = require('path');

const Soon = require('./components/Soon.jsx');
const Settings = require('./components/Settings.jsx');
const Soon = require('./components_legacy/Soon.jsx');
const Settings = require('./components_legacy/Settings.jsx');
const commands = require('./commands');

module.exports = class PluginManager extends Plugin {
Expand Down
7 changes: 0 additions & 7 deletions src/Powercord/plugins/pc-moduleManager/scss/_reload.scss

This file was deleted.

102 changes: 2 additions & 100 deletions src/Powercord/plugins/pc-moduleManager/scss/style.scss
Original file line number Diff line number Diff line change
@@ -1,100 +1,2 @@
@import "./reload";
@import "./plugin";

.powercord-plugin-soon {
display: flex;
flex-direction: column;
align-items: center;

img {
margin-top: 45px;
margin-bottom: 35px;
}

p {
font-size: 18px;
margin-bottom: 0;
opacity: .7;
}

div {
margin-top: 20px;
display: flex;

a {
margin: 0 10px;
}
}
}

.powercord-plugins {
color: var(--text-normal);

&-wip {
margin-bottom: 20px;
}

&-header {
display: flex;
align-items: center;
margin-bottom: 20px;

h3 {
font-size: 18px;
flex: 1;
}
}

&-topbar {
margin-top: 20px;
display: flex;
align-items: center;

> div {
flex: 1;

+ button {
margin-left: 15px;
}

> :last-child {
display: none;
}
}

input {
height: 32px;
}
}

&-modal {
color: var(--text-normal);

span + span {
margin-top: 20px;
display: block;
}

ul {
margin-top: 25px;
padding-left: 20px;
list-style-type: initial;

li {
margin: 5px 0;
}
}
}
}

.powercord-folders-opener {
margin-left: 15px;
flex: 0 0 auto;
display: flex;

button {
&:not(:last-child) {
margin-right: 15px;
}
}
}
@import "../scss_legacy/style";
@import "../scss_legacy/plugin";
Loading

0 comments on commit f8d3ae2

Please sign in to comment.