From 41767291d78c3c18ac8336977bc5c500d2f42437 Mon Sep 17 00:00:00 2001 From: Marcin Czenko Date: Thu, 31 Oct 2024 11:02:58 +0100 Subject: [PATCH] Update docs --- .gitignore | 3 +- .obsidian/app.json | 3 +- .obsidian/daily-notes.json | 2 +- .obsidian/plugins/query-control/main.js | 10 +- .obsidian/plugins/query-control/manifest.json | 2 +- 00 Planner/01 Days/2024-10-27, Sun.md | 0 00 Planner/01 Days/2024-10-28, Mon.md | 0 00 Planner/01 Days/2024-10-29, Tue.md | 0 10 Notes/BEP5 - DHT Protocol.md | 20 ++ 10 Notes/BitTorrent Tracker.md | 18 ++ ...orrent-Codex integration may look like?.md | 1 + ...centives Build Robustness in BitTorrent.md | 10 +- 10 Notes/Learn BitTorrent.md | 9 +- 10 Notes/Transmission.md | 242 +++++++++++++++++- README.md | 10 +- 15 files changed, 304 insertions(+), 26 deletions(-) delete mode 100644 00 Planner/01 Days/2024-10-27, Sun.md delete mode 100644 00 Planner/01 Days/2024-10-28, Mon.md delete mode 100644 00 Planner/01 Days/2024-10-29, Tue.md create mode 100644 10 Notes/BEP5 - DHT Protocol.md create mode 100644 10 Notes/BitTorrent Tracker.md create mode 100644 10 Notes/How BitTorrent-Codex integration may look like?.md diff --git a/.gitignore b/.gitignore index a019cf6..ab112ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store .obsidian/publish.json -.obsidian/workspace*.json \ No newline at end of file +.obsidian/workspace*.json +"00 Planner" diff --git a/.obsidian/app.json b/.obsidian/app.json index 5f33603..f53f5bc 100644 --- a/.obsidian/app.json +++ b/.obsidian/app.json @@ -1,6 +1,5 @@ { "newFileLocation": "folder", "newFileFolderPath": "10 Notes", - "attachmentFolderPath": "90 Extras/92 Assets", - "alwaysUpdateLinks": true + "attachmentFolderPath": "90 Extras/92 Assets" } \ No newline at end of file diff --git a/.obsidian/daily-notes.json b/.obsidian/daily-notes.json index 3f1f477..1d10315 100644 --- a/.obsidian/daily-notes.json +++ b/.obsidian/daily-notes.json @@ -1,5 +1,5 @@ { "format": "YYYY-MM-DD, ddd", "folder": "00 Planner/01 Days", - "autorun": true + "autorun": false } \ No newline at end of file diff --git a/.obsidian/plugins/query-control/main.js b/.obsidian/plugins/query-control/main.js index 92cf5c3..1dc2fe3 100644 --- a/.obsidian/plugins/query-control/main.js +++ b/.obsidian/plugins/query-control/main.js @@ -3,10 +3,10 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ -var N=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var U=(l,h)=>{for(var r in h)N(l,r,{get:h[r],enumerable:!0})},X=(l,h,r,e)=>{if(h&&typeof h=="object"||typeof h=="function")for(let n of W(h))!G.call(l,n)&&n!==r&&N(l,n,{get:()=>h[n],enumerable:!(e=j(h,n))||e.enumerable});return l};var Y=l=>X(N({},"__esModule",{value:!0}),l);var v=(l,h,r)=>new Promise((e,n)=>{var s=i=>{try{o(r.next(i))}catch(a){n(a)}},t=i=>{try{o(r.throw(i))}catch(a){n(a)}},o=i=>i.done?e(i.value):Promise.resolve(i.value).then(s,t);o((r=r.apply(l,h)).next())});var ee={};U(ee,{default:()=>L});module.exports=Y(ee);function k(l,h){let r=Object.keys(h).map(e=>J(l,e,h[e]));return r.length===1?r[0]:function(){r.forEach(e=>e())}}function J(l,h,r){let e=l[h],n=l.hasOwnProperty(h),s=n?e:function(){return Object.getPrototypeOf(l)[h].apply(this,arguments)},t=r(s);return e&&Object.setPrototypeOf(t,e),Object.setPrototypeOf(o,t),l[h]=o,i;function o(...a){return t===s&&l[h]===o&&i(),t.apply(this,a)}function i(){l[h]===o&&(n?l[h]=s:delete l[h]),t!==s&&(t=s,Object.setPrototypeOf(o,e||Function))}}var p=require("obsidian");var V=require("obsidian");var B=class extends V.MarkdownRenderer{constructor(r,e,n){super(r,e);this.app=r,this.match=n,this.subpath="",this.indent="",this.filePath=this.match.parentDom.path,this.file=this.match.parentDom.file,this.renderer.previewEl.onNodeInserted(()=>(this.updateOptions(),this.renderer.onResize()))}updateOptions(){let r=this.app.vault.getConfig("readableLineLength");this.renderer.previewEl.toggleClass("is-readable-line-width",r);let e=this.app.vault.getConfig("foldHeading");this.renderer.previewEl.toggleClass("allow-fold-headings",e);let n=this.app.vault.getConfig("foldIndent");this.renderer.previewEl.toggleClass("allow-fold-lists",n),this.renderer.previewEl.toggleClass("rtl",this.app.vault.getConfig("rightToLeft")),e||this.renderer.unfoldAllHeadings(),n||this.renderer.unfoldAllLists(),this.renderer.previewEl.toggleClass("show-frontmatter",this.app.vault.getConfig("showFrontmatter"));let s=this.app.vault.getConfig("tabSize");this.renderer.previewEl.style.tabSize=String(s),this.renderer.rerender()}onRenderComplete(){}getFile(){return this.match.parent.file}edit(r){return v(this,null,function*(){var a;this.renderer.set(r);let e=yield this.app.vault.cachedRead(this.file),s=(a=e.slice(this.match.start,this.match.end).match(/^\s+/g))==null?void 0:a.first();s&&(r=r.replace(/^/gm,s));let t=e.slice(0,this.match.start),o=e.slice(this.match.end,this.match.parent.content.length);var i=t+r+o;this.app.vault.modify(this.file,i)})}};var b=require("obsidian");var M=i18next.t.bind(i18next);var I={defaultCollapse:!1,defaultShowContext:!1,defaultHideTitle:!1,defaultHideResults:!1,defaultRenderMarkdown:!1,defaultSortOrder:"alphabetical"},R=[{key:"alphabetical",label:M("plugins.file-explorer.label-sort-a-to-z")},{key:"alphabeticalReverse",label:M("plugins.file-explorer.label-sort-z-to-a")},{key:"byModifiedTime",label:M("plugins.file-explorer.label-sort-new-to-old")},{key:"byModifiedTimeReverse",label:M("plugins.file-explorer.label-sort-old-to-new")},{key:"byCreatedTime",label:M("plugins.file-explorer.label-sort-created-new-to-old")},{key:"byCreatedTimeReverse",label:M("plugins.file-explorer.label-sort-created-old-to-new")}],H=class extends b.PluginSettingTab{constructor(r,e){super(r,e);this.plugin=e}hide(){}display(){let{containerEl:r}=this;r.empty(),new b.Setting(r).setName("Collapse query results by default").addToggle(e=>e.setValue(this.plugin.settings.defaultCollapse).onChange(n=>{this.plugin.settings.defaultCollapse=n,this.plugin.saveSettings()})),new b.Setting(r).setName("Show additional query result context by default").addToggle(e=>e.setValue(this.plugin.settings.defaultShowContext).onChange(n=>{this.plugin.settings.defaultShowContext=n,this.plugin.saveSettings()})),new b.Setting(r).setName("Hide query title by default").addToggle(e=>e.setValue(this.plugin.settings.defaultHideTitle).onChange(n=>{this.plugin.settings.defaultHideTitle=n,this.plugin.saveSettings()})),new b.Setting(r).setName("Hide query results by default").addToggle(e=>e.setValue(this.plugin.settings.defaultHideResults).onChange(n=>{this.plugin.settings.defaultHideResults=n,this.plugin.saveSettings()})),new b.Setting(r).setName("Render results as Markdown by default").addToggle(e=>e.setValue(this.plugin.settings.defaultRenderMarkdown).onChange(n=>{this.plugin.settings.defaultRenderMarkdown=n,this.plugin.saveSettings()})),new b.Setting(r).setName("Default query result sort order").addDropdown(e=>{e.addOptions(R),e.setValue(this.plugin.settings.defaultSortOrder),e.onChange(n=>v(this,null,function*(){this.plugin.settings.defaultSortOrder=n,yield this.plugin.saveSettings()}))})}};function $(l,h,r,e,n){let s=document.getElementById("query-control-sort-tooltip");if(s){s.remove();return}let t=document.createElement("div");t.classList.add("query-control-sort-tooltip");let o=h.getBoundingClientRect();t.style.top=`${o.bottom+window.scrollY+5}px`,t.style.left=`${o.left+window.scrollX}px`,l.forEach(u=>{let f=document.createElement("div");if(f.classList.add("query-control-sort-option"),f.textContent=u.label,u.key===e){f.setAttribute("aria-current","true");let C=document.createElement("span");C.textContent="\u2714\uFE0F",C.classList.add("query-control-sort-option-checkmark"),f.appendChild(C)}f.addEventListener("click",()=>{r(u.key),t.remove()}),t.appendChild(f)}),document.body.appendChild(t);let i=()=>{document.removeEventListener("mousedown",c,!0),document.removeEventListener("touchstart",c,!0),document.removeEventListener("click",c,!0),document.removeEventListener("keydown",g,!0),n.workspace.off("active-leaf-change",a)},a=()=>{t.parentElement&&(t.remove(),i())},c=u=>{!t.contains(u.target)&&!h.contains(u.target)&&(t.remove(),i())},g=u=>{t.remove(),i()};document.addEventListener("mousedown",c,!0),document.addEventListener("touchstart",c,!0),document.addEventListener("click",c),document.addEventListener("keydown",g,!0),n.workspace.on("active-leaf-change",a)}var Z=!1;var F=new WeakMap,L=class extends p.Plugin{onload(){return v(this,null,function*(){yield this.loadSettings();let r=this;this.registerSettingsTab(),this.register(k(this.app.viewRegistry.constructor.prototype,{registerView(n){return function(s,t,...o){return r.app.workspace.trigger("view-registered",s,t),n.call(this,s,t,...o)}}}));let e;if(!this.app.workspace.layoutReady){let n=this.app.workspace.on("view-registered",(t,o)=>{if(t!=="search")return;this.app.workspace.offref(n);let i=new p.WorkspaceLeaf(r.app),a=o(i);r.patchNativeSearch(a);let c=k(p.Modal.prototype,{open(g){return function(...u){r.SearchResultsExport=this.constructor}}});a.onCopyResultsClick(new MouseEvent(null)),c()}),s=this.app.workspace.on("view-registered",(t,o)=>{if(t!=="backlink")return;this.app.workspace.offref(s);let i=new p.WorkspaceLeaf(r.app),a=o(i);r.SearchHeaderDOM=a.backlink.headerDom.constructor})}this.register(e=k(p.Component.prototype,{addChild(n){return function(s,...t){try{if(!r.isSearchPatched&&s instanceof p.Component&&s.hasOwnProperty("searchQuery")&&s.hasOwnProperty("sourcePath")&&s.hasOwnProperty("dom")){let i=s;r.patchSearchView(i),r.isSearchPatched=!0}if(s instanceof p.Component&&s.hasOwnProperty("backlinkDom")){let i=s;F.set(i.backlinkDom.el.closest(".backlink-pane"),s),r.isBacklinksPatched||(r.patchBacklinksView(i),r.isBacklinksPatched=!0)}}catch(i){console.error("Error in Component.addChild around patch:",i)}return n.call(this,s,...t)}}}))})}loadSettings(){return v(this,null,function*(){this.settings=Object.assign({},I,yield this.loadData())})}saveSettings(){return v(this,null,function*(){yield this.saveData(this.settings)})}registerSettingsTab(){this.settingsTab=new H(this.app,this),this.addSettingTab(this.settingsTab)}getSearchHeader(){var n,s,t;let r=(n=this.app.workspace.getLeavesOfType("backlink"))==null?void 0:n.first();r==null||r.loadIfDeferred();let e=(t=(s=r==null?void 0:r.view)==null?void 0:s.backlink)==null?void 0:t.headerDom;return e==null?void 0:e.constructor}onunload(){Z&&console.log("EmbeddedQueryControlPlugin: onunload")}patchNativeSearch(r){let e=this;this.register(k(r.constructor.prototype,{onResize(n){return function(...s){var o;let t=(o=this.dom.vChildren)==null?void 0:o._children;return this.dom.el.clientWidth===0?(t.forEach(i=>{i.setCollapse(!0,!1)}),this.dom.hidden=!0):this.dom.hidden&&(this.dom.hidden=!1,setTimeout(()=>{t.forEach(i=>{i.setCollapse(this.dom.collapseAll,!1)})},100)),n.call(this,...s)}},stopSearch(n){return function(...s){let t=n.call(this,...s);return this.renderComponent&&(this.renderComponent.unload(),this.renderComponent=new p.Component),t}},addChild(n){return function(...s){var o;try{if(!this.patched){this.renderComponent||(this.renderComponent=new p.Component,this.renderComponent.load()),this.patched=!0,this.dom.parent=this,e.patchSearchResultDOM(this.dom.constructor),this.setRenderMarkdown=function(a){var g,u;let c=(g=this.dom.vChildren)==null?void 0:g._children;this.dom.renderMarkdown=a,c.forEach(f=>{f.renderContentMatches()}),this.dom.infinityScroll.invalidateAll(),this.dom.childrenEl.toggleClass("cm-preview-code-block",a),this.dom.childrenEl.toggleClass("is-rendered",a),(u=this.renderMarkdownButtonEl)==null||u.toggleClass("is-active",a)},this.renderMarkdownButtonEl=(o=this.headerDom)==null?void 0:o.addNavButton("reading-glasses","Render Markdown",()=>this.setRenderMarkdown(!this.dom.renderMarkdown));let i={renderMarkdown:e.settings.defaultRenderMarkdown};this.settings||(this.settings={}),Object.entries(i).forEach(([a,c])=>{this.settings.hasOwnProperty(a)?a==="sort"&&!R.hasOwnProperty(this.settings.sort)&&(this.settings[a]=c):this.settings[a]=c}),this.setRenderMarkdown(this.settings.renderMarkdown)}}catch(i){console.error("Error in searchView.addChild around patch:",i)}return n.call(this,...s)}}}))}patchSearchResultDOM(r){let e=this,n=k(r.prototype,{addResult(s){return function(...t){n();let o=s.call(this,...t),i=o.constructor;return e.isSearchResultItemPatched||e.patchSearchResultItem(i),o}}});this.register(n),this.register(k(r.prototype,{startLoader(s){return function(...t){var i,a,c,g,u,f;try{let C=this.el.closest(".backlink-pane"),x=F.get(C);if(C&&x&&(x.patched||K(this,e,C,x)),!((a=(i=this.parent)==null?void 0:i.searchParamsContainerEl)!=null&&a.patched)&&((g=(c=this.el)==null?void 0:c.parentElement)==null?void 0:g.getAttribute("data-type"))==="search"&&(this.parent.searchParamsContainerEl.patched=!0,new p.Setting(this.parent.searchParamsContainerEl).setName("Render Markdown").setClass("mod-toggle").addToggle(O=>{O.setValue(e.settings.defaultRenderMarkdown),O.onChange(E=>{var T;this.renderMarkdown=E,((T=this.vChildren)==null?void 0:T._children).forEach(d=>{d.renderContentMatches()}),this.infinityScroll.invalidateAll(),this.childrenEl.toggleClass("cm-preview-code-block",E),this.childrenEl.toggleClass("is-rendered",E)})})),!this.patched&&((u=this.el.parentElement)==null?void 0:u.hasClass("internal-query"))){let O=e.SearchHeaderDOM?e.SearchHeaderDOM:e.getSearchHeader();if(!O){console.error("Error: _SearchHeaderDOM is undefined. Cannot create headerDom.");return}if((f=this.el)!=null&&f.closest(".internal-query")){this.patched=!0;let E=this.el.parentElement.querySelector(".internal-query-header");this.setExtraContext=function(d){var w;let y=(w=this.vChildren)==null?void 0:w._children;this.extraContext=d,this.extraContextButtonEl.toggleClass("is-active",d),y.forEach(m=>{m.setExtraContext(d)}),this.infinityScroll.invalidateAll()},this.setTitleDisplay=function(d){this.showTitle=d,this.showTitleButtonEl.toggleClass("is-active",d),E.toggleClass("is-hidden",d)},this.setResultsDisplay=function(d){this.showResults=d,this.showResultsButtonEl.toggleClass("is-active",d),this.el.toggleClass("is-hidden",d)},this.setRenderMarkdown=function(d){var w;this.renderMarkdown=d,((w=this.vChildren)==null?void 0:w._children).forEach(m=>{m.renderContentMatches()}),this.infinityScroll.invalidateAll(),this.childrenEl.toggleClass("cm-preview-code-block",d),this.childrenEl.toggleClass("is-rendered",d),this.renderMarkdownButtonEl.toggleClass("is-active",d)},this.setCollapseAll=function(d){var w;let y=(w=this.vChildren)==null?void 0:w._children;this.collapseAllButtonEl.toggleClass("is-active",d),this.collapseAll=d,y.forEach(m=>{m.setCollapse(d,!1)}),this.infinityScroll.invalidateAll()},this.setSortOrder=d=>{this.sortOrder=d,this.changed(),this.infinityScroll.invalidateAll()},this.onCopyResultsClick=d=>v(this,null,function*(){var A,P;d.preventDefault();let y=[],w=(A=this.vChildren)==null?void 0:A._children;for(let D of w){let Q=D.file.path,q="",z=(P=D.vChildren)==null?void 0:P._children;for(let _ of z)q+=_.parent.content.substring(_.start,_.end)+` +var N=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var U=(a,h)=>{for(var t in h)N(a,t,{get:h[t],enumerable:!0})},X=(a,h,t,e)=>{if(h&&typeof h=="object"||typeof h=="function")for(let n of W(h))!G.call(a,n)&&n!==t&&N(a,n,{get:()=>h[n],enumerable:!(e=j(h,n))||e.enumerable});return a};var Y=a=>X(N({},"__esModule",{value:!0}),a);var v=(a,h,t)=>new Promise((e,n)=>{var s=i=>{try{o(t.next(i))}catch(l){n(l)}},r=i=>{try{o(t.throw(i))}catch(l){n(l)}},o=i=>i.done?e(i.value):Promise.resolve(i.value).then(s,r);o((t=t.apply(a,h)).next())});var te={};U(te,{default:()=>L});module.exports=Y(te);function k(a,h){let t=Object.keys(h).map(e=>J(a,e,h[e]));return t.length===1?t[0]:function(){t.forEach(e=>e())}}function J(a,h,t){let e=a[h],n=a.hasOwnProperty(h),s=n?e:function(){return Object.getPrototypeOf(a)[h].apply(this,arguments)},r=t(s);return e&&Object.setPrototypeOf(r,e),Object.setPrototypeOf(o,r),a[h]=o,i;function o(...l){return r===s&&a[h]===o&&i(),r.apply(this,l)}function i(){a[h]===o&&(n?a[h]=s:delete a[h]),r!==s&&(r=s,Object.setPrototypeOf(o,e||Function))}}var p=require("obsidian");var V=require("obsidian");var B=class extends V.MarkdownRenderer{constructor(t,e,n){super(t,e);this.app=t,this.match=n,this.subpath="",this.indent="",this.filePath=this.match.parentDom.path,this.file=this.match.parentDom.file,this.renderer.previewEl.onNodeInserted(()=>(this.updateOptions(),this.renderer.onResize()))}updateOptions(){let t=this.app.vault.getConfig("readableLineLength");this.renderer.previewEl.toggleClass("is-readable-line-width",t);let e=this.app.vault.getConfig("foldHeading");this.renderer.previewEl.toggleClass("allow-fold-headings",e);let n=this.app.vault.getConfig("foldIndent");this.renderer.previewEl.toggleClass("allow-fold-lists",n),this.renderer.previewEl.toggleClass("rtl",this.app.vault.getConfig("rightToLeft")),e||this.renderer.unfoldAllHeadings(),n||this.renderer.unfoldAllLists(),this.renderer.previewEl.toggleClass("show-frontmatter",this.app.vault.getConfig("showFrontmatter"));let s=this.app.vault.getConfig("tabSize");this.renderer.previewEl.style.tabSize=String(s),this.renderer.rerender()}onRenderComplete(){}getFile(){return this.match.parent.file}edit(t){return v(this,null,function*(){var l;this.renderer.set(t);let e=yield this.app.vault.cachedRead(this.file),s=(l=e.slice(this.match.start,this.match.end).match(/^\s+/g))==null?void 0:l.first();s&&(t=t.replace(/^/gm,s));let r=e.slice(0,this.match.start),o=e.slice(this.match.end,this.match.parent.content.length);var i=r+t+o;this.app.vault.modify(this.file,i)})}};var b=require("obsidian");var M=i18next.t.bind(i18next);var I={defaultCollapse:!1,defaultShowContext:!1,defaultHideTitle:!1,defaultHideResults:!1,defaultRenderMarkdown:!1,defaultSortOrder:"alphabetical"},R=[{key:"alphabetical",label:M("plugins.file-explorer.label-sort-a-to-z")},{key:"alphabeticalReverse",label:M("plugins.file-explorer.label-sort-z-to-a")},{key:"byModifiedTime",label:M("plugins.file-explorer.label-sort-new-to-old")},{key:"byModifiedTimeReverse",label:M("plugins.file-explorer.label-sort-old-to-new")},{key:"byCreatedTime",label:M("plugins.file-explorer.label-sort-created-new-to-old")},{key:"byCreatedTimeReverse",label:M("plugins.file-explorer.label-sort-created-old-to-new")}],Z=a=>a.reduce((h,t)=>(h[t.key]=t.label,h),{}),H=class extends b.PluginSettingTab{constructor(t,e){super(t,e);this.plugin=e}hide(){}display(){let{containerEl:t}=this;t.empty(),new b.Setting(t).setName("Collapse query results by default").addToggle(e=>e.setValue(this.plugin.settings.defaultCollapse).onChange(n=>{this.plugin.settings.defaultCollapse=n,this.plugin.saveSettings()})),new b.Setting(t).setName("Show additional query result context by default").addToggle(e=>e.setValue(this.plugin.settings.defaultShowContext).onChange(n=>{this.plugin.settings.defaultShowContext=n,this.plugin.saveSettings()})),new b.Setting(t).setName("Hide query title by default").addToggle(e=>e.setValue(this.plugin.settings.defaultHideTitle).onChange(n=>{this.plugin.settings.defaultHideTitle=n,this.plugin.saveSettings()})),new b.Setting(t).setName("Hide query results by default").addToggle(e=>e.setValue(this.plugin.settings.defaultHideResults).onChange(n=>{this.plugin.settings.defaultHideResults=n,this.plugin.saveSettings()})),new b.Setting(t).setName("Render results as Markdown by default").addToggle(e=>e.setValue(this.plugin.settings.defaultRenderMarkdown).onChange(n=>{this.plugin.settings.defaultRenderMarkdown=n,this.plugin.saveSettings()})),new b.Setting(t).setName("Default query result sort order").addDropdown(e=>{e.addOptions(Z(R)),e.setValue(this.plugin.settings.defaultSortOrder),e.onChange(n=>v(this,null,function*(){this.plugin.settings.defaultSortOrder=n,yield this.plugin.saveSettings()}))})}};function $(a,h,t,e,n){let s=document.getElementById("query-control-sort-tooltip");if(s){s.remove();return}let r=document.createElement("div");r.classList.add("query-control-sort-tooltip");let o=h.getBoundingClientRect();r.style.top=`${o.bottom+window.scrollY+5}px`,r.style.left=`${o.left+window.scrollX}px`,a.forEach(u=>{let f=document.createElement("div");if(f.classList.add("query-control-sort-option"),f.textContent=u.label,u.key===e){f.setAttribute("aria-current","true");let C=document.createElement("span");C.textContent="\u2714\uFE0F",C.classList.add("query-control-sort-option-checkmark"),f.appendChild(C)}f.addEventListener("click",()=>{t(u.key),r.remove()}),r.appendChild(f)}),document.body.appendChild(r);let i=()=>{document.removeEventListener("mousedown",c,!0),document.removeEventListener("touchstart",c,!0),document.removeEventListener("click",c,!0),document.removeEventListener("keydown",g,!0),n.workspace.off("active-leaf-change",l)},l=()=>{r.parentElement&&(r.remove(),i())},c=u=>{!r.contains(u.target)&&!h.contains(u.target)&&(r.remove(),i())},g=u=>{r.remove(),i()};document.addEventListener("mousedown",c,!0),document.addEventListener("touchstart",c,!0),document.addEventListener("click",c),document.addEventListener("keydown",g,!0),n.workspace.on("active-leaf-change",l)}var K=!1;var F=new WeakMap,L=class extends p.Plugin{onload(){return v(this,null,function*(){yield this.loadSettings();let t=this;this.registerSettingsTab(),this.register(k(this.app.viewRegistry.constructor.prototype,{registerView(n){return function(s,r,...o){return t.app.workspace.trigger("view-registered",s,r),n.call(this,s,r,...o)}}}));let e;if(!this.app.workspace.layoutReady){let n=this.app.workspace.on("view-registered",(r,o)=>{if(r!=="search")return;this.app.workspace.offref(n);let i=new p.WorkspaceLeaf(t.app),l=o(i);t.patchNativeSearch(l);let c=k(p.Modal.prototype,{open(g){return function(...u){t.SearchResultsExport=this.constructor}}});l.onCopyResultsClick(new MouseEvent(null)),c()}),s=this.app.workspace.on("view-registered",(r,o)=>{if(r!=="backlink")return;this.app.workspace.offref(s);let i=new p.WorkspaceLeaf(t.app),l=o(i);t.SearchHeaderDOM=l.backlink.headerDom.constructor})}this.register(e=k(p.Component.prototype,{addChild(n){return function(s,...r){try{if(!t.isSearchPatched&&s instanceof p.Component&&s.hasOwnProperty("searchQuery")&&s.hasOwnProperty("sourcePath")&&s.hasOwnProperty("dom")){let i=s;t.patchSearchView(i),t.isSearchPatched=!0}if(s instanceof p.Component&&s.hasOwnProperty("backlinkDom")){let i=s;F.set(i.backlinkDom.el.closest(".backlink-pane"),s),t.isBacklinksPatched||(t.patchBacklinksView(i),t.isBacklinksPatched=!0)}}catch(i){console.error("Error in Component.addChild around patch:",i)}return n.call(this,s,...r)}}}))})}loadSettings(){return v(this,null,function*(){this.settings=Object.assign({},I,yield this.loadData())})}saveSettings(){return v(this,null,function*(){yield this.saveData(this.settings)})}registerSettingsTab(){this.settingsTab=new H(this.app,this),this.addSettingTab(this.settingsTab)}getSearchHeader(){var n,s,r;let t=(n=this.app.workspace.getLeavesOfType("backlink"))==null?void 0:n.first();t==null||t.loadIfDeferred();let e=(r=(s=t==null?void 0:t.view)==null?void 0:s.backlink)==null?void 0:r.headerDom;return e==null?void 0:e.constructor}onunload(){K&&console.log("EmbeddedQueryControlPlugin: onunload")}patchNativeSearch(t){let e=this;this.register(k(t.constructor.prototype,{onResize(n){return function(...s){var o;let r=(o=this.dom.vChildren)==null?void 0:o._children;return this.dom.el.clientWidth===0?(r.forEach(i=>{i.setCollapse(!0,!1)}),this.dom.hidden=!0):this.dom.hidden&&(this.dom.hidden=!1,setTimeout(()=>{r.forEach(i=>{i.setCollapse(this.dom.collapseAll,!1)})},100)),n.call(this,...s)}},stopSearch(n){return function(...s){let r=n.call(this,...s);return this.renderComponent&&(this.renderComponent.unload(),this.renderComponent=new p.Component),r}},addChild(n){return function(...s){var o;try{if(!this.patched){this.renderComponent||(this.renderComponent=new p.Component,this.renderComponent.load()),this.patched=!0,this.dom.parent=this,e.patchSearchResultDOM(this.dom.constructor),this.setRenderMarkdown=function(l){var g,u;let c=(g=this.dom.vChildren)==null?void 0:g._children;this.dom.renderMarkdown=l,c.forEach(f=>{f.renderContentMatches()}),this.dom.infinityScroll.invalidateAll(),this.dom.childrenEl.toggleClass("cm-preview-code-block",l),this.dom.childrenEl.toggleClass("is-rendered",l),(u=this.renderMarkdownButtonEl)==null||u.toggleClass("is-active",l)},this.renderMarkdownButtonEl=(o=this.headerDom)==null?void 0:o.addNavButton("reading-glasses","Render Markdown",()=>this.setRenderMarkdown(!this.dom.renderMarkdown));let i={renderMarkdown:e.settings.defaultRenderMarkdown};this.settings||(this.settings={}),Object.entries(i).forEach(([l,c])=>{this.settings.hasOwnProperty(l)?l==="sort"&&!R.hasOwnProperty(this.settings.sort)&&(this.settings[l]=c):this.settings[l]=c}),this.setRenderMarkdown(this.settings.renderMarkdown)}}catch(i){console.error("Error in searchView.addChild around patch:",i)}return n.call(this,...s)}}}))}patchSearchResultDOM(t){let e=this,n=k(t.prototype,{addResult(s){return function(...r){n();let o=s.call(this,...r),i=o.constructor;return e.isSearchResultItemPatched||e.patchSearchResultItem(i),o}}});this.register(n),this.register(k(t.prototype,{startLoader(s){return function(...r){var i,l,c,g,u,f;try{let C=this.el.closest(".backlink-pane"),x=F.get(C);if(C&&x&&(x.patched||ee(this,e,C,x)),!((l=(i=this.parent)==null?void 0:i.searchParamsContainerEl)!=null&&l.patched)&&((g=(c=this.el)==null?void 0:c.parentElement)==null?void 0:g.getAttribute("data-type"))==="search"&&(this.parent.searchParamsContainerEl.patched=!0,new p.Setting(this.parent.searchParamsContainerEl).setName("Render Markdown").setClass("mod-toggle").addToggle(O=>{O.setValue(e.settings.defaultRenderMarkdown),O.onChange(E=>{var D;this.renderMarkdown=E,((D=this.vChildren)==null?void 0:D._children).forEach(d=>{d.renderContentMatches()}),this.infinityScroll.invalidateAll(),this.childrenEl.toggleClass("cm-preview-code-block",E),this.childrenEl.toggleClass("is-rendered",E)})})),!this.patched&&((u=this.el.parentElement)==null?void 0:u.hasClass("internal-query"))){let O=e.SearchHeaderDOM?e.SearchHeaderDOM:e.getSearchHeader();if(!O){console.error("Error: _SearchHeaderDOM is undefined. Cannot create headerDom.");return}if((f=this.el)!=null&&f.closest(".internal-query")){this.patched=!0;let E=this.el.parentElement.querySelector(".internal-query-header");this.setExtraContext=function(d){var w;let y=(w=this.vChildren)==null?void 0:w._children;this.extraContext=d,this.extraContextButtonEl.toggleClass("is-active",d),y.forEach(m=>{m.setExtraContext(d)}),this.infinityScroll.invalidateAll()},this.setTitleDisplay=function(d){this.showTitle=d,this.showTitleButtonEl.toggleClass("is-active",d),E.toggleClass("is-hidden",d)},this.setResultsDisplay=function(d){this.showResults=d,this.showResultsButtonEl.toggleClass("is-active",d),this.el.toggleClass("is-hidden",d)},this.setRenderMarkdown=function(d){var w;this.renderMarkdown=d,((w=this.vChildren)==null?void 0:w._children).forEach(m=>{m.renderContentMatches()}),this.infinityScroll.invalidateAll(),this.childrenEl.toggleClass("cm-preview-code-block",d),this.childrenEl.toggleClass("is-rendered",d),this.renderMarkdownButtonEl.toggleClass("is-active",d)},this.setCollapseAll=function(d){var w;let y=(w=this.vChildren)==null?void 0:w._children;this.collapseAllButtonEl.toggleClass("is-active",d),this.collapseAll=d,y.forEach(m=>{m.setCollapse(d,!1)}),this.infinityScroll.invalidateAll()},this.setSortOrder=d=>{this.sortOrder=d,this.changed(),this.infinityScroll.invalidateAll()},this.onCopyResultsClick=d=>v(this,null,function*(){var A,P;d.preventDefault();let y=[],w=(A=this.vChildren)==null?void 0:A._children;for(let T of w){let Q=T.file.path,q="",z=(P=T.vChildren)==null?void 0:P._children;for(let _ of z)q+=_.parent.content.substring(_.start,_.end)+` `;y.push(`## ${Q} ${q}`)}let m=y.join(` -`);try{yield navigator.clipboard.writeText(m),new p.Notice("Search results copied to clipboard.")}catch(D){console.error("Failed to copy search results:",D),new p.Notice("Failed to copy search results.")}});let S=this.headerDom=new O(this.app,this.el.parentElement);E.insertAdjacentElement("afterend",S.navHeaderEl),this.collapseAllButtonEl=S.addNavButton("bullet-list",M("plugins.search.label-collapse-results"),d=>(d.stopPropagation(),this.setCollapseAll(!this.collapseAll))),this.extraContextButtonEl=S.addNavButton("expand-vertically",M("plugins.search.label-more-context"),d=>(d.stopPropagation(),this.setExtraContext(!this.extraContext))),this.showSortButtonEl=S.addNavButton("arrow-up-narrow-wide","Sort",d=>{d.stopPropagation();let y=R.map(m=>m.key),w=m=>{if(y.includes(m)){this.sortOrder=m;let P=`Sort (${R.find(D=>D.key===m).label})`;this.showSortButtonEl.setAttribute("aria-label",P),this.setSortOrder(m)}else console.error(`Invalid sort option: ${m}`)};$(R,this.showSortButtonEl,w,this.sortOrder,this.app)}),this.showTitleButtonEl=S.addNavButton("strikethrough-glyph","Hide title",d=>(d.stopPropagation(),this.setTitleDisplay(!this.showTitle))),this.showResultsButtonEl=S.addNavButton("minus-with-circle","Hide results",d=>(d.stopPropagation(),this.setResultsDisplay(!this.showResults))),this.renderMarkdownButtonEl=S.addNavButton("reading-glasses","Render Markdown",d=>(d.stopPropagation(),this.setRenderMarkdown(!this.renderMarkdown))),S.addNavButton("documents","Copy results",this.onCopyResultsClick.bind(this));let T={title:e.settings.defaultHideResults,collapsed:e.settings.defaultCollapse,context:e.settings.defaultShowContext,hideTitle:e.settings.defaultHideTitle,hideResults:e.settings.defaultHideResults,renderMarkdown:e.settings.defaultRenderMarkdown,sort:e.settings.defaultSortOrder};this.settings||(this.settings={}),Object.entries(T).forEach(([d,y])=>{this.settings.hasOwnProperty(d)?d==="sort"&&!R.hasOwnProperty(this.settings.sort)&&(this.settings[d]=y):this.settings[d]=y}),this.setExtraContext(this.settings.context),this.sortOrder=this.settings.sort,this.setCollapseAll(this.settings.collapsed),this.setTitleDisplay(this.settings.hideTitle),this.setRenderMarkdown(this.settings.renderMarkdown),this.setResultsDisplay(this.settings.hideResults)}}}catch(C){console.error("Error in SearchResultDOM.startLoader around patch:",C)}return s.call(this,...t)}}}))}patchSearchResultItem(r){this.isSearchResultItemPatched=!0;let e=this,n=k(r.prototype,{onResultClick(s){return function(t,o,...i){if(!(t.target instanceof HTMLElement&&(t.target.hasClass("internal-link")||t.target.hasClass("task-list-item-checkbox")||t.target.hasClass("admonition-title-content"))))return s.call(this,t,o,...i)}},renderContentMatches(s){return function(...t){var a;let o=s.call(this,...t),i=(a=this.vChildren)==null?void 0:a._children;if(!e.isSearchResultItemMatchPatched&&i.length){let c=i.first().constructor;e.patchSearchResultItemMatch(c)}return o}}});e.register(n)}patchSearchResultItemMatch(r){this.isSearchResultItemMatchPatched=!0;let e=this;e.register(k(r.prototype,{render(n){return function(...s){var c;let t=this.parentDom,o=t.content.substring(this.start,this.end).replace("```query","\\`\\`\\`query"),i=(c=o.match(/^\s+/g))==null?void 0:c.first();i&&(o=o.replace(new RegExp(`^${i}`,"gm"),""));let a=t.parent.parent;if(a&&t.parent.renderMarkdown){let g=a==null?void 0:a.renderComponent;this.el.empty();let u=new B(e.app,this.el,this);u.onRenderComplete=()=>{var f;(f=t==null?void 0:t.parent)==null||f.infinityScroll.measure(t,this)},g.addChild(u),u.renderer.set(o)}else return n.call(this,...s)}}}))}patchSearchView(r){let e=r.constructor,n=r.dom.constructor;this.register(k(e.prototype,{onunload(s){return function(...t){return this.renderComponent&&(this.renderComponent.unload(),this.dom=null,this.queue=null,this.renderComponent=null,this._children=null,this.containerEl=null),s.call(this,...t)}},onload(s){return function(...t){try{this.renderComponent||(this.renderComponent=new p.Component,this.renderComponent.load()),this.dom.parent=this;let i=this.containerEl.parentElement.querySelector(".internal-query-header"),a=this.query.matchAll(new RegExp("^(?collapsed|context|hideTitle|renderMarkdown|hideResults|sort|title):\\s*(?.+?)$","gm")),c={};for(let g of a){let u=g.groups.value.toLowerCase();(u==="true"||u==="false")&&(g.groups.value=u==="true"),c[g.groups.key]=g.groups.value}this.query=this.query.replace(/^((collapsed|context|hideTitle|renderMarkdown|hideResults|sort|title):.+?)$/gm,"").trim(),i.setText(c.title||this.query),this.dom.settings=c}catch(i){console.error("Error in EmbeddedSearch.onload:",i)}return s.call(this,...t)}}})),this.patchSearchResultDOM(n)}patchBacklinksView(r){let e=r.constructor,n=r.backlinkDom.constructor;this.register(k(e.prototype,{onunload(s){return function(...t){return this.renderComponent&&(this.renderComponent.unload(),this.dom=null,this.queue=null,this.renderComponent=null,this._children=null,this.containerEl=null),s.call(this,...t)}},onload(s){return function(...t){try{this.renderComponent||(this.renderComponent=new p.Component,this.renderComponent.load()),this.backlinkDom.parent=this,this.unlinkedDom.parent=this;let i={};this.dom.settings=i}catch(i){console.error("Error in Backlink.onload:",i)}return s.call(this,...t)}}})),this.patchSearchResultDOM(n)}};function K(l,h,r,e){if(e){e.patched=!0,l.setRenderMarkdown=function(s){[e.backlinkDom,e.unlinkedDom].forEach(o=>{var a;o.renderMarkdown=s,((a=o.vChildren)==null?void 0:a._children).forEach(c=>{c.renderContentMatches()}),o.infinityScroll.invalidateAll(),o.childrenEl.toggleClass("cm-preview-code-block",s),o.childrenEl.toggleClass("is-rendered",s)}),this.renderMarkdownButtonEl.toggleClass("is-active",s)},l.onCopyResultsClick=s=>v(this,null,function*(){var a,c;s.stopPropagation(),s.preventDefault();let t=[],o=[e.backlinkDom,e.unlinkedDom];for(let g of o){let u=(a=g.vChildren)==null?void 0:a._children;for(let f of u){let C=f.file.path,x="",O=(c=f.vChildren)==null?void 0:c._children;for(let E of O)x+=E.parent.content.substring(E.start,E.end)+` -`;t.push(`## ${C} -${x}`)}}let i=t.join(` -`);try{yield navigator.clipboard.writeText(i)}catch(g){console.error("Failed to copy backlinks:",g),new p.Notice("Failed to copy backlinks.")}}),l.renderMarkdownButtonEl=e.headerDom.addNavButton("reading-glasses","Render Markdown",s=>(s.stopPropagation(),l.setRenderMarkdown(!l.renderMarkdown))),e.headerDom.addNavButton("documents","Copy results",l.onCopyResultsClick.bind(l));let n={title:h.settings.defaultHideResults,collapsed:h.settings.defaultCollapse,context:h.settings.defaultShowContext,hideTitle:h.settings.defaultHideTitle,hideResults:h.settings.defaultHideResults,renderMarkdown:h.settings.defaultRenderMarkdown,sort:h.settings.defaultSortOrder};l.settings||(l.settings={}),Object.entries(n).forEach(([s,t])=>{l.settings.hasOwnProperty(s)?s==="sort"&&!R.hasOwnProperty(l.settings.sort)&&(l.settings[s]=t):l.settings[s]=t}),e.setExtraContext(l.settings.context),e.sortOrder=l.settings.sort,e.setCollapseAll(l.settings.collapsed),l.setRenderMarkdown(l.settings.renderMarkdown)}} +`);try{yield navigator.clipboard.writeText(m),new p.Notice("Search results copied to clipboard.")}catch(T){console.error("Failed to copy search results:",T),new p.Notice("Failed to copy search results.")}});let S=this.headerDom=new O(this.app,this.el.parentElement);E.insertAdjacentElement("afterend",S.navHeaderEl),this.collapseAllButtonEl=S.addNavButton("bullet-list",M("plugins.search.label-collapse-results"),d=>(d.stopPropagation(),this.setCollapseAll(!this.collapseAll))),this.extraContextButtonEl=S.addNavButton("expand-vertically",M("plugins.search.label-more-context"),d=>(d.stopPropagation(),this.setExtraContext(!this.extraContext))),this.showSortButtonEl=S.addNavButton("arrow-up-narrow-wide","Sort",d=>{d.stopPropagation();let y=R.map(m=>m.key),w=m=>{if(y.includes(m)){this.sortOrder=m;let P=`Sort (${R.find(T=>T.key===m).label})`;this.showSortButtonEl.setAttribute("aria-label",P),this.setSortOrder(m)}else console.error(`Invalid sort option: ${m}`)};$(R,this.showSortButtonEl,w,this.sortOrder,this.app)}),this.showTitleButtonEl=S.addNavButton("strikethrough-glyph","Hide title",d=>(d.stopPropagation(),this.setTitleDisplay(!this.showTitle))),this.showResultsButtonEl=S.addNavButton("minus-with-circle","Hide results",d=>(d.stopPropagation(),this.setResultsDisplay(!this.showResults))),this.renderMarkdownButtonEl=S.addNavButton("reading-glasses","Render Markdown",d=>(d.stopPropagation(),this.setRenderMarkdown(!this.renderMarkdown))),S.addNavButton("documents","Copy results",this.onCopyResultsClick.bind(this));let D={title:e.settings.defaultHideResults,collapsed:e.settings.defaultCollapse,context:e.settings.defaultShowContext,hideTitle:e.settings.defaultHideTitle,hideResults:e.settings.defaultHideResults,renderMarkdown:e.settings.defaultRenderMarkdown,sort:e.settings.defaultSortOrder};this.settings||(this.settings={}),Object.entries(D).forEach(([d,y])=>{this.settings.hasOwnProperty(d)?d==="sort"&&!R.hasOwnProperty(this.settings.sort)&&(this.settings[d]=y):this.settings[d]=y}),this.setExtraContext(this.settings.context),this.sortOrder=this.settings.sort,this.setCollapseAll(this.settings.collapsed),this.setTitleDisplay(this.settings.hideTitle),this.setRenderMarkdown(this.settings.renderMarkdown),this.setResultsDisplay(this.settings.hideResults)}}}catch(C){console.error("Error in SearchResultDOM.startLoader around patch:",C)}return s.call(this,...r)}}}))}patchSearchResultItem(t){this.isSearchResultItemPatched=!0;let e=this,n=k(t.prototype,{onResultClick(s){return function(r,o,...i){if(!(r.target instanceof HTMLElement&&(r.target.hasClass("internal-link")||r.target.hasClass("task-list-item-checkbox")||r.target.hasClass("admonition-title-content"))))return s.call(this,r,o,...i)}},renderContentMatches(s){return function(...r){var l;let o=s.call(this,...r),i=(l=this.vChildren)==null?void 0:l._children;if(!e.isSearchResultItemMatchPatched&&i.length){let c=i.first().constructor;e.patchSearchResultItemMatch(c)}return o}}});e.register(n)}patchSearchResultItemMatch(t){this.isSearchResultItemMatchPatched=!0;let e=this;e.register(k(t.prototype,{render(n){return function(...s){var c;let r=this.parentDom,o=r.content.substring(this.start,this.end).replace("```query","\\`\\`\\`query"),i=(c=o.match(/^\s+/g))==null?void 0:c.first();i&&(o=o.replace(new RegExp(`^${i}`,"gm"),""));let l=r.parent.parent;if(l&&r.parent.renderMarkdown){let g=l==null?void 0:l.renderComponent;this.el.empty();let u=new B(e.app,this.el,this);u.onRenderComplete=()=>{var f;(f=r==null?void 0:r.parent)==null||f.infinityScroll.measure(r,this)},g.addChild(u),u.renderer.set(o)}else return n.call(this,...s)}}}))}patchSearchView(t){let e=t.constructor,n=t.dom.constructor;this.register(k(e.prototype,{onunload(s){return function(...r){return this.renderComponent&&(this.renderComponent.unload(),this.dom=null,this.queue=null,this.renderComponent=null,this._children=null,this.containerEl=null),s.call(this,...r)}},onload(s){return function(...r){try{this.renderComponent||(this.renderComponent=new p.Component,this.renderComponent.load()),this.dom.parent=this;let i=this.containerEl.parentElement.querySelector(".internal-query-header"),l=this.query.matchAll(new RegExp("^(?collapsed|context|hideTitle|renderMarkdown|hideResults|sort|title):\\s*(?.+?)$","gm")),c={};for(let g of l){let u=g.groups.value.toLowerCase();(u==="true"||u==="false")&&(g.groups.value=u==="true"),c[g.groups.key]=g.groups.value}this.query=this.query.replace(/^((collapsed|context|hideTitle|renderMarkdown|hideResults|sort|title):.+?)$/gm,"").trim(),i.setText(c.title||this.query),this.dom.settings=c}catch(i){console.error("Error in EmbeddedSearch.onload:",i)}return s.call(this,...r)}}})),this.patchSearchResultDOM(n)}patchBacklinksView(t){let e=t.constructor,n=t.backlinkDom.constructor;this.register(k(e.prototype,{onunload(s){return function(...r){return this.renderComponent&&(this.renderComponent.unload(),this.dom=null,this.queue=null,this.renderComponent=null,this._children=null,this.containerEl=null),s.call(this,...r)}},onload(s){return function(...r){try{this.renderComponent||(this.renderComponent=new p.Component,this.renderComponent.load()),this.backlinkDom.parent=this,this.unlinkedDom.parent=this;let i={};this.dom.settings=i}catch(i){console.error("Error in Backlink.onload:",i)}return s.call(this,...r)}}})),this.patchSearchResultDOM(n)}};function ee(a,h,t,e){if(e){e.patched=!0,a.setRenderMarkdown=function(s){[e.backlinkDom,e.unlinkedDom].forEach(o=>{var l;o.renderMarkdown=s,((l=o.vChildren)==null?void 0:l._children).forEach(c=>{c.renderContentMatches()}),o.infinityScroll.invalidateAll(),o.childrenEl.toggleClass("cm-preview-code-block",s),o.childrenEl.toggleClass("is-rendered",s)}),this.renderMarkdownButtonEl.toggleClass("is-active",s)},a.onCopyResultsClick=s=>v(this,null,function*(){var l,c;s.stopPropagation(),s.preventDefault();let r=[],o=[e.backlinkDom,e.unlinkedDom];for(let g of o){let u=(l=g.vChildren)==null?void 0:l._children;for(let f of u){let C=f.file.path,x="",O=(c=f.vChildren)==null?void 0:c._children;for(let E of O)x+=E.parent.content.substring(E.start,E.end)+` +`;r.push(`## ${C} +${x}`)}}let i=r.join(` +`);try{yield navigator.clipboard.writeText(i)}catch(g){console.error("Failed to copy backlinks:",g),new p.Notice("Failed to copy backlinks.")}}),a.renderMarkdownButtonEl=e.headerDom.addNavButton("reading-glasses","Render Markdown",s=>(s.stopPropagation(),a.setRenderMarkdown(!a.renderMarkdown))),e.headerDom.addNavButton("documents","Copy results",a.onCopyResultsClick.bind(a));let n={title:h.settings.defaultHideResults,collapsed:h.settings.defaultCollapse,context:h.settings.defaultShowContext,hideTitle:h.settings.defaultHideTitle,hideResults:h.settings.defaultHideResults,renderMarkdown:h.settings.defaultRenderMarkdown,sort:h.settings.defaultSortOrder};a.settings||(a.settings={}),Object.entries(n).forEach(([s,r])=>{a.settings.hasOwnProperty(s)?s==="sort"&&!R.hasOwnProperty(a.settings.sort)&&(a.settings[s]=r):a.settings[s]=r}),e.setExtraContext(a.settings.context),e.sortOrder=a.settings.sort,e.setCollapseAll(a.settings.collapsed),a.setRenderMarkdown(a.settings.renderMarkdown)}} diff --git a/.obsidian/plugins/query-control/manifest.json b/.obsidian/plugins/query-control/manifest.json index 6a46289..72a894b 100644 --- a/.obsidian/plugins/query-control/manifest.json +++ b/.obsidian/plugins/query-control/manifest.json @@ -1 +1 @@ -{"id":"query-control","name":"Query Control","version":"0.7.9","minAppVersion":"1.7.2","description":"An experimental Obsidian plugin that adds additional control to queries","author":"NothingIsLost & reply2za","authorUrl":"https://github.com/reply2za/obsidian-query-control","isDesktopOnly":false} \ No newline at end of file +{"id":"query-control","name":"Query Control","version":"0.7.10","minAppVersion":"1.7.2","description":"An experimental Obsidian plugin that adds additional control to queries","author":"NothingIsLost & reply2za","authorUrl":"https://github.com/reply2za/obsidian-query-control","isDesktopOnly":false} \ No newline at end of file diff --git a/00 Planner/01 Days/2024-10-27, Sun.md b/00 Planner/01 Days/2024-10-27, Sun.md deleted file mode 100644 index e69de29..0000000 diff --git a/00 Planner/01 Days/2024-10-28, Mon.md b/00 Planner/01 Days/2024-10-28, Mon.md deleted file mode 100644 index e69de29..0000000 diff --git a/00 Planner/01 Days/2024-10-29, Tue.md b/00 Planner/01 Days/2024-10-29, Tue.md deleted file mode 100644 index e69de29..0000000 diff --git a/10 Notes/BEP5 - DHT Protocol.md b/10 Notes/BEP5 - DHT Protocol.md new file mode 100644 index 0000000..aca954d --- /dev/null +++ b/10 Notes/BEP5 - DHT Protocol.md @@ -0,0 +1,20 @@ +--- +tags: + - bittorrent + - dht +link: http://bittorrent.org/beps/bep_0005.html +related-to: + - "[[Learn BitTorrent]]" +--- +#bittorrent #dht + +| link | http://bittorrent.org/beps/bep_0005.html | +| ---------- | ---------------------------------------- | +| related-to | [[Learn BitTorrent]] | + +For the DHT protocol, there are four **queries**: +- `ping`: to check if another node (one from its DHT routing table) is online and reachable, +- `find_node`: find the contact information for a node given its ID, +- `get_peers`: get peers associated with a torrent [[Infohash|infohash]], +- `announce_peer`: to *announce* that the peer, controlling the querying node, is downloading a torrent on a port. + diff --git a/10 Notes/BitTorrent Tracker.md b/10 Notes/BitTorrent Tracker.md new file mode 100644 index 0000000..acfc9a5 --- /dev/null +++ b/10 Notes/BitTorrent Tracker.md @@ -0,0 +1,18 @@ +--- +tags: + - bittorrent +related-to: + - "[[Learn BitTorrent]]" +--- +#bittorrent + +| related-to | [[Learn BitTorrent]] | +| ---------- | -------------------- | +Original BitTorrent tracker coordinates the collaboration in the [[Swarm]]. The trackers is what was making BitTorrent partly centralised - they could be many trackers, but they play the role about the seeders and clients (peers) taking part in the exchange. + +With the adoption of DHT in [BEP5 - DHT Protocol](http://bittorrent.org/beps/bep_0005.html) and [BEP11 - Peer Exchange (PEX)](http://bittorrent.org/beps/bep_0011.html), BitTorrent becomes more decentralised and removes this static point of control: the tracker. See also: [Peer Exchange](https://en.wikipedia.org/wiki/Peer_exchange) protocol in Wikipedia. + +A nice note about this can be found in the book [[The World of Peer-to-Peer (P2P)]]: + +> Enabling the volatile Peer to operate also as a tracker, but even if this addressed the need for static tracker servers, there is still a centralization of the network around the content. Peers don't have any default ability to contact each other outside of that context. + diff --git a/10 Notes/How BitTorrent-Codex integration may look like?.md b/10 Notes/How BitTorrent-Codex integration may look like?.md new file mode 100644 index 0000000..dbd6223 --- /dev/null +++ b/10 Notes/How BitTorrent-Codex integration may look like?.md @@ -0,0 +1 @@ +From [[Learn BitTorrent]] we got a decent overview how BitTorrent protocol looks like. \ No newline at end of file diff --git a/10 Notes/Incentives Build Robustness in BitTorrent.md b/10 Notes/Incentives Build Robustness in BitTorrent.md index 91c50e5..26f1285 100644 --- a/10 Notes/Incentives Build Robustness in BitTorrent.md +++ b/10 Notes/Incentives Build Robustness in BitTorrent.md @@ -3,16 +3,16 @@ tags: - paper authors: - Bram Cohen -link: https://stuker.com/wp-content/uploads/import/i-1fd3ae7c5502dfddfe8b2c7acdefaa5e-bittorrentecon.pdf +link: http://bittorrent.org/bittorrentecon.pdf related-to: - "[[Learn BitTorrent]]" --- #paper -| authors | Bram Cohen | -| ---------- | -------------------------------------------------------------------------------------------------- | -| link | https://stuker.com/wp-content/uploads/import/i-1fd3ae7c5502dfddfe8b2c7acdefaa5e-bittorrentecon.pdf | -| related-to | [[Learn BitTorrent]] | +| authors | Bram Cohen | +| ---------- | ---------------------------------------- | +| link | http://bittorrent.org/bittorrentecon.pdf | +| related-to | [[Learn BitTorrent]] | Original "BitTorrent" paper by [[Bram Cohen]]. diff --git a/10 Notes/Learn BitTorrent.md b/10 Notes/Learn BitTorrent.md index ef65d98..d54c427 100644 --- a/10 Notes/Learn BitTorrent.md +++ b/10 Notes/Learn BitTorrent.md @@ -20,9 +20,10 @@ In order to imagine, what do we mean by *BitTorrent - Codex Integration*, we nee BitTorrent spec is build incrementally from so called [BitTorrent Enhancement Proposals (BEPs)](http://bittorrent.org/beps/bep_0000.html). Each BEP adds something to the BitTorrent Protocol. The most important BEPs to study in order to get a good initial grip on the BitTorrent protocol are: - [BEP3 - The BitTorrent Protocol Specification](http://bittorrent.org/beps/bep_0003.html) -- [BEP5 - DHT Protocol](http://bittorrent.org/beps/bep_0005.html) +- [[BEP5 - DHT Protocol]] - [BEP9 - Extension for Peers to Send Metadata Files](http://bittorrent.org/beps/bep_0009.html) -- [BEP10 -Extension Protocol](http://bittorrent.org/beps/bep_0010.html) +- [BEP10 -Extension Protocol](http://bittorrent.org/beps/bep_0010.html), see also [extension protocol for bittorrent](https://www.rasterbar.com/products/libtorrent/extension_protocol.html) +- [BEP11 - Peer Exchange (PEX)](http://bittorrent.org/beps/bep_0011.html) - [BEP23 - Tracker Returns Compact Peer Lists](http://bittorrent.org/beps/bep_0023.html) - [BEP29 - uTorrent transport protocol](http://bittorrent.org/beps/bep_0029.html) @@ -30,8 +31,8 @@ BitTorrent spec is build incrementally from so called [BitTorrent Enhancement Pr Selection of some more important BitTorrent papers: -1. [[Incentives Build Robustness in BitTorrent]] -2. [[The Bittorrent P2P File-Sharing System - Measurements And Analysis]] +1. [[Incentives Build Robustness in BitTorrent]] - original "BitTorrent" paper by [[Bram Cohen]]. +2. [[The Bittorrent P2P File-Sharing System - Measurements And Analysis]] - Paper from the creators of the [[Tribler]] protocol. ### Books diff --git a/10 Notes/Transmission.md b/10 Notes/Transmission.md index 2214066..e6670c9 100644 --- a/10 Notes/Transmission.md +++ b/10 Notes/Transmission.md @@ -1,9 +1,17 @@ --- tags: - bittorrent +link: https://transmissionbt.com +source: https://github.com/transmission/transmission +related-to: --- -Offcial URL: https://transmissionbt.com -Repository: https://github.com/transmission/transmission + +#bittorrent + +| link | https://transmissionbt.com | +| ---------- | ------------------------------------------- | +| source | https://github.com/transmission/transmission | +| related-to | | [[Learn BitTorrent]] client. One of the three popular clients, the other are [[Deluge (BitTorrent)]] and [[qBittorrent]], with the most attractive looking website. Comparing to the other two, Transmission does not depend on [[libtorrent-rasterbar]], but rather has its own implementation of the BitTorrent protocol. @@ -12,3 +20,233 @@ Repository: https://github.com/transmission/transmission It supports all major OS and has a native macos support. The latest release is from 30 May 2024. + +### How does it look like? + +TBD... + +### Building + +Some loose notes for now... TBD.. + +```bash +CMake Error in gtk/CMakeLists.txt: + Imported target "transmission::gtk_impl" includes non-existent path + + "/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi" + + in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: + + * The path was deleted, renamed, or moved to another location. + + * An install or uninstall procedure did not complete successfully. + + * The installation package was faulty and references files it does not + provide. + + + +CMake Error in gtk/CMakeLists.txt: + Imported target "transmission::gtk_impl" includes non-existent path + + "/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi" + + in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: + + * The path was deleted, renamed, or moved to another location. + + * An install or uninstall procedure did not complete successfully. + + * The installation package was faulty and references files it does not + provide. + + + +-- Generating done (0.2s) +CMake Generate step failed. Build files cannot be regenerated correctly. +~/code/open-source/bittorrent/transmission-mac-cmake(main) +» brew uninstall gtk4 gtkmm4 1 ↵ +Uninstalling /opt/homebrew/Cellar/gtk4/4.16.3... (598 files, 57.8MB) +Uninstalling /opt/homebrew/Cellar/gtkmm4/4.16.0... (700 files, 9.7MB) +==> Autoremoving 8 unneeded formulae: +cairomm +gdk-pixbuf +glibmm +graphene +hicolor-icon-theme +libepoxy +libsigc++ +pangomm +Uninstalling /opt/homebrew/Cellar/gdk-pixbuf/2.42.12... (152 files, 4.0MB) +Uninstalling /opt/homebrew/Cellar/pangomm/2.54.0... (70 files, 755.8KB) +Uninstalling /opt/homebrew/Cellar/graphene/1.10.8... (37 files, 1MB) +Uninstalling /opt/homebrew/Cellar/hicolor-icon-theme/0.18... (8 files, 80.8KB) +Uninstalling /opt/homebrew/Cellar/libepoxy/1.5.10... (11 files, 2.6MB) +Uninstalling /opt/homebrew/Cellar/glibmm/2.82.0... (449 files, 6.4MB) +Uninstalling /opt/homebrew/Cellar/cairomm/1.18.0... (43 files, 592.4KB) +Uninstalling /opt/homebrew/Cellar/libsigc++/3.6.0... (52 files, 378.3KB) +~/code/open-source/bittorrent/transmission-mac-cmake(main) +» cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo +-- Looking for clang-tidy +-- Looking for clang-tidy - not found +-- Configuring done (0.4s) +CMake Error in gtk/CMakeLists.txt: + Imported target "transmission::gtk_impl" includes non-existent path + + "/opt/homebrew/Cellar/gtkmm4/4.16.0/include/gtkmm-4.0" + + in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: + + * The path was deleted, renamed, or moved to another location. + + * An install or uninstall procedure did not complete successfully. + + * The installation package was faulty and references files it does not + provide. + + + +CMake Error in gtk/CMakeLists.txt: + Imported target "transmission::gtk_impl" includes non-existent path + + "/opt/homebrew/Cellar/gtkmm4/4.16.0/include/gtkmm-4.0" + + in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: + + * The path was deleted, renamed, or moved to another location. + + * An install or uninstall procedure did not complete successfully. + + * The installation package was faulty and references files it does not + provide. + + + +-- Generating done (0.2s) +CMake Generate step failed. Build files cannot be regenerated correctly. +~/code/open-source/bittorrent/transmission-mac-cmake(main) +» ninja clean 1 ↵ +ninja: error: loading 'build.ninja': No such file or directory +~/code/open-source/bittorrent/transmission-mac-cmake(main) +» rm -rf CMakeCache.txt CMakeFiles/ 1 ↵ +~/code/open-source/bittorrent/transmission-mac-cmake(main) +» cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo +-- Looking for clang-tidy +-- Looking for clang-tidy - not found +-- Configuring done (0.5s) +CMake Error in gtk/CMakeLists.txt: + Imported target "transmission::gtk_impl" includes non-existent path + + "/opt/homebrew/Cellar/gtkmm4/4.16.0/include/gtkmm-4.0" + + in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: + + * The path was deleted, renamed, or moved to another location. + + * An install or uninstall procedure did not complete successfully. + + * The installation package was faulty and references files it does not + provide. + + + +CMake Error in gtk/CMakeLists.txt: + Imported target "transmission::gtk_impl" includes non-existent path + + "/opt/homebrew/Cellar/gtkmm4/4.16.0/include/gtkmm-4.0" + + in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: + + * The path was deleted, renamed, or moved to another location. + + * An install or uninstall procedure did not complete successfully. + + * The installation package was faulty and references files it does not + provide. + + + +-- Generating done (0.2s) +CMake Generate step failed. Build files cannot be regenerated correctly. +``` + +https://doc.qt.io/qt-6/macos.html#supported-versions +https://github.com/fontforge/fontforge/discussions/5164 +https://github.com/fontforge/fontforge/issues/5153 + +https://www.reddit.com/r/MacOS/comments/1fs551h/macos_15_sequoia_update_caused_include_errors_in_c/ + +```bash +xcrun -sdk macosx --show-sdk-path +pkg-config --cflags gtkmm-4.0 +pkg-config --cflags gtk4 +``` + +`CMakeLists.txt` around line 361: + +```cmake +if(GTK_FOUND) + add_library(transmission::gtk_impl INTERFACE IMPORTED) + + target_compile_options(transmission::gtk_impl + INTERFACE + ${GTK${GTK_VERSION}_CFLAGS_OTHER}) + + target_include_directories(transmission::gtk_impl + INTERFACE + /opt/homebrew/Cellar/gtk4/4.16.3/include/gtk-4.0 + /opt/homebrew/Cellar/pango/1.54.0/include/pango-1.0 + /opt/homebrew/Cellar/harfbuzz/10.0.1_1/include/harfbuzz + /opt/homebrew/Cellar/fribidi/1.0.16/include/fribidi + /opt/homebrew/Cellar/graphite2/1.3.14/include + /opt/homebrew/Cellar/gdk-pixbuf/2.42.12/include/gdk-pixbuf-2.0 + /opt/homebrew/Cellar/libtiff/4.7.0/include + /opt/homebrew/opt/zstd/include + /opt/homebrew/Cellar/xz/5.6.3/include + /opt/homebrew/Cellar/jpeg-turbo/3.0.4/include + /opt/homebrew/Cellar/cairo/1.18.2/include/cairo + /opt/homebrew/Cellar/fontconfig/2.15.0/include + /opt/homebrew/opt/freetype/include/freetype2 + /opt/homebrew/opt/libpng/include/libpng16 + /opt/homebrew/Cellar/libxext/1.3.6/include + /opt/homebrew/Cellar/libxrender/0.9.11/include + /opt/homebrew/Cellar/libx11/1.8.10/include + /opt/homebrew/Cellar/libxcb/1.17.0/include + /opt/homebrew/Cellar/libxau/1.0.11/include + /opt/homebrew/Cellar/libxdmcp/1.1.5/include + /opt/homebrew/Cellar/pixman/0.42.2/include/pixman-1 + /opt/homebrew/Cellar/graphene/1.10.8/include/graphene-1.0 + /opt/homebrew/Cellar/graphene/1.10.8/lib/graphene-1.0/include + /opt/homebrew/Cellar/glib/2.82.2/include + /opt/homebrew/Cellar/glib/2.82.2/include/glib-2.0 + /opt/homebrew/Cellar/glib/2.82.2/lib/glib-2.0/include + /opt/homebrew/opt/gettext/include + /opt/homebrew/Cellar/pcre2/10.44/include + /opt/homebrew/Cellar/xorgproto/2024.1/include + /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/ffi + /opt/homebrew/Cellar/gtkmm4/4.16.0/include/gtkmm-4.0 + /opt/homebrew/Cellar/gtkmm4/4.16.0/lib/gtkmm-4.0/include + /opt/homebrew/Cellar/pangomm/2.54.0/include/pangomm-2.48 + /opt/homebrew/Cellar/pangomm/2.54.0/lib/pangomm-2.48/include + /opt/homebrew/Cellar/glibmm/2.82.0/include/giomm-2.68 + /opt/homebrew/Cellar/glibmm/2.82.0/lib/giomm-2.68/include + /opt/homebrew/Cellar/glib/2.82.2/include/gio-unix-2.0 + /opt/homebrew/Cellar/glibmm/2.82.0/include/glibmm-2.68 + /opt/homebrew/Cellar/glibmm/2.82.0/lib/glibmm-2.68/include + /opt/homebrew/Cellar/glib/2.82.2/include + /opt/homebrew/Cellar/cairomm/1.18.0/include/cairomm-1.16 + /opt/homebrew/Cellar/cairomm/1.18.0/lib/cairomm-1.16/include + /opt/homebrew/Cellar/libsigc++/3.6.0/include/sigc++-3.0 + /opt/homebrew/Cellar/libsigc++/3.6.0/lib/sigc++-3.0/include + /opt/homebrew/Cellar/gtk4/4.16.3/include/gtk-4.0/unix-print) + # ${GTK${GTK_VERSION}_INCLUDE_DIRS}) + + target_link_directories(transmission::gtk_impl + INTERFACE + ${GTK${GTK_VERSION}_LIBRARY_DIRS}) + + target_link_libraries(transmission::gtk_impl + INTERFACE + ${GTK${GTK_VERSION}_LIBRARIES}) +endif() +``` \ No newline at end of file diff --git a/README.md b/README.md index 4374481..4f037d1 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ --- tags: - bittorrent - - "#obsidian" - - "#notion" + - obsidian + - notion source: https://github.com/marcinczenko/bittorrent-codex-docs --- #bittorrent #obsidian #notion @@ -18,7 +18,7 @@ In this repository your will find a complete documentation of our BitTorrent/Cod I was trying to answer the following questions: -1. [[How BitTorrent/Codex integration may look like? ]] +1. [[How BitTorrent-Codex integration may look like? ]] 2. [[What are existing (open source) BitTorrent clients?]] 3. [[What are the challenges ahead and how big the effort would be?]] @@ -26,8 +26,8 @@ Answering those three questions should give us answer to the big ultimate questi Getting there in short time is not easy, especially without recent hands-on experience with the BitTorrent protocol. Thus in this quest, the following actions are being taken: -1. Identity [[Learn BitTorrent | the best resources to learn BitTorrent protocol]], to get some intuition about the protocol. This is mostly to answer the question number (1) above. -2. [[Comparison of BitTorrent clients | Compare existing BitTorrent clients]], trying to focus on those that are open sourced. We want to learn about their market share, how do they look and feel, and how easy would it be to work with their codebase. +1. Identity [[Learn BitTorrent|the best resources to learn BitTorrent protocol]], to get some intuition about the protocol. This is mostly to answer the question number (1) above. +2. [[Comparison of BitTorrent clients|Compare existing BitTorrent clients]], trying to focus on those that are open sourced. We want to learn about their market share, how do they look and feel, and how easy would it be to work with their codebase. 3. Chose one of the client, and try to cat it through and learn how easy is to do what we think we want to do. What are the obstacles, and unexpected difficulties? This is the major part of our investigation. ### Obsidian