MCPcopy
hub / github.com/remotely-save/remotely-save / onOpen

Method onOpen

src/settings.ts:393–529  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

391 }
392
393 async onOpen() {
394 const { contentEl } = this;
395
396 const t = (x: TransItemType, vars?: any) => {
397 return this.plugin.i18n.t(x, vars);
398 };
399
400 let needManualPatse = false;
401 const userAgent = window.navigator.userAgent.toLocaleLowerCase() || "";
402 // some users report that,
403 // the Linux would open another instance Obsidian if jumping back,
404 // so fallback to manual paste on Linux
405 if (
406 Platform.isDesktopApp &&
407 !Platform.isMacOS &&
408 (/linux/.test(userAgent) ||
409 /ubuntu/.test(userAgent) ||
410 /debian/.test(userAgent) ||
411 /fedora/.test(userAgent) ||
412 /centos/.test(userAgent))
413 ) {
414 needManualPatse = true;
415 }
416
417 const { authUrl, verifier } = await getAuthUrlAndVerifierDropbox(
418 this.plugin.settings.dropbox.clientID,
419 needManualPatse
420 );
421
422 if (needManualPatse) {
423 t("modal_dropboxauth_manualsteps")
424 .split("\n")
425 .forEach((val) => {
426 contentEl.createEl("p", {
427 text: val,
428 });
429 });
430 } else {
431 this.plugin.oauth2Info.verifier = verifier;
432
433 t("modal_dropboxauth_autosteps")
434 .split("\n")
435 .forEach((val) => {
436 contentEl.createEl("p", {
437 text: val,
438 });
439 });
440 }
441
442 const div2 = contentEl.createDiv();
443 div2.createEl(
444 "button",
445 {
446 text: t("modal_dropboxauth_copybutton"),
447 },
448 (el) => {
449 el.onclick = async () => {
450 await navigator.clipboard.writeText(authUrl);

Callers

nothing calls this directly

Calls 4

getClientFunction · 0.90
saveSettingsMethod · 0.80
getUserDisplayNameMethod · 0.45

Tested by

no test coverage detected