MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / getShortLink

Method getShortLink

static/sharing.ts:437–458  ·  view source on GitHub ↗
(config: any, root: string, done: CallableFunction)

Source from the content-addressed store, hash-verified

435 }
436
437 private static getShortLink(config: any, root: string, done: CallableFunction): void {
438 const useExternalShortener = options.urlShortenService !== 'default';
439 const data = JSON.stringify({
440 config: useExternalShortener ? serialiseState(config) : config,
441 });
442 $.ajax({
443 type: 'POST',
444 url: window.location.origin + root + 'api/shortener',
445 dataType: 'json', // Expected
446 contentType: 'application/json', // Sent
447 data: data,
448 success: (result: any) => {
449 const pushState = useExternalShortener ? null : result.url;
450 done(null, result.url, pushState, true);
451 },
452 error: err => {
453 // Notify the user that we ran into trouble?
454 done(err.statusText, null, false);
455 },
456 cache: true,
457 });
458 }
459
460 private static getEmbeddedHtml(
461 config: any,

Callers 1

getLinksMethod · 0.80

Calls 1

serialiseStateFunction · 0.85

Tested by

no test coverage detected