UNPKG

verdaccio-passport-google-oauth-ui

Version:

<h1 align="center"> 📦🔐 Verdaccio Google OAuth </h1>

3 lines (2 loc) 7.9 kB
(()=>{function e(e){return e&&e.__esModule?e.default:e}var t={};"use strict";var o={};o=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,o=[],a=0;a<e.rangeCount;a++)o.push(e.getRangeAt(a));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||o.forEach(function(t){e.addRange(t)}),t&&t.focus()}};var a={"text/plain":"Text","text/html":"Url",default:"Text"};function r(e){for(let t=0;t<10;t++)setTimeout(()=>e(),100*t)}function n(e,t){document.addEventListener("click",o=>{let a,r;a=o.path||o.composedPath?.(),r=document.querySelector(e),a.includes(r)&&(o.preventDefault(),o.stopPropagation(),t())},!0)}function c(){localStorage.removeItem("username"),localStorage.removeItem("token"),localStorage.removeItem("npm")}t=function(e,t){var r,n,c,s,i,l,p,u,d=!1;t||(t={}),c=t.debug||!1;try{if(i=o(),l=document.createRange(),p=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(o){if(o.stopPropagation(),t.format)if(o.preventDefault(),void 0===o.clipboardData){c&&console.warn("unable to use e.clipboardData"),c&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=a[t.format]||a.default;window.clipboardData.setData(r,e)}else o.clipboardData.clearData(),o.clipboardData.setData(t.format,e);t.onCopy&&(o.preventDefault(),t.onCopy(o.clipboardData))}),document.body.appendChild(u),l.selectNodeContents(u),p.addRange(l),!document.execCommand("copy"))throw Error("copy command was unsuccessful");d=!0}catch(o){c&&console.error("unable to copy using execCommand: ",o),c&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),d=!0}catch(o){c&&console.error("unable to copy using clipboardData: ",o),c&&console.error("falling back to prompt"),r="message"in t?t.message:"Copy to clipboard: #{key}, Enter",n=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",s=r.replace(/#{\s*key\s*}/g,n),window.prompt(s,e)}}finally{p&&("function"==typeof p.removeRange?p.removeRange(l):p.removeAllRanges()),u&&document.body.removeChild(u),i()}return d};var s={};e(s=JSON.parse('{"$schema":"http://json.schemastore.org/package","name":"verdaccio-passport-google-oauth-ui","version":"0.1.10","keywords":["authentication","google","login","npm","oauth","package","passport","private","registry","verdaccio","verdaccio-auth","verdaccio-auth-plugin","verdaccio-plugin"],"bugs":"https://github.com/okayasu/verdaccio-passport-google-oauth-ui/issues","repository":{"url":"git+https://github.com/okayasu/verdaccio-passport-google-oauth-ui.git"},"license":"MIT","author":"Masanori Okayasu","main":"dist/server/index.js","bin":{"verdaccio-passport-google-oauth-ui":"dist/cli/index.js"},"files":["dist","verdaccio.yaml"],"scripts":{"build":"bash run build","clean":"bash run clean","cli":"bash run cli","cli:login":"bash run cli-login","cli:publish":"bash run cli-publish","cli:whoami":"bash run cli-whoami","copy":"bash run copy","coverage":"vitest --coverage","dev":"run-s update start","docker":"bash run docker_","fix":"run-s format typecheck","format":"prettier --write \\"**/*.{ts,js,css,scss,html,json}\\"","format:check":"prettier --check \\"**/*.{ts,js,css,scss,html,json}\\"","prepack":"bash run clean && bash run build","start":"verdaccio -c verdaccio.yaml","test":"vitest","typecheck":"bash run typecheck","update":"run-s prepack copy","watch":"nodemon --watch src --watch verdaccio.yaml --ext ts,css,yaml --exec \\"bun dev\\""},"dependencies":{"@verdaccio/core":"^8.0.0-next-8.31","@verdaccio/url":"^13.0.0-next-8.31","copy-to-clipboard":"^3.3.3","dotenv":"^17.3.1","express":"^5.1.0","global-agent":"^3.0.0","lodash":"^4.17.23","minimist":"^1.2.8","open":"^11.0.0","ow":"^3.1.1","passport":"^0.7.0","passport-google-oauth":"^2.0.0","picocolors":"^1.1.1"},"devDependencies":{"@parcel/config-default":"^2.16.4","@parcel/transformer-typescript-tsc":"^2.16.4","@types/express":"^5.0.3","@types/global-agent":"^3.0.0","@types/lodash":"^4.17.24","@types/minimist":"^1.2.5","@types/node":"^24.12.0","@types/passport":"^1.0.17","@types/passport-google-oauth":"^1.0.45","@verdaccio/types":"^13.0.0-next-8.11","@vitest/coverage-v8":"^4.0.18","browserslist":"^4.28.1","core-js":"^3.48.0","nodemon":"^3.1.14","npm-run-all2":"^8.0.4","parcel":"^2.16.4","prettier":"^3.8.1","process":"^0.11.10","timekeeper":"^2.3.1","type-fest":"^5.4.4","typescript":"^5.9.3","verdaccio":"^6.3.1","verdaccio-htpasswd":"^13.0.0-next-8.31","vite-tsconfig-paths":"^6.1.1","vitest":"^4.0.18"},"peerDependencies":{"verdaccio":">=6"},"engines":{"node":">=20"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"targets":{"client":{"source":"src/client/verdaccio-6.ts","distDir":"dist/client","context":"browser","includeNodeModules":true},"server":{"source":"src/server/index.ts","distDir":"dist/server","context":"node","outputFormat":"commonjs","optimize":false,"isLibrary":true},"cli":{"source":"src/cli/index.ts","distDir":"dist/cli","context":"node","outputFormat":"commonjs","optimize":false}}}')).name,e(s).name.replace("verdaccio-","");let i="/-/oauth/authorize";!function(e){(function(){let e=localStorage.getItem("token");if("string"!=typeof e)return!0;let t=JSON.parse(decodeURIComponent(atob(e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/")).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")));if(!t)return!0;let o=1e3*t.exp-3e4;return Date.now()>=o})()&&c();let t=document.cookie.split(";").filter(e=>e.includes("=")).map(e=>e.split("=")).reduce((e,[t,o])=>({...e,[decodeURIComponent(t.trim())]:decodeURIComponent(o.trim())}),{});t.username&&t.uiToken&&t.npmToken&&(localStorage.setItem("username",t.username),localStorage.setItem("token",t.uiToken),localStorage.setItem("npm",t.npmToken),Object.keys(t).forEach(e=>document.cookie=`${e}=;expires=${new Date(0).toUTCString()}`),location.reload());let{loginButton:o,logoutButton:a,updateUsageInfo:s}=e;n(o,()=>{location.pathname===i?location.reload():location.href=i}),n(a,()=>{c(),location.href="/"}),document.addEventListener("click",()=>r(s)),r(s)}({loginButton:'[data-testid="header--button-login"]',logoutButton:'[data-testid="header--button-logout"],[data-testid="logOutDialogIcon"]',updateUsageInfo:function(){let o=!!localStorage.getItem("username")&&!!localStorage.getItem("token")&&!!localStorage.getItem("npm");if(!o)return;let a=document.querySelectorAll('[data-testid="tab-content"]');if(!a)return;let r=(function(){if(!localStorage.getItem("username"))return"Click the login button to authenticate with Google.";let e=window.VERDACCIO_API_URL?window.VERDACCIO_API_URL.replace(/^https?:/,"").replace(/-\/verdaccio\/$/,""):`//${location.host}${location.pathname}`,t=localStorage.getItem("npm");return`npm config set ${e}:_authToken "${t}"`})().split("\n").reverse();a.forEach(a=>{if("true"===a.getAttribute("replaced"))return;let n=Array.from(a.querySelectorAll("button")).map(e=>e.parentElement).filter(e=>!!e.innerText.match(/^(npm|pnpm|yarn)/));n.length&&(r.forEach(r=>{let c=n[0].cloneNode(!0);c.querySelector("span").innerText=r;let s=c.querySelector("button");s.style.visibility=o?"visible":"hidden",s.onclick=o=>{o.preventDefault(),o.stopPropagation(),e(t)(r)},n[0].parentElement.appendChild(c),a.setAttribute("replaced","true")}),n.forEach(e=>{(e.innerText.includes("adduser")||e.innerText.includes("set password"))&&(e.parentElement.removeChild(e),a.setAttribute("replaced","true"))}))})}})})(); //# sourceMappingURL=verdaccio-6.js.map