feat(powercord): patch-out unnecessary plugins
Removes these built-in plugins: - pc-heygirl - pc-lmgtfy - pc-mock - pc-spotify - pc-updater
This commit is contained in:
parent
796554e918
commit
7d34bf5f61
6 changed files with 4040 additions and 0 deletions
|
@ -95,6 +95,14 @@
|
|||
defaultPackage = packages.powercord;
|
||||
packages = with channels.nixpkgs; {
|
||||
powercord = (discord-plugged.override {
|
||||
patches = (map patch [
|
||||
"remove-heygirl"
|
||||
"remove-lmgtfy"
|
||||
"remove-mock"
|
||||
"remove-spotify"
|
||||
"remove-updater"
|
||||
]);
|
||||
|
||||
plugins = with inputs; [
|
||||
discord-Custom-Volume-Range
|
||||
discord-In-app-notifs
|
||||
|
|
68
subflakes/powercord/patches/remove-heygirl.patch
Normal file
68
subflakes/powercord/patches/remove-heygirl.patch
Normal file
|
@ -0,0 +1,68 @@
|
|||
diff --git a/src/Powercord/plugins/pc-heygirl/index.js b/src/Powercord/plugins/pc-heygirl/index.js
|
||||
deleted file mode 100644
|
||||
index bd97579..0000000
|
||||
--- a/src/Powercord/plugins/pc-heygirl/index.js
|
||||
+++ /dev/null
|
||||
@@ -1,49 +0,0 @@
|
||||
-// idea based on http://heygirl.io/ (+used their images)
|
||||
-
|
||||
-const { Plugin } = require('powercord/entities');
|
||||
-
|
||||
-module.exports = class HeyGirl extends Plugin {
|
||||
- constructor () {
|
||||
- super();
|
||||
-
|
||||
- this.URLs = [].concat(
|
||||
- Array(3).fill('jpg'),
|
||||
- Array(2).fill('gif'),
|
||||
- Array(1).fill('png'),
|
||||
- Array(4).fill('gif'),
|
||||
- Array(3).fill('jpg'),
|
||||
- Array(1).fill('png')
|
||||
- ).map((format, id) => (
|
||||
- `http://heygirl.io/img/gosling-square-${id + 1}.${format}`
|
||||
- ));
|
||||
- }
|
||||
-
|
||||
- startPlugin () {
|
||||
- powercord.api.commands.registerCommand({
|
||||
- command: 'heygirl',
|
||||
- description: 'Replaces every image with a random image of Ryan Gosling',
|
||||
- usage: '{c}',
|
||||
- executor: this.heygirl.bind(this)
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- pluginWillUnload () {
|
||||
- powercord.api.commands.unregisterCommand('heygirl');
|
||||
- }
|
||||
-
|
||||
- getRandomURL () {
|
||||
- return this.URLs[Math.floor(Math.random() * this.URLs.length)];
|
||||
- }
|
||||
-
|
||||
- heygirl () {
|
||||
- document.querySelectorAll('[style*="background-image"]')
|
||||
- .forEach(({ style }) => (
|
||||
- style.backgroundImage = `url("${this.getRandomURL()}")`
|
||||
- ));
|
||||
-
|
||||
- document.querySelectorAll('img')
|
||||
- .forEach(image => (
|
||||
- image.src = this.getRandomURL()
|
||||
- ));
|
||||
- }
|
||||
-};
|
||||
diff --git a/src/Powercord/plugins/pc-heygirl/manifest.json b/src/Powercord/plugins/pc-heygirl/manifest.json
|
||||
deleted file mode 100644
|
||||
index 084c039..0000000
|
||||
--- a/src/Powercord/plugins/pc-heygirl/manifest.json
|
||||
+++ /dev/null
|
||||
@@ -1,7 +0,0 @@
|
||||
-{
|
||||
- "name": "Heygirl",
|
||||
- "version": "1.0.0",
|
||||
- "description": "heygirl",
|
||||
- "author": "Powercord Team",
|
||||
- "license": "MIT"
|
||||
-}
|
189
subflakes/powercord/patches/remove-lmgtfy.patch
Normal file
189
subflakes/powercord/patches/remove-lmgtfy.patch
Normal file
|
@ -0,0 +1,189 @@
|
|||
diff --git a/src/Powercord/plugins/pc-lmgtfy/Settings.jsx b/src/Powercord/plugins/pc-lmgtfy/Settings.jsx
|
||||
deleted file mode 100644
|
||||
index bd26ff3..0000000
|
||||
--- a/src/Powercord/plugins/pc-lmgtfy/Settings.jsx
|
||||
+++ /dev/null
|
||||
@@ -1,21 +0,0 @@
|
||||
-const { React } = require('powercord/webpack');
|
||||
-const { SwitchItem } = require('powercord/components/settings');
|
||||
-
|
||||
-module.exports = ({ getSetting, toggleSetting }) => (
|
||||
- <div>
|
||||
- <SwitchItem
|
||||
- note='Whether the LMGTFY command should enable "Internet Explainer" by default or not.'
|
||||
- value={getSetting('iie', false)}
|
||||
- onChange={() => toggleSetting('iie')}
|
||||
- >
|
||||
- Enable Internet Explainer
|
||||
- </SwitchItem>
|
||||
- <SwitchItem
|
||||
- note='Whether the LMGTFY command should display autocompletes by default or not.'
|
||||
- value={getSetting('autocompletes', true)}
|
||||
- onChange={() => toggleSetting('autocompletes')}
|
||||
- >
|
||||
- Display Autocompletes
|
||||
- </SwitchItem>
|
||||
- </div>
|
||||
-);
|
||||
diff --git a/src/Powercord/plugins/pc-lmgtfy/index.js b/src/Powercord/plugins/pc-lmgtfy/index.js
|
||||
deleted file mode 100644
|
||||
index 1c46bfb..0000000
|
||||
--- a/src/Powercord/plugins/pc-lmgtfy/index.js
|
||||
+++ /dev/null
|
||||
@@ -1,143 +0,0 @@
|
||||
-const { Plugin } = require('powercord/entities');
|
||||
-
|
||||
-const Constants = Object.freeze({
|
||||
- SEARCH_ENGINES: {
|
||||
- google: 'g',
|
||||
- lmgtfy: 'l',
|
||||
- bing: 'b',
|
||||
- yahoo: 'y',
|
||||
- aol: 'a',
|
||||
- ask: 'k',
|
||||
- duckduckgo: 'd',
|
||||
- snopes: 's',
|
||||
- startpage: 't'
|
||||
- },
|
||||
- SEARCH_TYPES: {
|
||||
- web: 'w',
|
||||
- images: 'i',
|
||||
- videos: 'v',
|
||||
- news: 'n',
|
||||
- shopping: 's'
|
||||
- }
|
||||
-});
|
||||
-
|
||||
-const Settings = require('./Settings');
|
||||
-
|
||||
-module.exports = class LMGTFY extends Plugin {
|
||||
- startPlugin () {
|
||||
- powercord.api.settings.registerSettings(this.entityID, {
|
||||
- category: this.entityID,
|
||||
- label: 'LMGTFY',
|
||||
- render: Settings
|
||||
- });
|
||||
-
|
||||
- powercord.api.commands.registerCommand({
|
||||
- command: 'lmgtfy',
|
||||
- description: 'Let me Google that for you...',
|
||||
- usage: '{c} [--iie] [...search terms] <search engine> <search type>',
|
||||
- executor: this.handleCommand.bind(this),
|
||||
- autocomplete: this.handleAutocomplete.bind(this)
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- pluginWillUnload () {
|
||||
- powercord.api.settings.unregisterSettings(this.entityID);
|
||||
- powercord.api.commands.unregisterCommand('lmgtfy');
|
||||
- }
|
||||
-
|
||||
- handleCommand (args) {
|
||||
- if (args.length < 1) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- const iie = args[0].includes('--iie') ? !!args.splice(args.indexOf('--iie'), 1) : this.settings.get('iie', false);
|
||||
- const options = args.slice(-2).map(arg => arg.toLowerCase());
|
||||
- const params = {};
|
||||
- params.searchEngine = Constants.SEARCH_ENGINES.google;
|
||||
-
|
||||
- for (const key of Object.keys(Constants)) {
|
||||
- if (key === 'SEARCH_ENGINES') {
|
||||
- for (const searchEngine of Object.keys(Constants[key])) {
|
||||
- for (let i = 0; i < options.length; i++) {
|
||||
- const match = options[i].toLowerCase() === searchEngine;
|
||||
- if (match) {
|
||||
- params.searchEngine = Constants.SEARCH_ENGINES[searchEngine];
|
||||
- args.splice(args.lastIndexOf(searchEngine), 1);
|
||||
- options.splice(i, 1);
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- } else if (key === 'SEARCH_TYPES') {
|
||||
- for (const searchType of Object.keys(Constants[key])) {
|
||||
- for (let i = 0; i < options.length; i++) {
|
||||
- const match = options[i].toLowerCase() === searchType;
|
||||
- if (match) {
|
||||
- if (params.searchEngine === 'g') {
|
||||
- params.searchType = Constants.SEARCH_TYPES[searchType];
|
||||
- args.splice(args.lastIndexOf(searchType), 1);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- const { searchEngine, searchType } = params;
|
||||
- const queryString = new URLSearchParams();
|
||||
- queryString.append('q', args.join(' '));
|
||||
- if (searchType) {
|
||||
- queryString.append('s', searchEngine);
|
||||
- queryString.append('t', searchType);
|
||||
- } else if (searchEngine !== 'g') {
|
||||
- queryString.append('s', searchEngine);
|
||||
- }
|
||||
-
|
||||
- if (iie) {
|
||||
- queryString.append('iie', +iie);
|
||||
- }
|
||||
-
|
||||
- return {
|
||||
- send: true,
|
||||
- result: `<https://lmgtfy.com/?${queryString}>`
|
||||
- };
|
||||
- }
|
||||
-
|
||||
- handleAutocomplete (args) {
|
||||
- if (!this.settings.get('autocompletes', true) || args.length === 0) {
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- if (args[1] === void 0) {
|
||||
- return {
|
||||
- commands: [ {
|
||||
- command: 'Please input your search terms...',
|
||||
- instruction: true
|
||||
- } ]
|
||||
- };
|
||||
- }
|
||||
-
|
||||
- const lastArg = args[args.length - 1];
|
||||
- const searchEngines = Object.keys(Constants.SEARCH_ENGINES);
|
||||
- const searchEngine = searchEngines.find(engine => args[args.lastIndexOf(engine)] === engine);
|
||||
- if (!searchEngine) {
|
||||
- return {
|
||||
- commands: searchEngines
|
||||
- .filter(engine => engine.includes(lastArg))
|
||||
- .map(engine => ({ command: engine })),
|
||||
- header: 'select a search engine...'
|
||||
- };
|
||||
- }
|
||||
-
|
||||
- const searchTypes = Object.keys(Constants.SEARCH_TYPES);
|
||||
- const searchType = searchTypes.find(type => args[args.indexOf(searchEngine) + 1] === type);
|
||||
- if (searchEngine === 'google' && !searchType) {
|
||||
- return {
|
||||
- commands: searchTypes
|
||||
- .filter(type => type.includes(lastArg))
|
||||
- .map(type => ({ command: type })),
|
||||
- header: 'select a search type...'
|
||||
- };
|
||||
- }
|
||||
- }
|
||||
-};
|
||||
diff --git a/src/Powercord/plugins/pc-lmgtfy/manifest.json b/src/Powercord/plugins/pc-lmgtfy/manifest.json
|
||||
deleted file mode 100644
|
||||
index 08a9989..0000000
|
||||
--- a/src/Powercord/plugins/pc-lmgtfy/manifest.json
|
||||
+++ /dev/null
|
||||
@@ -1,7 +0,0 @@
|
||||
-{
|
||||
- "name": "LMGTFY",
|
||||
- "version": "1.0.0",
|
||||
- "description": "Let me Google that for you...",
|
||||
- "author": "Powercord Team",
|
||||
- "license": "MIT"
|
||||
-}
|
38
subflakes/powercord/patches/remove-mock.patch
Normal file
38
subflakes/powercord/patches/remove-mock.patch
Normal file
|
@ -0,0 +1,38 @@
|
|||
diff --git a/src/Powercord/plugins/pc-mock/index.js b/src/Powercord/plugins/pc-mock/index.js
|
||||
deleted file mode 100644
|
||||
index e35988b..0000000
|
||||
--- a/src/Powercord/plugins/pc-mock/index.js
|
||||
+++ /dev/null
|
||||
@@ -1,19 +0,0 @@
|
||||
-const { Plugin } = require('powercord/entities');
|
||||
-
|
||||
-module.exports = class Mock extends Plugin {
|
||||
- startPlugin () {
|
||||
- powercord.api.commands.registerCommand({
|
||||
- command: 'mock',
|
||||
- description: 'Mock a user...',
|
||||
- usage: '{c} [text to mock]',
|
||||
- executor: (args) => ({
|
||||
- send: true,
|
||||
- result: args.join(' ').split('').map((c, i) => i % 2 ? c.toUpperCase() : c).join('')
|
||||
- })
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- pluginWillUnload () {
|
||||
- powercord.api.commands.unregisterCommand('mock');
|
||||
- }
|
||||
-};
|
||||
diff --git a/src/Powercord/plugins/pc-mock/manifest.json b/src/Powercord/plugins/pc-mock/manifest.json
|
||||
deleted file mode 100644
|
||||
index 8b0bc06..0000000
|
||||
--- a/src/Powercord/plugins/pc-mock/manifest.json
|
||||
+++ /dev/null
|
||||
@@ -1,7 +0,0 @@
|
||||
-{
|
||||
- "name": "Mock",
|
||||
- "version": "1.0.0",
|
||||
- "description": "Mock people",
|
||||
- "author": "Melmsie",
|
||||
- "license": "MIT"
|
||||
-}
|
2551
subflakes/powercord/patches/remove-spotify.patch
Normal file
2551
subflakes/powercord/patches/remove-spotify.patch
Normal file
File diff suppressed because it is too large
Load diff
1186
subflakes/powercord/patches/remove-updater.patch
Normal file
1186
subflakes/powercord/patches/remove-updater.patch
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue