Skip to content
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

Bandaged Better Discord's Custom CSS doesn't copy over. #47

Closed
PhoxVRC opened this issue Apr 3, 2021 · 2 comments
Closed

Bandaged Better Discord's Custom CSS doesn't copy over. #47

PhoxVRC opened this issue Apr 3, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@PhoxVRC
Copy link

PhoxVRC commented Apr 3, 2021

Describe the bug
Custom CSS from old Bandaged Discord doesn't move over.

To Reproduce
Steps to reproduce the behavior:

  1. Install Bandaged Discord
  2. Open custom CSS in settings and make some changes.
  3. Update to Better discord
  4. Custom CSS doesn't copy over.

Expected behavior
CSS is converted to newer version.

System Information:

  • OS: Windows 10 Pro
  • Discord Version: Stable
@PhoxVRC PhoxVRC added the bug Something isn't working label Apr 3, 2021
@dav1312
Copy link
Contributor

dav1312 commented Apr 3, 2021

Open the devtools with Ctrl + Shift + i
Go to Console
Paste this code and press enter

function getLegacyCustomCSS() {
    const fs = require('fs');
    let bdStorage = JSON.parse(fs.readFileSync(process.env.APPDATA + '\\BetterDiscord\\bdstorage.json', 'utf8'));
    BdApi.showConfirmationModal('Migrate Legacy Custom CSS', 
        [
            BdApi.React.createElement('div', {
                className: 'markup-2BOw-j'
            }, BdApi.React.createElement('pre', {
                style: {maxWidth: 'unset'}
            }, BdApi.React.createElement('code', {
                className: 'scrollbarGhostHairline-1mSOM1 scrollbar-3dvm_9 hljs'
            }, atob(bdStorage.bdcustomcss))))
        ],
        {
            danger: false,
            confirmText: 'Migrate CSS',
            onConfirm: () => {
                migrate('stable');
                migrate('ptb');
                migrate('canary');
            }
        }
    );
    function migrate(platform) {
        fs.appendFile(process.env.APPDATA + `\\BetterDiscord\\data\\${platform}\\custom.css`, atob(bdStorage.bdcustomcss), (err) => {
            if (err) {
                BdApi.showToast(`Could not migrate CSS on ${platform}.`, {type: 'danger'});
            } else {
                BdApi.showToast(`CSS migrated to ${process.env.APPDATA}\\BetterDiscord\\data\\${platform}\\custom.css`, {type: 'success'});
            }
        });
    }
}

getLegacyCustomCSS();

@PhoxVRC
Copy link
Author

PhoxVRC commented Apr 3, 2021

Thanks! It worked like a charm!

@PhoxVRC PhoxVRC closed this as completed Apr 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants