-
-
Notifications
You must be signed in to change notification settings - Fork 725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better discord plugin #357
base: master
Are you sure you want to change the base?
Conversation
d87c2d4
to
e7868e3
Compare
Work has been paused, I haven't found a way to automatically get the token in the electron app. Might be impossible, so the only resort in that case would be to add the token text field back, and the user have to manually find it and put it there, But it's so much more work to explain that is easier to just tell people to use the web version. |
so I did some google searching, and found something that works for better discord. let gg;
let token;
for (let a in window.webpackJsonp ? (gg = window.webpackJsonp.push([
[], {
get_require: (a, b, c) => a.exports = c
},
[
['get_require']
]
]), delete gg.m.get_require, delete gg.c.get_require) : window.webpackChunkdiscord_app && window.webpackChunkdiscord_app.push([
[Math.random()], {},
a => {
gg = a
}
]), gg.c)
if (gg.c.hasOwnProperty(a)) {
let b = gg.c[a].exports;
if (b && b.__esModule && b.default)
for (let a in b.default) 'getToken' == a && (token = b.default.getToken())
};
console.log(token); I can upload the whole plugin code as well if needed, I got the code for getting the token of: |
@victornpb Can I commit the change here, I would use that method to fetch the token for the browser as well. Rewritten to export function getToken() {
let webpack, token;
if (window.webpackJsonp) {
const webpackJsonpArray = window.webpackJsonp.push([
[],
{
get_require: (module, exports, getter) => {
module.exports = getter;
},
},
[['get_require']],
]);
delete webpackJsonpArray.m.get_require;
delete webpackJsonpArray.c.get_require;
} else if (window.webpackChunkdiscord_app) {
window.webpackChunkdiscord_app.push([
[Math.random()],
{},
(module) => {
webpack = module;
},
]);
}
for (let moduleId in webpack.c) {
if (Object.prototype.hasOwnProperty.call(webpack.c, moduleId)) {
const moduleExports = webpack.c[moduleId].exports;
if (moduleExports && moduleExports.__esModule && moduleExports.default) {
const defaultExport = moduleExports.default;
for (let prop in defaultExport) {
if (prop === 'getToken') {
token = defaultExport.getToken();
}
}
}
}
}
return token;
} This should make it more readable, not sure if its 100% correct, but it works in both better discord and the browser. Seems to be the same like #439 |
@victornpb any update? |
Is it working? |
WIP