index.js 000755 0000011532 14651612770 007367 0 ustar 00 000000 000000 (()=>{"use strict";var t={998:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=joplin},143:(t,e)=>{var o,n,r,i,a,l,c,u,d,s;Object.defineProperty(e,"__esModule",{value:!0}),e.ContentScriptType=e.SettingStorage=e.AppType=e.SettingItemSubType=e.SettingItemType=e.ToolbarButtonLocation=e.isContextMenuItemLocation=e.MenuItemLocation=e.ModelType=e.ImportModuleOutputFormat=e.FileSystemItem=void 0,(s=e.FileSystemItem||(e.FileSystemItem={})).File="file",s.Directory="directory",(d=e.ImportModuleOutputFormat||(e.ImportModuleOutputFormat={})).Markdown="md",d.Html="html",(u=e.ModelType||(e.ModelType={}))[u.Note=1]="Note",u[u.Folder=2]="Folder",u[u.Setting=3]="Setting",u[u.Resource=4]="Resource",u[u.Tag=5]="Tag",u[u.NoteTag=6]="NoteTag",u[u.Search=7]="Search",u[u.Alarm=8]="Alarm",u[u.MasterKey=9]="MasterKey",u[u.ItemChange=10]="ItemChange",u[u.NoteResource=11]="NoteResource",u[u.ResourceLocalState=12]="ResourceLocalState",u[u.Revision=13]="Revision",u[u.Migration=14]="Migration",u[u.SmartFilter=15]="SmartFilter",u[u.Command=16]="Command",function(t){t.File="file",t.Edit="edit",t.View="view",t.Note="note",t.Tools="tools",t.Help="help",t.Context="context",t.NoteListContextMenu="noteListContextMenu",t.EditorContextMenu="editorContextMenu",t.FolderContextMenu="folderContextMenu",t.TagContextMenu="tagContextMenu"}(o=e.MenuItemLocation||(e.MenuItemLocation={})),e.isContextMenuItemLocation=function(t){return[o.Context,o.NoteListContextMenu,o.EditorContextMenu,o.FolderContextMenu,o.TagContextMenu].includes(t)},(c=e.ToolbarButtonLocation||(e.ToolbarButtonLocation={})).NoteToolbar="noteToolbar",c.EditorToolbar="editorToolbar",(l=e.SettingItemType||(e.SettingItemType={}))[l.Int=1]="Int",l[l.String=2]="String",l[l.Bool=3]="Bool",l[l.Array=4]="Array",l[l.Object=5]="Object",l[l.Button=6]="Button",(a=e.SettingItemSubType||(e.SettingItemSubType={})).FilePathAndArgs="file_path_and_args",a.FilePath="file_path",a.DirectoryPath="directory_path",(i=e.AppType||(e.AppType={})).Desktop="desktop",i.Mobile="mobile",i.Cli="cli",(r=e.SettingStorage||(e.SettingStorage={}))[r.Database=1]="Database",r[r.File=2]="File",(n=e.ContentScriptType||(e.ContentScriptType={})).MarkdownItPlugin="markdownItPlugin",n.CodeMirrorPlugin="codeMirrorPlugin"},156:function(t,e,o){var n=this&&this.__awaiter||function(t,e,o,n){return new(o||(o=Promise))((function(r,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function l(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(a,l)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const r=o(998),i=o(143);r.default.plugins.register({onStart:function(){return n(this,void 0,void 0,(function*(){console.log("onstart ..."),yield r.default.commands.register({name:"enc_dec",label:"encrypt or decrypt",iconName:"fas fa-user-secret",execute:()=>n(this,void 0,void 0,(function*(){!function(){n(this,void 0,void 0,(function*(){const n=yield r.default.commands.execute("selectedText");if(n.startsWith("`ENC:")||n.startsWith("ENC:")){const e=yield t.open(o),i=e.id;if("cancel"==i)return;{const t=e.formData.user.pwd;let o=n.split(":")[1].split("`")[0];const l=a.decode(t,o);"NULL"==l?alert("password is not correct!"):"Decrypt"==i?yield r.default.commands.execute("replaceSelection",l):"ok"==i&&alert("decrypted : "+l)}}else{const o=yield t.open(e);if("cancel"==o.id)return;const i=o.formData.user.pwd,l=a.encode(i,n);yield r.default.commands.execute("replaceSelection","`ENC:"+l+"`")}}))}()}))}),yield r.default.views.toolbarButtons.create("EnCDeC","enc_dec",i.ToolbarButtonLocation.EditorToolbar);const t=r.default.views.dialogs,e=yield t.create("EncDialog1");yield t.setHtml(e,'\n\t\t
Please Enter your password
\n\t\t\n\t\t');const o=yield t.create("DecDialog");yield t.setButtons(o,[{id:"ok"},{id:"cancel"},{id:"Decrypt",title:"Permanent"}]),yield t.setHtml(o,'\n\t\tPlease Enter your password
\n\t\t\n\t\t');const a={encode(t,e){const o=function(t,e){const o=new Uint16Array(e.length);for(let n=0;n