framework icon indicating copy to clipboard operation
framework copied to clipboard

support configuring custom CDN for various default plugins

Open Burial0268 opened this issue 2 years ago • 13 comments

Add a CDN option to emoji plug-in to solve the problem that JSDELIVR is unavailable in some areas.I think it's a good way to solve it(Translate by google)

Burial0268 avatar May 24 '22 05:05 Burial0268

+1 on this, jsdelivr is currently unaccessible in China mainland (TCP connection gets reset during https handshake). due to political reasons, public CDNs often doesn't live well in China (especially when they serve GitHub contents, which jsdelivr do), so it's VERY nice to specify custom private/commercial CDNs.

ref to related code:

https://github.com/flarum/emoji/blob/4582249a632be02e84b70ed54e2d01bd88820e6f/js/src/forum/cdn.js#L5 https://github.com/flarum/pusher/blob/b76645df6c92f53bd96ae3178344a1d0340cba41/js/src/forum/index.ts#L23

I believe I should cc @askvortsov1

frankli0324 avatar May 28 '22 12:05 frankli0324

ref https://github.com/flarum/framework/issues/822 https://github.com/flarum/framework/issues/3353

frankli0324 avatar May 28 '22 14:05 frankli0324

@Burial0268 please change the title into something like support configuring custom CDN for various official plugins thanks

frankli0324 avatar May 28 '22 15:05 frankli0324

@Burial0268 please change the title into something like support configuring custom CDN for various official plugins

oh thanks for your noticed

Burial0268 avatar May 28 '22 15:05 Burial0268

Also ref: https://github.com/flarum/emoji/pull/46

SychO9 avatar May 28 '22 19:05 SychO9

it seems that more individual components of flarum are integrated with jsdelivr than expected. it's there a true way out rather than dirty patches? patches destroys upgradability...

frankli0324 avatar May 31 '22 09:05 frankli0324

Hi, is there a plan how to support this setting option? I simply modified the Emoji Picker extension:

image
function loadEmojioneArea() {
    if (emojioneAreaLoaded) {
        return Promise.resolve();
    }

    emojioneAreaLoaded = true;

    return new Promise(resolve => {
        const style = document.createElement('link');
        style.rel = 'stylesheet';
        style.crossOrigin = 'anonymous';
        style.integrity = 'sha256-LKawN9UgfpZuYSE2HiCxxDxDgLOVDx2R4ogilBI52oc=';
        style.href = `${app.forum.attribute('emojioneAreaAssetsSource')}/[email protected]/dist/emojionearea.min.css`;
        document.head.appendChild(style);

        const script = document.createElement('script');
        script.crossOrigin = 'anonymous';
        script.integrity = 'sha256-ImIFrmJd7ymGlVw2MbtI96BNPW4NfcKqM3d1Go665Ig=';
        script.src = `${app.forum.attribute('emojioneAreaAssetsSource')}/[email protected]/dist/emojionearea.min.js`;
        script.onload = resolve;
        document.body.appendChild(script);
    });
}

ruibaby avatar Jun 01 '22 03:06 ruibaby

is this discussed somewhere else? could anyone post a link here, maybe toward some discussion in the official forum?

frankli0324 avatar Jun 04 '22 14:06 frankli0324

apart from https://github.com/flarum/emoji/pull/46 is is not discussed anywhere else as far as I know.

SychO9 avatar Jun 04 '22 16:06 SychO9

no one cares about accessibility or what? why?

frankli0324 avatar Jul 19 '22 20:07 frankli0324

We will get to it eventually, there's a lot on our plate.

SychO9 avatar Jul 19 '22 20:07 SychO9