mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-11-14 00:07:00 +01:00
Suggest existing configurations for duplicate repository URLs (#911)
This commit is contained in:
1 parent
a301c46a94
commit
075c3a4622
6 files changed
+176
-24
No files matched your search
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"detector": {
|
||||
"ignoreRules": [],
|
||||
"ignoreFiles": [],
|
||||
"ignoreValues": [
|
||||
{
|
||||
"rule": "broken-image",
|
||||
"value": "*",
|
||||
"files": [
|
||||
"public/partials/anonymize.htm"
|
||||
],
|
||||
"createdAt": "2026-11-02T06:04:45.274Z",
|
||||
"reason": "Agent reviewed: existing avatar images use Vue :src bindings to safeUrl, not missing image sources."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"core.min.js": "core.3b07189932.min.js",
|
||||
"vendor.min.js": "vendor.bc13fa71b6.min.js",
|
||||
"vendor.min.js": "vendor.c6e173b8f8.min.js",
|
||||
"mermaid.min.js": "mermaid.f848a72d16.min.js",
|
||||
"all.min.css": "all.84bf1214d6.min.css",
|
||||
"markdown.min.js": "markdown.44f2e93820.min.js",
|
||||
|
||||
@@ -109,6 +109,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside class="repo-access-details" aria-label="Previous repository configuration" v-if="!isUpdate && previousConfigurations.length">
|
||||
<p role="status">You have already anonymized this repository. Use the existing configuration to keep its anonymous link and avoid creating another repository.</p>
|
||||
<div class="form-group" v-if="previousConfigurations.length > 1">
|
||||
<label class="paper-field-label" for="previousConfiguration">Previous anonymization</label>
|
||||
<select id="previousConfiguration" class="form-control" v-model="previousConfigurationId">
|
||||
<option v-for="previous in previousConfigurations" :key="previous.repoId" :value="previous.repoId">{{ previous.repoId }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<p v-else>{{ previousConfigurationId }}</p>
|
||||
<p>You can review and update its settings before saving.</p>
|
||||
<div class="repo-access-controls">
|
||||
<a class="btn btn-ink" :href="existingConfigurationUrl()">Use existing configuration</a>
|
||||
<button type="button" class="btn btn-link" @click="previousConfigurations = []">Create a separate anonymization</button>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<aside class="repo-access-details" aria-label="GitHub access" v-if="sourceUrl && githubConnections?.appEnabled && githubConnections.appConnected">
|
||||
<div class="repo-access-main">
|
||||
<div class="repo-access-controls">
|
||||
|
||||
@@ -1380,6 +1380,33 @@ export const anonymizeController = function (state, http, html, params, location
|
||||
state.html_readme = "";
|
||||
state.isUpdate = false;
|
||||
|
||||
state.previousConfigurations = [];
|
||||
state.previousConfigurationId = "";
|
||||
let previousRepositories;
|
||||
const normalizedRepositoryName = name => String(name || "").replace(/\/$/, "").replace(/\.git$/i, "").toLowerCase();
|
||||
async function findPreviousConfigurations() {
|
||||
if (state.isUpdate || params.repoId || params.pullRequestId || params.gistId) return;
|
||||
const request = { generation: sourceGeneration, url: state.sourceUrl.trim(), connection: state.githubConnection };
|
||||
try {
|
||||
// This endpoint only returns repositories the signed-in user can manage.
|
||||
previousRepositories ||= http.get("/api/user/anonymized_repositories").then(res => res.data);
|
||||
const repositories = await previousRepositories;
|
||||
if (!isCurrentSource(request)) return;
|
||||
const name = normalizedRepositoryName(parseRepoFullName(request.url));
|
||||
state.previousConfigurations = repositories.filter(repo => repo.repoId && repo.options
|
||||
&& normalizedRepositoryName(repo.source?.fullName) === name)
|
||||
.sort((a, b) => (Date.parse(b.anonymizeDate) || 0) - (Date.parse(a.anonymizeDate) || 0));
|
||||
state.previousConfigurationId = state.previousConfigurations[0]?.repoId || "";
|
||||
} catch (_) {
|
||||
// A suggestion failure must not prevent creating a repository. Retry on the next URL selection.
|
||||
previousRepositories = undefined;
|
||||
}
|
||||
}
|
||||
state.existingConfigurationUrl = () => {
|
||||
const previous = state.previousConfigurations.find(repo => repo.repoId === state.previousConfigurationId);
|
||||
return previous ? "/anonymize/" + encodeURIComponent(previous.repoId) : null;
|
||||
};
|
||||
|
||||
function getDefault(cb) {
|
||||
http.get("/api/user/default").then((res) => {
|
||||
const data = res.data;
|
||||
@@ -1601,6 +1628,8 @@ export const anonymizeController = function (state, http, html, params, location
|
||||
// Keep the same input focused until a complete GitHub URL can be loaded.
|
||||
state.urlSelected = async (preserveDraft = false) => {
|
||||
const generation = ++sourceGeneration;
|
||||
state.previousConfigurations = [];
|
||||
state.previousConfigurationId = "";
|
||||
let o;
|
||||
try { o = parseGithubUrl(state.sourceUrl.trim()); }
|
||||
catch (_) {
|
||||
@@ -1656,6 +1685,7 @@ export const anonymizeController = function (state, http, html, params, location
|
||||
await getPrDetails();
|
||||
} else {
|
||||
state.detectedType = "repo";
|
||||
void findPreviousConfigurations();
|
||||
await Promise.all([getRepoDetails(), getReadme()]);
|
||||
anonymizeReadme();
|
||||
}
|
||||
|
||||
Vendored
+23
-23
@@ -1,30 +1,30 @@
|
||||
"use strict";(()=>{var kd=Object.defineProperty;var Ed=(e,t)=>{for(var n in t)kd(e,n,{get:t[n],enumerable:!0})};var me=["abap","abc","actionscript","ada","alda","apache_conf","apex","applescript","aql","asciidoc","asl","assembly_x86","autohotkey","batchfile","c9search","c_cpp","cirru","clojure","cobol","coffee","coldfusion","crystal","csharp","csound_document","csound_orchestra","csound_score","csp","css","curly","d","dart","diff","django","dockerfile","dot","drools","edifact","eiffel","ejs","elixir","elm","erlang","forth","fortran","fsharp","fsl","ftl","gcode","gherkin","gitignore","glsl","gobstones","golang","graphqlschema","groovy","haml","handlebars","haskell","haskell_cabal","haxe","hjson","html","html_elixir","html_ruby","ini","io","jack","jade","java","javascript","json","json5","jsoniq","jsp","jssm","jsx","julia","kotlin","latex","less","liquid","lisp","livescript","logiql","logtalk","lsl","lua","luapage","lucene","makefile","markdown","mask","matlab","maze","mediawiki","mel","mixal","mushcode","mysql","nginx","nim","nix","nsis","nunjucks","objectivec","ocaml","pascal","perl","perl6","pgsql","php","php_laravel_blade","pig","plain_text","powershell","praat","prisma","prolog","properties","protobuf","puppet","python","qml","r","razor","rdoc","red","redshift","rhtml","rst","ruby","rust","sass","scad","scala","scheme","scss","sh","sjs","slim","smarty","snippets","soy_template","space","sparql","sql","sqlserver","stylus","svg","swift","tcl","terraform","tex","text","textile","toml","tsx","turtle","twig","typescript","vala","vbscript","velocity","verilog","vhdl","visualforce","wollok","xml","xquery","yaml","zeek"];var he={notebook:"/script/notebook.c3144c18ae.min.js",org:"/script/org.f61f262915.min.js",pdf:"/script/pdf.4d9cc6ff49.min.js",markdown:"/script/markdown.44f2e93820.min.js",editor:"/script/editor.4f142d3adc.min.js"};function gr(e){let t=e.location.hash.slice(1);if(e.history.replaceState(null,"","/review-link"),t.length>2048)return null;let n=new URLSearchParams(t);if([...n.keys()].length!==3||[...n.keys()].some(a=>!["clientId","intentId","token"].includes(a)))return null;let r=n.get("clientId"),s=n.get("intentId"),i=n.get("token");return!/^[a-f0-9]{32}$/.test(r||"")||!/^[a-f0-9]{32}$/.test(s||"")||!/^[a-f0-9]{64}$/.test(i||"")?null:{contract:"4open.artifacts/1",clientId:r,intentId:s,token:i}}function br(e,t){let{http:n,promises:r,window:s}=t,i=t.takeReviewHandoff(),a=i?{clientId:i.clientId,intentId:i.intentId}:null,u,f,w,h,k,m=!0,C,y=r.defer(),g=()=>[...s.crypto.getRandomValues(new Uint8Array(16))].map(L=>L.toString(16).padStart(2,"0")).join("");Object.assign(e,{repositoryId:"",handoffEnabled:!1,busy:!1,preview:null,acceptAccess:!1,acceptRetention:!1,uncertain:!1,saved:!1,expired:!1,error:i?"":"Open a new artifact link from your submission. This link is missing or invalid."});let S=()=>m&&e.user?.username===k;function R(){m=!1,i=u=f=void 0,y.resolve(),s.clearTimeout(C)}e.on("dispose",R),e.on("routeLeave",R),e.watch(()=>e.user?.username,L=>{!k&&L?k=L:k&&L!==k&&(R(),e.preview=null,e.repositoryId="",e.busy=!1,e.saved=!1,e.handoffEnabled=!1,e.error="Your account changed. Open a new artifact link from your submission.")});let T=()=>({timeout:y.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":f}}),P=L=>L?.status===404?"Artifact linking is not available on this server.":L?.status===401?"Sign in, then open a new artifact link from your submission.":L?.status===403?"This account cannot approve this repository or this link.":"The request could not be completed. You can retry from this page.";e.loadPreview=async()=>{if(!m||!i||e.busy||e.uncertain||e.saved||!e.user?.username)return;k=e.user.username;let L=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(L)){e.error="Enter the anonymous repository ID from its URL.";return}e.busy=!0,e.error="",e.preview=null,u=void 0,e.acceptAccess=e.acceptRetention=!1,e.expired=!1,s.clearTimeout(C),h||(h=g());try{let V=(await n.get("/api/review-consent/csrf",{timeout:y.promise})).data;if(!S())return;if(f=V.csrf,e.handoffEnabled=V.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(f||""))throw new Error("invalid_csrf");let M=(await n.post("/api/review-consent/preview",{repositoryId:L,intent:{...i,requestId:h}},T())).data;if(!S())return;if(!M||typeof M.ticket!="string"||!M.ticket||M.ticket.length>8192||typeof M.repositoryName!="string"||!["restricted-review","anonymous-link"].includes(M.policy?.access)||!Number.isSafeInteger(M.policy.version)||!Number.isFinite(Date.parse(M.policy.retainUntil))||!Number.isFinite(Date.parse(M.expiresAt))||Date.parse(M.expiresAt)<=Date.now()||Date.parse(M.expiresAt)>Date.now()+6e5)throw new Error("invalid_preview");u=M.ticket,w=g(),e.preview={repositoryName:M.repositoryName,policy:{...M.policy},expiresAt:M.expiresAt},C=s.setTimeout(()=>{m&&(e.expired=!0)},Math.max(0,Date.parse(M.expiresAt)-Date.now()))}catch(V){S()&&(e.error=P(V))}finally{S()&&(e.busy=!1)}},e.confirmConsent=async()=>{if(!(!S()||e.busy||e.saved||!u||!e.acceptAccesLine truncated
|
||||
`))),e[Ft]=Ro(s);let i=r||s.props&&s.props.type==="number";to(e,t?"change":"input",a=>{a.target.composing||e[Ft](Ys(e.value,n,i))}),(n||i)&&to(e,"change",()=>{e.value=Ys(e.value,n,i)}),t||(to(e,"compositionstart",Sc),to(e,"compositionend",ia),to(e,"change",ia))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let s=t??"",i=e[Jn];delete e[Jn],i!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==i?e[Ft](Ys(e.value,n,r)):e.value=s},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:i}},a){if(e[Ft]=Ro(a),e.composing)return;let u=(i||e.type==="number")&&!/^0\d/.test(e.value)?ko(e.value):e.value,f=t??"";if(u===f)return;let w=e.getRootNode();(w instanceof Document||w instanceof ShadowRoot)&&w.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===f)||(e.value=f)}},Qs={deep:!0,created(e,t,n){e[Ft]=Ro(n),to(e,"change",()=>{let r=e._modelValue,s=mn(e),i=e.checked,a=e[Ft];if(ve(r)){let u=Cn(r,s),f=u!==-1;if(i&&!f)a(r.concat(s));else if(!i&&f){let w=[...r];w.splice(u,1),a(w)}}else if(Et(r)){let u=new Set(r);i?u.add(s):u.delete(s),a(u)}else a(fa(e,i))})},mounted:aa,beforeUpdate(e,t,n){e[Ft]=Ro(n),aa(e,t,n)}};function aa(e,{value:t,oldValue:n},r){e._modelValue=t;let s;if(ve(t))s=Cn(t,r.props.value)>-1;else if(Et(t))s=t.has(r.props.value);else{if(t===n)return;s=Ct(t,fa(e,!0))}e.checked!==s&&(e.checked=s)}var pa={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,to(e,"change",()=>{let s=Array.prototype.filter.call(e.options,f=>f.selected).map(f=>n?ko(mn(f)):mn(f)),i=e.multiple,a=i?Et(e._modelValue)?new Set(s):s:s[0],u=e._pendingValue=[i,i?ve(a)?s.slice():s:a];try{e[Ft](a)}finally{ot(()=>{e._pendingValue===u&&(e._pendingValue=void 0)})}}),e[Ft]=Ro(r)},mounted(e,{value:t}){la(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Ft]=Ro(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!Nc(t,n[1],n[0]))&&la(e,t)}};function Nc(e,t,n){if(!n)return Ct(e,t);if(ve(e))return Ct(e,t);if(Et(e)){if(e.size!==t.length)return!1;for(let r of t)if(!e.has(r))return!1;return!0}return!1}function la(e,t){let n=e.multiple,r=ve(t);if(!(n&&!r&&!Et(t))){for(let s=0,i=e.options.length;s<i;s++){let a=e.options[s],u=mn(a);if(n)if(r){let f=typeof u;f==="string"||f==="number"?a.selected=t.some(w=>String(w)===String(u)):a.selected=Cn(t,u)>-1}else a.selected=t.has(u);else if(Ct(mn(a),t)){e.selectedIndex!==s&&(e.selectedIndex=s);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function mn(e){return"_value"in e?e._value:e.value}function fa(e,t){let n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}var Dc=["ctrl","shift","alt","meta"],Rc={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Dc.some(n=>e[`${n}Key`]&&!t.includes(n))},le=(e,t)=>{if(!e)return e;let n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((s,...i)=>{for(let a=0;a<t.length;a++){let u=Rc[t[a]];if(u&&u(s,t))return}return e(s,...i)}))},Tc={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},To=(e,t)=>{let n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;let i=At(s.key);if(t.some(a=>a===i||Tc[a]===i))return e(s)}))},Ac=je({patchProp:Ec},ic),da;function Oc(){return da||(da=Hi(Ac))}var ma=((...e)=>{let t=Oc().createApp(...e),{mount:n}=t;return t.mount=r=>{let s=Pc(r);if(!s)return;let i=t._component;!be(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");let a=n(s,!1,Ic(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),a},t});function Ic(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Pc(e){return Fe(e)?document.querySelector(e):e}var mo=typeof document<"u";function va(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Vc(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&va(e.default)}var Te=Object.assign;function Xn(e,t){let n={};for(let r in t){let s=t[r];n[r]=wt(s)?s.map(e):e(s)}return n}var Oo=()=>{},wt=Array.isArray;function xs(e,t){let n={};for(let r in e)n[r]=r in t?t[r]:e[r];return n}var ya=/#/g,qc=/&/g,Mc=/\//g,$c=/=/g,Lc=/\?/g,ga=/\+/g,Uc=/%5B/g,Fc=/%5D/g,ba=/%5E/g,zc=/%60/g,wa=/%7B/g,Hc=/%7C/g,ka=/%7D/g,Bc=/%20/g;function er(e){return e==null?"":encodeURI(""+e).replace(Hc,"|").replace(Uc,"[").replace(Fc,"]")}function Ea(e){return er(e).replace(wa,"{").replace(ka,"}").replace(ba,"^")}function Xs(e){return er(e).replace(ga,"%2B").replace(Bc,"+").replace(ya,"%23").replace(qc,"%26").replace(zc,"`").replace(wa,"{").replace(ka,"}").replace(ba,"^")}function jc(e){return Xs(e).replace($c,"%3D")}function Gc(e){return eLine truncated
|
||||
"use strict";(()=>{var kd=Object.defineProperty;var Ed=(e,t)=>{for(var n in t)kd(e,n,{get:t[n],enumerable:!0})};var pe=["abap","abc","actionscript","ada","alda","apache_conf","apex","applescript","aql","asciidoc","asl","assembly_x86","autohotkey","batchfile","c9search","c_cpp","cirru","clojure","cobol","coffee","coldfusion","crystal","csharp","csound_document","csound_orchestra","csound_score","csp","css","curly","d","dart","diff","django","dockerfile","dot","drools","edifact","eiffel","ejs","elixir","elm","erlang","forth","fortran","fsharp","fsl","ftl","gcode","gherkin","gitignore","glsl","gobstones","golang","graphqlschema","groovy","haml","handlebars","haskell","haskell_cabal","haxe","hjson","html","html_elixir","html_ruby","ini","io","jack","jade","java","javascript","json","json5","jsoniq","jsp","jssm","jsx","julia","kotlin","latex","less","liquid","lisp","livescript","logiql","logtalk","lsl","lua","luapage","lucene","makefile","markdown","mask","matlab","maze","mediawiki","mel","mixal","mushcode","mysql","nginx","nim","nix","nsis","nunjucks","objectivec","ocaml","pascal","perl","perl6","pgsql","php","php_laravel_blade","pig","plain_text","powershell","praat","prisma","prolog","properties","protobuf","puppet","python","qml","r","razor","rdoc","red","redshift","rhtml","rst","ruby","rust","sass","scad","scala","scheme","scss","sh","sjs","slim","smarty","snippets","soy_template","space","sparql","sql","sqlserver","stylus","svg","swift","tcl","terraform","tex","text","textile","toml","tsx","turtle","twig","typescript","vala","vbscript","velocity","verilog","vhdl","visualforce","wollok","xml","xquery","yaml","zeek"];var fe={notebook:"/script/notebook.c3144c18ae.min.js",org:"/script/org.f61f262915.min.js",editor:"/script/editor.4f142d3adc.min.js",pdf:"/script/pdf.4d9cc6ff49.min.js",markdown:"/script/markdown.44f2e93820.min.js"};function br(e){let t=e.location.hash.slice(1);if(e.history.replaceState(null,"","/review-link"),t.length>2048)return null;let n=new URLSearchParams(t);if([...n.keys()].length!==3||[...n.keys()].some(a=>!["clientId","intentId","token"].includes(a)))return null;let r=n.get("clientId"),s=n.get("intentId"),i=n.get("token");return!/^[a-f0-9]{32}$/.test(r||"")||!/^[a-f0-9]{32}$/.test(s||"")||!/^[a-f0-9]{64}$/.test(i||"")?null:{contract:"4open.artifacts/1",clientId:r,intentId:s,token:i}}function wr(e,t){let{http:n,promises:r,window:s}=t,i=t.takeReviewHandoff(),a=i?{clientId:i.clientId,intentId:i.intentId}:null,u,m,k,y,E,h=!0,C,g=r.defer(),b=()=>[...s.crypto.getRandomValues(new Uint8Array(16))].map(M=>M.toString(16).padStart(2,"0")).join("");Object.assign(e,{repositoryId:"",handoffEnabled:!1,busy:!1,preview:null,acceptAccess:!1,acceptRetention:!1,uncertain:!1,saved:!1,expired:!1,error:i?"":"Open a new artifact link from your submission. This link is missing or invalid."});let S=()=>h&&e.user?.username===E;function R(){h=!1,i=u=m=void 0,g.resolve(),s.clearTimeout(C)}e.on("dispose",R),e.on("routeLeave",R),e.watch(()=>e.user?.username,M=>{!E&&M?E=M:E&&M!==E&&(R(),e.preview=null,e.repositoryId="",e.busy=!1,e.saved=!1,e.handoffEnabled=!1,e.error="Your account changed. Open a new artifact link from your submission.")});let T=()=>({timeout:g.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":m}}),q=M=>M?.status===404?"Artifact linking is not available on this server.":M?.status===401?"Sign in, then open a new artifact link from your submission.":M?.status===403?"This account cannot approve this repository or this link.":"The request could not be completed. You can retry from this page.";e.loadPreview=async()=>{if(!h||!i||e.busy||e.uncertain||e.saved||!e.user?.username)return;E=e.user.username;let M=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(M)){e.error="Enter the anonymous repository ID from its URL.";return}e.busy=!0,e.error="",e.preview=null,u=void 0,e.acceptAccess=e.acceptRetention=!1,e.expired=!1,s.clearTimeout(C),y||(y=b());try{let V=(await n.get("/api/review-consent/csrf",{timeout:g.promise})).data;if(!S())return;if(m=V.csrf,e.handoffEnabled=V.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(m||""))throw new Error("invalid_csrf");let z=(await n.post("/api/review-consent/preview",{repositoryId:M,intent:{...i,requestId:y}},T())).data;if(!S())return;if(!z||typeof z.ticket!="string"||!z.ticket||z.ticket.length>8192||typeof z.repositoryName!="string"||!["restricted-review","anonymous-link"].includes(z.policy?.access)||!Number.isSafeInteger(z.policy.version)||!Number.isFinite(Date.parse(z.policy.retainUntil))||!Number.isFinite(Date.parse(z.expiresAt))||Date.parse(z.expiresAt)<=Date.now()||Date.parse(z.expiresAt)>Date.now()+6e5)throw new Error("invalid_preview");u=z.ticket,k=b(),e.preview={repositoryName:z.repositoryName,policy:{...z.policy},expiresAt:z.expiresAt},C=s.setTimeout(()=>{h&&(e.expired=!0)},Math.max(0,Date.parse(z.expiresAt)-Date.now()))}catch(V){S()&&(e.error=q(V))}finally{S()&&(e.busy=!1)}},e.confirmConsent=async()=>{if(!(!S()||e.busy||e.saved||!u||!e.acceptAccesLine truncated
|
||||
`))),e[Ft]=Ro(s);let i=r||s.props&&s.props.type==="number";to(e,t?"change":"input",a=>{a.target.composing||e[Ft](Js(e.value,n,i))}),(n||i)&&to(e,"change",()=>{e.value=Js(e.value,n,i)}),t||(to(e,"compositionstart",Sc),to(e,"compositionend",aa),to(e,"change",aa))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let s=t??"",i=e[Jn];delete e[Jn],i!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==i?e[Ft](Js(e.value,n,r)):e.value=s},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:i}},a){if(e[Ft]=Ro(a),e.composing)return;let u=(i||e.type==="number")&&!/^0\d/.test(e.value)?ko(e.value):e.value,m=t??"";if(u===m)return;let k=e.getRootNode();(k instanceof Document||k instanceof ShadowRoot)&&k.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===m)||(e.value=m)}},Xs={deep:!0,created(e,t,n){e[Ft]=Ro(n),to(e,"change",()=>{let r=e._modelValue,s=mn(e),i=e.checked,a=e[Ft];if(me(r)){let u=Cn(r,s),m=u!==-1;if(i&&!m)a(r.concat(s));else if(!i&&m){let k=[...r];k.splice(u,1),a(k)}}else if(Et(r)){let u=new Set(r);i?u.add(s):u.delete(s),a(u)}else a(fa(e,i))})},mounted:la,beforeUpdate(e,t,n){e[Ft]=Ro(n),la(e,t,n)}};function la(e,{value:t,oldValue:n},r){e._modelValue=t;let s;if(me(t))s=Cn(t,r.props.value)>-1;else if(Et(t))s=t.has(r.props.value);else{if(t===n)return;s=Ct(t,fa(e,!0))}e.checked!==s&&(e.checked=s)}var Xn={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,to(e,"change",()=>{let s=Array.prototype.filter.call(e.options,m=>m.selected).map(m=>n?ko(mn(m)):mn(m)),i=e.multiple,a=i?Et(e._modelValue)?new Set(s):s:s[0],u=e._pendingValue=[i,i?me(a)?s.slice():s:a];try{e[Ft](a)}finally{ot(()=>{e._pendingValue===u&&(e._pendingValue=void 0)})}}),e[Ft]=Ro(r)},mounted(e,{value:t}){da(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Ft]=Ro(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!Nc(t,n[1],n[0]))&&da(e,t)}};function Nc(e,t,n){if(!n)return Ct(e,t);if(me(e))return Ct(e,t);if(Et(e)){if(e.size!==t.length)return!1;for(let r of t)if(!e.has(r))return!1;return!0}return!1}function da(e,t){let n=e.multiple,r=me(t);if(!(n&&!r&&!Et(t))){for(let s=0,i=e.options.length;s<i;s++){let a=e.options[s],u=mn(a);if(n)if(r){let m=typeof u;m==="string"||m==="number"?a.selected=t.some(k=>String(k)===String(u)):a.selected=Cn(t,u)>-1}else a.selected=t.has(u);else if(Ct(mn(a),t)){e.selectedIndex!==s&&(e.selectedIndex=s);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function mn(e){return"_value"in e?e._value:e.value}function fa(e,t){let n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}var Dc=["ctrl","shift","alt","meta"],Rc={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Dc.some(n=>e[`${n}Key`]&&!t.includes(n))},ie=(e,t)=>{if(!e)return e;let n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((s,...i)=>{for(let a=0;a<t.length;a++){let u=Rc[t[a]];if(u&&u(s,t))return}return e(s,...i)}))},Tc={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},To=(e,t)=>{let n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;let i=At(s.key);if(t.some(a=>a===i||Tc[a]===i))return e(s)}))},Ac=je({patchProp:Ec},ic),ua;function Oc(){return ua||(ua=Bi(Ac))}var ma=((...e)=>{let t=Oc().createApp(...e),{mount:n}=t;return t.mount=r=>{let s=Pc(r);if(!s)return;let i=t._component;!ge(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");let a=n(s,!1,Ic(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),a},t});function Ic(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Pc(e){return Le(e)?document.querySelector(e):e}var mo=typeof document<"u";function va(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Vc(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&va(e.default)}var Te=Object.assign;function Zn(e,t){let n={};for(let r in t){let s=t[r];n[r]=wt(s)?s.map(e):e(s)}return n}var Oo=()=>{},wt=Array.isArray;function er(e,t){let n={};for(let r in e)n[r]=r in t?t[r]:e[r];return n}var ya=/#/g,qc=/&/g,Mc=/\//g,Uc=/=/g,$c=/\?/g,ga=/\+/g,Lc=/%5B/g,Fc=/%5D/g,ba=/%5E/g,zc=/%60/g,wa=/%7B/g,Hc=/%7C/g,ka=/%7D/g,Bc=/%20/g;function tr(e){return e==null?"":encodeURI(""+e).replace(Hc,"|").replace(Lc,"[").replace(Fc,"]")}function Ea(e){return tr(e).replace(wa,"{").replace(ka,"}").replace(ba,"^")}function Zs(e){return tr(e).replace(ga,"%2B").replace(Bc,"+").replace(ya,"%23").replace(qc,"%26").replace(zc,"`").replace(wa,"{").replace(ka,"}").replace(ba,"^")}function jc(e){return Zs(e).replace(Uc,"%3D")}function Gc(e){return tLine truncated
|
||||
${JSON.stringify(e)}${t?`
|
||||
while being at
|
||||
`+JSON.stringify(t):""}`},[Be.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${ep(t)}" via a navigation guard.`},[Be.NAVIGATION_ABORTED]({from:e,to:t}){return`Navigation aborted from "${e.fullPath}" to "${t.fullPath}" via a navigation guard.`},[Be.NAVIGATION_CANCELLED]({from:e,to:t}){return`Navigation cancelled from "${e.fullPath}" to "${t.fullPath}" with a new navigation.`},[Be.NAVIGATION_DUPLICATED]({from:e,to:t}){return`Avoided redundant navigation to current location: "${e.fullPath}".`}};function fo(e,t){return Te(new Error,{type:e,[Oa]:!0},t)}function Ht(e,t){return e instanceof Error&&Oa in e&&(t==null||!!(e.type&t))}var xc=["params","query","hash"];function ep(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let n of xc)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Ia(e){let t={};if(e===""||e==="?")return t;let n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){let s=n[r].replace(ga," "),i=s.indexOf("="),a=Ao(i<0?s:s.slice(0,i)),u=i<0?null:Ao(s.slice(i+1));if(a in t){let f=t[a];wt(f)||(f=t[a]=[f]),f.push(u)}else t[a]=u}return t}function rr(e){let t="";for(let n in e){let r=e[n];if(n=jc(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(wt(r)?r.map(s=>s&&Xs(s)):[r&&Xs(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function Pa(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=wt(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}var Va=Symbol(""),ir=Symbol(""),ts=Symbol(""),os=Symbol(""),ns=Symbol("");function Io(){let e=[];function t(r){return e.push(r),()=>{let s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Qt(e,t,n,r,s,i=a=>a()){let a=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((u,f)=>{let w=m=>{m===!1?f(fo(Be.NAVIGATION_ABORTED,{from:n,to:t})):m instanceof Error?f(m):Zc(m)?f(fo(Be.NAVIGATION_GUARD_REDIRECT,{from:t,to:m})):(a&&r.enterCallbacks[s]===a&&typeof m=="function"&&a.push(m),u())},h=i(()=>e.call(r&&r.instances[s],t,n,w)),k=Promise.resolve(h);e.length<3&&(k=k.then(w)),k.catch(m=>f(m))})}function ss(e,t,n,r,s=i=>i()){let i=[];for(let a of e)for(let u in a.components){let f=a.components[u];if(!(t!=="beforeRouteEnter"&&!a.instances[u]))if(va(f)){let w=(f.__vccOpts||f)[t];w&&i.push(Qt(w,n,r,a,u,s))}else{let w=f();i.push(()=>w.then(h=>{if(!h)throw new Error(`Couldn't resolve component "${u}" at "${a.path}"`);let k=Vc(h)?h.default:h;a.mods[u]=h,a.components[u]=k;let m=(k.__vccOpts||k)[t];return m&&Qt(m,n,r,a,u,s)()}))}}return i}function qa(e,t){let n=[],r=[],s=[],i=Math.max(t.matched.length,e.matched.length);for(let a=0;a<i;a++){let u=t.matched[a];u&&(e.matched.find(w=>po(w,u))?r.push(u):n.push(u));let f=e.matched[a];f&&(t.matched.find(w=>po(w,f))||s.push(f))}return[n,r,s]}var tp=()=>location.protocol+"//"+location.host;function Wa(e,t){let{pathname:n,search:r,hash:s}=t,i=e.indexOf("#");if(i>-1){let a=s.includes(e.slice(i))?e.slice(i).length:1,u=s.slice(a);return u[0]!=="/"&&(u="/"+u),tr(u,"")}return tr(n,e)+r+s}function op(e,t,n,r){let s=[],i=[],a=null,u=({state:m})=>{let C=Wa(e,location),y=n.value,g=t.value,S=0;if(m){if(n.value=C,t.value=m,a&&a===y){a=null;return}S=g?m.position-g.position:0}else r(C);s.forEach(R=>{R(n.value,y,{delta:S,type:xn.pop,direction:S?S>0?es.forward:es.back:es.unknown})})};function f(){a=n.value}function w(m){s.push(m);let C=()=>{let y=s.indexOf(m);y>-1&&s.splice(y,1)};return i.push(C),C}function h(){if(document.visibilityState==="hidden"){let{history:m}=window;if(!m.state)return;m.replaceState(Te({},m.state,{scroll:hn()}),"")}}function k(){for(let m of i)m();i=[],window.removeEventListener("popstate",u),window.removeEventListener("pagehide",h),document.removeEventListener("visibilitychange",h)}return window.addEventListener("popstate",u),window.addEventListener("pagehide",h),document.addEventListener("visibilitychange",h),{pauseListeners:f,listen:w,destroy:k}}function Ma(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?hn():null}}function np(e){let{history:t,location:n}=window,r={value:Wa(e,n)},s={value:t.state};s.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(f,w,h){let k=e.indexOf("#"),m=k>-1?(n.host&&document.querySelector("base")?e:e.slice(k))+f:tp()+e+f;try{t[h?"replaceState":"pushState"](w,"",m),s.value=w}catch(C){console.error(C),n[h?"replace":"assign"](m)}}function a(f,w){i(f,Te({},t.state,Ma(s.value.back,f,s.value.forward,!0),w,{position:s.value.position}),!0),r.value=f}function u(f,w){let h=Te({},s.value,t.state,{forward:f,scroll:hn()});i(h.current,h,!0),i(f,Te({},Ma(r.value,f,null),{position:h.position+1},w),!1),r.value=f}return{location:r,state:s,push:u,replace:a}}function Ka(e){e=Na(e);let t=np(e),n=op(e,t.state,t.location,t.replace);function r(i,a=!0){a||n.pauseListeners(),history.go(i)}let s=Te({locatLine truncated
|
||||
`)),e.options=Object.assign({},e.options,h.options),a.restore()})}u();let f=null;e.saveDefault=w=>{if(w&&w.preventDefault&&w.preventDefault(),e.saving)return;let h=a.checkpoint(),k={terms:e.terms.split(`
|
||||
`).map(m=>m.trim()).filter(m=>m.length>0),options:e.options};e.saving=!0,e.error=null,t.post("/api/user/default",k).then(()=>{a.accept(h),e.saving=!1,e.message=e.unsavedChanges?null:"Saved",f&&r.cancel(f),f=r(()=>{e.message=null},2500)},m=>{e.saving=!1;let C=m&&m.data&&m.data.error,y="Unable to save your defaults. Please try again.";Promise.all([n("ERRORS."+C),n("ERRORS.unknown_error")]).then(([g,S])=>{e.error=C&&g!==S?g:y},()=>{e.error=y})})},e.deleteAccount=()=>{confirm("Delete your account? All your anonymized repositories, gists, and pull requests will be removed, and your personal data will be erased. This cannot be undone.")&&(e.deletingAccount=!0,t.delete("/api/user").then(()=>{window.location.href="/"},()=>{e.deletingAccount=!1,e.deleteError="Unable to delete the account. Please try again."}))}},il=function(e,t,n){e.repoId=null,e.repoUrl=null,e.claim=()=>{t.post("/api/repo/claim",{repoId:e.repoId,repoUrl:e.repoUrl}).then(r=>{n.url("/dashboard")},r=>{e.error=r.data,e.claimForm.repoUrl.setValidity("not_found",!1),e.claimForm.repoId.setValidity("not_found",!1)})}},al=function(e,t,n,r,s){e.user&&!e.user.status&&n.url("/dashboard"),e.watch("user.status",()=>{e.user&&!e.user.status&&n.url("/dashboard")}),e.features=[{key:"anonymize",num:"01",eyebrow:"Anonymize",title:"Double-anonymous,",accent:"your rules.",text:"Choose what reviewers may see: links, images, PDFs, notebooks, GitHub Pages. Add your own terms, with regex if you need it, and pick the expiration date.",cta:"Start an anonymization",href:"/anonymize",url:"anonymous.4open.science/anonymize",img:"/imgs/anonymize.png",alt:"The anonymize form: source repository, terms to redact, options and a live README preview"},{key:"review",num:"02",eyebrow:"Review",title:"Reviewers browse",accent:"the real thing.",text:"Highlighted source code, rendered PDFs, images, and notebooks, in a familiar file explorer. GitHub Pages is also supported.",cta:"Open the example",href:"https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/",target:"_self",url:"anonymous.4open.science/r/840c8c57-\u2026",img:"/imgs/explorer.png",alt:"The repository explorer with a file tree and a rendered README"},{key:"manage",num:"03",eyebrow:"Manage",title:"One dashboard,",accent:"until the decision.",text:"Monitor views, edit configuration, remove or update your repository. Program chairs can group submissions under a conference with one shared expiry.",cta:"Open the dashboard",href:"/dashboard",needsUser:!0,url:"anonymous.4open.science/dashboard",img:"/imgs/dashboard.png",alt:"The dashboard listing anonymized repositories with status, views and expiry"}],e.feature=e.features[0].key,e.selectFeature=function(u){e.feature=u},e.featureHref=function(u){return u.needsUser&&!e.user?"/signin":u.href},e.featureTarget=function(u){return u.needsUser&&!e.user?"_self":u.target||void 0},e.featureKeydown=function(u,f){let w={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:"first",End:"last"}[u.key];if(w===void 0)return;u.preventDefault();let h=e.features.length,k=w==="first"?0:w==="last"?h-1:(f+w+h)%h;e.feature=e.features[k].key,s(()=>{let m=r.document.getElementById("feature-tab-"+e.feature);m&&m.focus()})},e.cards=[{key:"repositories",total:0,label:"repositories anonymized"},{key:"users",total:0,label:"researchers"},{key:"pageViews",total:0,label:"page views"},{key:"pullRequests",total:0,label:"pull requests"}];function i(){t.get("/api/stat/").then(u=>{e.stat=u.data,e.cards[0].total=u.data.nbRepositories,e.cards[1].total=u.data.nbUsers,e.cards[2].total=u.data.nbPageViews,e.cards[3].total=u.data.nbPullRequests})}i();function a(u){let f={series:u,bars:[],viewW:100,deltaToday:0,pctChange:0,pctAbs:0,isUp:!0};if(!u||u.length<2)return f;let w=new Array(u.length-1);for(let g=1;g<u.length;g++)w[g-1]=u[g]-u[g-1];let h=w.length,k=Math.max.apply(null,w),m=Math.min.apply(null,w),C=Math.min(0,m),y=k-C||1;f.viewW=h*2,f.bars=new Array(h);for(let g=0;g<h;g++){let S=(w[g]-C)/y,R=Math.max(1.5,S*34);f.bars[g]={x:(g*2+.25).toFixed(2),y:(36-R).toFixed(2),w:"1.5",h:R.toFixed(2)}}if(f.deltaToday=w[h-1],h>=2){let g=w[h-2];g&&(f.pctChange=(f.deltaToday-g)/g*100)}return f.pctAbs=Math.round(Math.abs(f.pctChange)),f.isUp=f.pctChange>=0,f}e.history={repositories:a([]),users:a([]),pageViews:a([]),pullRequests:a([])},t.get("/api/stat/history?days=60").then(u=>{let f=u.data||[];e.history={repositories:a(f.map(w=>w.nbRepositories||0)),users:a(f.map(w=>w.nbUsers||0)),pageViews:a(f.map(w=>w.nbPageViews||0)),pullRequests:a(f.map(w=>w.nbPullRequests||0))}})},ll=function(e,t,n,r,s,i){let a=ut();e.on("routeLeave",function(){$('[data-toggle="tooltip"]').tooltip("dispose")}),e.watch("user.status",()=>{e.user==null&&n.url("/")}),e.user==null&&n.url("/"),a.timeout(()=>{$('[data-toggle="tooltip"]').tooltip()},250),e.quotaExpanded=!1,e.closeQuota=()=>{e.quotaExpanded=!1,ot(()=>document.querySelector(".dashboard-quota > summary")?.focus())},Zt()(document,"click",N=>{e.quotaExpanded&&!N.target.closest?.(".dashboard-quota")&
Line truncated
|
||||
`)),e.options=Object.assign({},e.options,B.options),e.options.expirationDate=B.options&&B.options.expirationDate?new Date(B.options.expirationDate):T(),!r.repoId&&!r.pullRequestId&&!r.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),_&&_()})}function M(_,q,B){e.anonymize&&e.anonymize[_]&&e.anonymize[_].setValidity(q,B)}function se(_){try{let q=parseGithubUrl(_);if(q&&q.owner&&q.repo)return q.owner+"/"+q.repo}catch{}return null}e.accessRepairAllowed=!1,e.repairingGitHubAccess=!1,e.accessRepairMessage="",e.repairGitHubAccess=async()=>{if(!e.accessRepairAllowed||e.repairingGitHubAccess||!e.githubConnections?.appEnabled||!r.repoId||e.role!=="owner"||e.githubConnection!=="github-app"||se(e.sourceUrl)!==e._originalFullName)return;e.repairingGitHubAccess=!0,e.accessRepairMessage="";let _=m();try{let q=await t.get("/github/connections");if(e.githubConnections=q.data,!q.data.appEnabled)return;let B=await t.post("/github/connections/migrate",{type:"repository",id:r.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":q.data.csrf}});if(!k(_))return;e.error=null,B.data.fullName&&(e._originalFullName=B.data.fullName,e.source.fullName=B.data.fullName,e.sourceUrl="https://github.com/"+B.data.fullName),e.accessRepairMessage="GitHub access repaired. Your anonymous URL and published commit are unchanged.",await e.urlSelected(!0)}catch{k(_)&&(e.accessRepairMessage="Unable to repair GitHub access. Check the App's repository permissions in Manage access, then retry. Your published snapshot has not been replaced.")}finally{e.repairingGitHubAccess=!1,C(_)}},e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,e.reconnectSource=async()=>{if(confirm("Reconnect to the repository currently at this GitHub URL? Review its branch and commit before saving. Saving will replace the published snapshot.")){e.reconnectingSource=!0,e.reconnectRepositoryId=void 0,e.source.commit="",e.source.branch="",e.readme="",e.branches=[];try{await Y()}catch{}}};function te(){return e.reconnectingSource||!e.isUpdate||!e._originalRepositoryID?void 0:se(e.sourceUrl)===e._originalFullName?e._originalRepositoryID:void 0}async function N(){e._preservingDraft=!0;try{await e.urlSelected(!0)}finally{e._preservingDraft=!1}}async function I(){let _;try{_=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!_||_.path!==s.path()||Date.now()-_.savedAt>=30*6e4)return S.restore()?(e.sourceUrl&&await N(),!0):!1;S.restore();for(let q of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(_.draft,q)&&(e[q]=_.draft[q]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await N(),sessionStorage.removeItem("github-access-draft"),!0}V(()=>{!r.repoId&&!r.pullRequestId&&!r.gistId&&a(I,0),r.repoId&&r.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=r.repoId,t.get("/api/repo/"+e.repoId).then(async _=>{e.accessRepairAllowed=!["removed","archived","preparing","queue","download","removing","expiring"].includes(_.data.status),e.githubConnection=_.data.connection||"oauth",e.sourceUrl="https://github.com/"+_.data.source.fullName,e._originalFullName=_.data.source.fullName,e.terms=_.data.options.terms.filter(q=>q).join(`
|
||||
`),e.source=_.data.source,e.role=_.data.role||"owner",e.coauthors=_.data.coauthors||[],e._originalBranch=_.data.source.branch,e.options=Object.assign({},e.options,_.data.options),e.conference=_.data.conference,e._originalConference=_.data.conference,e.repositoryID=_.data.source.repositoryID,e._originalRepositoryID=_.data.source.repositoryID,_.data.options.expirationDate&&(e.options.expirationDate=new Date(_.data.options.expirationDate)),y=g(parseGithubUrl(e.sourceUrl)),!await I()&&(await Promise.all([Y(),Z()]),pe())},()=>{s.url("/404")})),r.pullRequestId&&r.pullRequestId!=""&&(e.isUpdate=!0,e.detectedType="pr",e.pullRequestId=r.pullRequestId,t.get("/api/pr/"+e.pullRequestId).then(async _=>{if(e.githubConnection=_.data.connection||"oauth",e.sourceUrl="https://github.com/"+_.data.source.repositoryFullName+"/pull/"+_.data.source.pullRequestId,e.terms=_.data.options.terms.filter(q=>q).join(`
|
||||
`),e.source=_.data.source,e.options=Object.assign({},e.options,_.data.options),e.conference=_.data.conference,e._originalConference=_.data.conference,_.data.options.expirationDate&&(e.options.expirationDate=new Date(_.data.options.expirationDate)),y=g(parseGithubUrl(e.sourceUrl)),!await I())try{await fe()}catch{}},()=>{s.url("/404")})),r.gistId&&r.gistId!=""&&(e.isUpdate=!0,e.detectedType="gist",e.gistId=r.gistId,t.get("/api/gist/"+e.gistId).then(async _=>{e.sourceUrl="https://gist.github.com/"+_.data.source.gistId,e.terms=_.data.options.terms.filter(q=>q).join(`
|
||||
`),e.source=_.data.source,e.options=Object.assign({},e.options,_.data.options),e.conference=_.data.conference,e._originalConference=_.data.conference,_.data.options.expirationDate&&(e.options.expirationDate=new Date(_.data.options.expirationDate)),y=g(parseGithubUrl(e.sourceUrl)),!await I()&&await Le()},()=>{s.url("/404")}))}),t.get("/github/connections").then(_=>{e.githubConnections=_.data,!r.repoId&&!r.pullRequestId&&!r.gistId&&e.githubConnection===void 0&&_.data.appEnabled&&_.data.appConnected&&(e.githubConnection="github-app",e.sourceUrl&&e.workspaceOpen&&N())}).catch(()=>{}),e.urlSelected=async(_=!1)=>{let q=++f,B;try{B=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,ie.cancel(),Se.cancel(),Ie.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",M("sourceUrl","github",!1);return}let v=g(B),E=_||y===v;y=v,e.sourceUrlError="",M("sourceUrl","github",!0);let O=document.activeElement?.id==="sourceUrl-landing";e.workspaceOpen=!0,O&&a(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!E&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],E||(e.source={type:"GitHubStream",branch:"",commit:""}),ie.cancel(),Se.cancel(),Ie.cancel(),ae.clear(),De.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",e.html_readme="",e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=E;try{B.gistId&&!B.repo?(e.detectedType="gist",e.source={gistId:B.gistId},await Le()):B.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:B.owner+"/"+B.repo,pullRequestId:B.pullRequestId},await fe()):(e.detectedType="repo",await Promise.all([Y(),Z()]),pe())}catch{}finally{q===f&&(e._preservingDraft=!1)}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let _=e.branches.filter(B=>B.name==e.source.branch)[0];if(!_)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=_.commit),e.readme=_.readme,await Z(),pe()}),e.getBranches=async _=>{let q=parseGithubUrl(e.sourceUrl),B=m();try{let v=await t.get(`/api/repo/${q.owner}/${q.repo}/branches`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&se(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:_===!0||e.reconnectingSource?"1":"0",repositoryID:te()}});if(!k(B))return;e.branches=v.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let E=e.branches.filter(O=>O.name==e.source.branch);E.length>0&&(!(!e.reconnectingSource&&!_&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=E[0].commit),e.readme=E[0].readme,await Z(_))}catch(v){if(!k(B))return;e.branches=[],e.sourceUnreachable=v&&(v.status===404||v.data&&v.data.error==="repo_not_found");let E=v&&v.data&&v.data.error||(v&&v.status===404?"repo_not_found":"unknown_error");i("ERRORS."+E).then(O=>{e.toasts=e.toasts||[],e.addToast({title:"Error",date:new Date,body:O}),e.error=O},console.error),typeof M=="function"&&M("sourceUrl","missing",!1)}finally{C(B)}};async function Y(){let _=parseGithubUrl(e.sourceUrl),q=m();try{U();let B=await t.get(`/api/repo/${_.owner}/${_.repo}/`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&se(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,repositoryID:te(),force:"1"}});if(!k(q))return;e.details=B.data,e.reconnectingSource&&(e.reconnectRepositoryId=e.details.externalId),e.details&&e.details.id&&(e.repositoryID=e.details.id),e.repoId||(e.repoId=e.details.repo+"-"+generateRandomId(4)),await e.getBranches(e.reconnectingSource)}catch(B){if(!k(q))return;throw B.data&&(i("ERRORS."+B.data.error).then(v=>{e.addToast({title:"Error",date:new Date,body:v}),e.error=v},console.error),X(B.data.error)),M("sourceUrl","missing",!1),B}finally{C(q)}}async function Z(_){if(e.readme&&!_)return e.readme;let q=parseGithubUrl(e.sourceUrl),B=m();try{let v=await t.get(`/api/repo/${q.owner}/${q.repo}/readme`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&se(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:_===!0?"1":"0",branch:e.source.branch,repositoryID:te()}});k(B,!0)&&(e.readme=v.data)}catch{k(B,!0)&&(e.readme="")}finally{C(B)}}function ee(){let _={terms:e.terms?e.terms.split(`
|
||||
`):[],image:!!e.options.image,link:!!e.options.link,repoId:e.repoId};e.source&&e.source.branch&&(_.branchName=e.source.branch);try{let q=parseGithubUrl(e.sourceUrl);_.repoName=`${q.owner}/${q.repo}`}catch{}return _}function J(_,q,B){let v=null,E=0,O=()=>{if(e.detectedType!==_)return;v&&a.cancel(v);let H=++E;e.previewStatus="loading",v=a(()=>{v=null;let F=q();if(!F){e.previewStatus="idle";return}t.post("/api/anonymize-preview",F).then(j=>{H===E&&(B(j.data,F),e.previewStatus="ready")}).catch(()=>{H===E&&(e.previewStatus="error")})},200)};return O.cancel=()=>{E++,v&&a.cancel(v),v=null},e.on("dispose",O.cancel),O}e.retryPreview=()=>{e.detectedType==="repo"&&ie(),e.detectedType==="pr"&&Se(),e.detectedType==="gist"&&Ie()};let ie=J("repo",()=>e.readme?{content:e.readme,options:ee()}:null,_=>{if(typeof _?.content!="string")throw Error("Invalid preview response");e.anonymize_readme=_.content;let q="";try{let v=parseGithubUrl(e.sourceUrl),E=e.source.branch||e.details&&e.details.defaultBranch||"main";q=`https://github.com/${v.owner}/${v.repo}/raw/${E}/`}catch{}let B=renderMD(e.anonymize_readme,q);e.html_readme=B,a(Prism.highlightAll,150)});function pe(){!e.anonymize||!e.anonymize.terms||(e.termsRegexWarning=!!e.terms&&!!e.terms.match(/[-[\]{}()*+?.,\\^$|#]/g),ie())}async function fe(){let _=parseGithubUrl(e.sourceUrl),q=m();try{U();let B=await t.get(`/api/pr/${_.owner}/${_.repo}/${_.pullRequestId}`,{params:{connection:e.githubConnection}});if(!k(q))return;e.details=B.data,e.pullRequestId||(e.pullRequestId=_.repo+"-PR"+_.pullRequestId+"-"+generateRandomId(4))}catch(B){if(!k(q))return;throw B.data&&(i("ERRORS."+B.data.error).then(v=>{e.addToast({title:"Error",date:new Date,body:v}),e.error=v},console.error),X(B.data.error)),M("sourceUrl","missing",!1),B}finally{C(q)}}let ae=ze(new Map);function Ae(){let _=new Set,q=e.details&&e.details.pullRequest;if(!q)return _;typeof q.title=="string"&&_.add(q.title),typeof q.body=="string"&&_.add(q.body),typeof q.diff=="string"&&_.add(q.diff);let B=q.comments||[];for(let v of B)typeof v.author=="string"&&_.add(v.author),typeof v.body=="string"&&_.add(v.body);return _}let Se=J("pr",()=>{let _=Ae(),q=Array.from(_);return q.length===0?null:{contents:q,options:ee()}},(_,q)=>{if(!Array.isArray(_?.contents)||_.contents.length!==q.contents.length||_.contents.some(E=>typeof E!="string"))throw Error("Invalid preview response");let B=q.contents,v=new Map;for(let E=0;E<B.length&&E<_.contents.length;E++)v.set(B[E],_.contents[E]);ae.clear(),v.forEach((E,O)=>ae.set(O,E))});e.anonymizePrContent=function(_){return _&&(ae.has(_)?ae.get(_):"")};async function Le(){let _=parseGithubUrl(e.sourceUrl),q=m();try{U(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let B=await t.get(`/api/gist/source/${_.gistId}`);if(!k(q))return;e.details=B.data,e.gistId||(e.gistId="gist-"+_.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(B){if(!k(q))return;if(B.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,M("sourceUrl","missing",!1);return}if(B.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,M("sourceUrl","missing",!1);return}throw B.data&&(i("ERRORS."+B.data.error).then(v=>{e.addToast({title:"Error",date:new Date,body:v}),e.error=v},console.error),X(B.data.error)),M("sourceUrl","missing",!1),B}finally{C(q)}}let De=ze(new Map);function qe(){let _=new Set,q=e.details&&e.details.gist;if(!q)return _;typeof q.description=="string"&&_.add(q.description),typeof q.ownerLogin=="string"&&_.add(q.ownerLogin);let B=q.files||[];for(let E of B)typeof E.filename=="string"&&_.add(E.filename),typeof E.content=="string"&&_.add(E.content);let v=q.comments||[];for(let E of v)typeof E.author=="string"&&_.add(E.author),typeof E.body=="string"&&_.add(E.body);return _}let Ie=J("gist",()=>{let _=qe(),q=Array.from(_);return q.length===0?null:{contents:q,options:ee()}},(_,q)=>{if(!Array.isArray(_?.contents)||_.contents.length!==q.contents.length||_.contents.some(E=>typeof E!="string"))throw Error("Invalid preview response");let B=q.contents,v=new Map;for(let E=0;E<B.length&&E<_.contents.length;E++)v.set(B[E],_.contents[E]);De.clear(),v.forEach((E,O)=>De.set(O,E)),Ue()});e.anonymizeGistContent=function(_){return _&&(De.has(_)?De.get(_):"")},e.previewGistFiles=[];function Ue(){let _=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=_.map(q=>({filename:e.anonymizeGistContent(q.filename),content:e.anonymizeGistContent(q.content),language:q.language}))}e.watch("details.gist.files",Ue,!0),e.watch("terms",Ue);function Ee(){let _=e.conference;if(e.conference_data=null,!_)return;let q=e.isUpdate&&_===e._originalConference;t.get("/api/conferences/"+_).then(B=>{e.conference===_&&(e.conference_data=B.data,e.conference_data.startDate=new Date(e.conference_data.startDate),e.conference_data.endDate=new Date(e.conference_data.endDate),!q&&(e.options.expirationDate=new Date(e.conference_data.endDate),e.options.expirationMode="remove",e.options.update=e.conference_data.options.update,e.options.image=e.confe
Line truncated
|
||||
`).filter(O=>O),connection:e.githubConnection,fullName:`${B.owner}/${B.repo}`,repository:e.sourceUrl,reconnectRepositoryId:e.reconnectRepositoryId,options:e.options,source:e.source,conference:e.conference};e.details&&(v.options.pageSource=e.details.pageSource),U();let E=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(E,v,{headers:{"Content-Type":"application/json"}}).then(()=>{S.clear(),window.location.href="/status/"+e.repoId},O=>{O.data&&(i("ERRORS."+O.data.error).then(H=>{e.error=H},console.error),X(O.data.error))}).finally(()=>{q.disabled=!1})},e.anonymizeGist=_=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(oe())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let q=_.currentTarget||_.target.closest?.("button")||_.target;q.disabled=!0;let B=parseGithubUrl(e.sourceUrl),v={gistId:e.gistId,terms:e.terms.trim().split(`
|
||||
`).filter(O=>O),source:{gistId:B.gistId},options:e.options,conference:e.conference};U();let E=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(E,v,{headers:{"Content-Type":"application/json"}}).then(()=>{S.clear(),window.location.href="/gist/"+e.gistId},O=>{O.data&&(i("ERRORS."+O.data.error).then(H=>{e.error=H},console.error),X(O.data.error))}).finally(()=>{q.disabled=!1})},e.anonymizePullRequest=_=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(oe())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let q=_.currentTarget||_.target.closest?.("button")||_.target;q.disabled=!0;let B=parseGithubUrl(e.sourceUrl),v={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
|
||||
`).filter(O=>O),source:{repositoryFullName:`${B.owner}/${B.repo}`,pullRequestId:B.pullRequestId},options:e.options,conference:e.conference};U();let E=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(E,v,{headers:{"Content-Type":"application/json"}}).then(()=>{S.clear(),window.location.href="/pr/"+e.pullRequestId},O=>{O.data&&(i("ERRORS."+O.data.error).then(H=>{e.error=H},console.error),X(O.data.error))}).finally(()=>{q.disabled=!1})},e.watch("conference",()=>{Ee()}),e.watch("terms",()=>{e.detectedType==="repo"&&pe(),e.detectedType==="pr"&&Se(),e.detectedType==="gist"&&Ie()}),e.watch("options.image",()=>{e.detectedType==="repo"&&pe(),e.detectedType==="pr"&&Se(),e.detectedType==="gist"&&Ie()}),e.watch("options.link",()=>{e.detectedType==="repo"&&pe(),e.detectedType==="pr"&&Se(),e.detectedType==="gist"&&Ie()}),e.watch("details",()=>{e.detectedType==="pr"&&Se(),e.detectedType==="gist"&&Ie()},!0)},cr=function(e,t,n,r,s,i){let a=ut();window.Prism?.hooks&&!window.Prism.redactionHook&&(window.Prism.hooks.add("complete",I=>el(I.element)),window.Prism.redactionHook=!0);let u=Zt();e.on("dark-mode",(I,Y)=>{e.aceOption&&(Y?e.aceOption.theme="nord_dark":e.aceOption.theme="chrome")});let f=0,w=!1;e.on("dispose",()=>{w=!0,f++,h&&h.resolve()}),e.files=[],e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent),e.fileSearchQuery="",e.fileSearchResults=null,e.fileSearchLoading=!1,u(document,"keydown",function(I){if((I.metaKey||I.ctrlKey)&&I.key==="k"){I.preventDefault();var Y=document.querySelector(".tree-search-input");Y&&(Y.focus(),Y.select())}});var h=null;e.onFileSearchChange=function(){h&&(h.resolve(),h=null);let I=e.fileSearchQuery;if(!I||I.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let Y=i.defer();h=Y,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(I)}`,{timeout:Y.promise}).then(function(Z){if(!(w||h!==Y)){h=null,e.fileSearchLoading=!1;var ee={};e.files.forEach(function(U){ee[(U.path||"")+"/"+U.name]=!0});for(var J=[],ie={},pe=0;pe<Z.data.length;pe++){var fe=Z.data[pe];if(fe.path)for(var ae=fe.path.split("/"),Ae="",Se=0;Se<ae.length;Se++){var Le=Ae;Ae=Ae?Ae+"/"+ae[Se]:ae[Se];var De=Le+"/"+ae[Se];!ee[De]&&!ie[De]&&(ie[De]=!0,J.push({name:ae[Se],path:Le}))}}J.sort(function(U,oe){return(U.path||"").split("/").length-(oe.path||"").split("/").length}),J.length>0&&e.files.push.apply(e.files,J);for(var qe=[],Ie=0;Ie<Z.data.length;Ie++){var Ue=Z.data[Ie],Ee=(Ue.path||"")+"/"+Ue.name;!ee[Ee]&&Ue.size!=null&&(qe.push(Ue),ee[Ee]=!0)}qe.length>0&&e.files.push.apply(e.files,qe),e.fileSearchResults=Z.data}},function(){!w&&h===Y&&(h=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})};let k={yml:"yaml",txt:"text",py:"python",js:"javascript",ts:"typescript"},m=["license","txt"],C=["png","jpg","jpeg","gif","svg","ico","bmp","tiff","tif","webp","avif","heif","heic"],y=["wav","mp3","ogg","wma","flac","aac","m4a"],g=["mp4","avi","webm","mov","mpg","mpeg","mkv","flv","wmv","3gp","3g2","m4v","f4v","f4p","f4a","f4b"];e.on("routeUpdate",function(I,Y){if(e.repoId!=r.repoId)return N();if((r.path||"")!=e.filePath){e.filePath=r.path||"",e.paths=e.filePath.split("/").filter(Z=>Z&&Z.trim().length>0),te();for(let Z=0;Z<e.paths.length-1;Z++){let ee=Z>0?e.paths.slice(0,Z).join("/"):"";e.files.some(ie=>ie.path===ee)||e.getFiles(ee)}}});function S(){if(e.paths[0]!="")return;let I=["readme.md","readme.txt","readme.org","readme.1st","readme"],Y={};for(let ee of e.files)ee.name.toLowerCase().indexOf("readme")>-1&&(Y[ee.name.toLowerCase()]=ee.name);let Z=null;for(let ee of I)if(Y[ee]){Z=ee;break}if(!Z&&Object.keys(Y).length>0&&(Z=Object.keys(Y)[0]),Z){let ee=n.url();ee[ee.length-1]!="/"&&(ee+="/"),n.url(ee+encodePathForUrl(Y[Z]))}}e.fileCounts=null,e.getFiles=function(I){let Y=e.repoId;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(I)}&v=${e.options.lastUpdateDate}`).then(function(Z){if(w||Y!==e.repoId)return[];let ee=I||"";return e.files=e.files.filter(J=>J.path!==ee),e.files.push(...Z.data),Z.data},function(Z){if(w||Y!==e.repoId)return[];e.type="error",e.content=ur(Z),e.files=[]})};function R(){let I=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts`).then(function(Y){w||I!==e.repoId||(e.fileCounts=Y.data)},function(){e.fileCounts={}})}function T(){return e.files.filter(I=>I.name==e.paths[e.paths.length-1]&&I.path==e.paths.slice(0,e.paths.length-1).join("/"))[0]}var P=null;e.on("dispose",function(){P&&a.interval.cancel(P)});function L(I){if(w)return;let Y=e.repoId;t.get(`/api/repo/${e.repoId}/options`).then(Z=>{if(!(w||Y!==e.repoId)){if(e.options=Z.data,e.options.url){window.location=e.options.url;return}I&&I(Z.data)}},Z=>{if(!(w||Y!==e.repoId)){var ee=Z.data||{};if(ee.error==="rate_limited"&&ee.resetAt){let ie=function(){var pe=Math.max(0,Math.ceil((e.rateLimitResetAt-Date.now())/1e3));if(pe<=0)e.rateLimitCountdown="",e.rateLimitResetAt=0,P&&(a.interval.cancel(P),P=null),L(I);else{var fe=Math.floor(pe/60),ae=pe%60;e.rateLimitCountdown=fe>0?f
Line truncated
|
||||
`+g.join(`
|
||||
`)],{type:"text/csv"}),R=document.createElement("a");R.href=URL.createObjectURL(S),R.download=r.username+"-repositories.csv",R.click()},e.showStatusMessage=m=>{let C=m.statusMessage||"(no message)";window.prompt(`Status message for ${m.repoId} (${m.status}):`,C)},e.fetchGithubInfo=m=>{let C=window.open("","_blank");C&&C.document.write("<pre>Loading GitHub info for "+m.repoId+"...</pre>"),t.get("/api/admin/repos/"+m.repoId+"/github").then(y=>{C&&(C.document.open(),C.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(y.data,null,2).replace(/[<>]/g,g=>g==="<"?"<":">")+"</pre>"),C.document.close())},y=>{let g=y&&y.data?JSON.stringify(y.data,null,2):String(y);C&&(C.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+g+"</pre>")})};function f(m){t.get("/api/admin/users/"+m+"/repos",{}).then(C=>{e.repositories=C.data},C=>{console.error(C)})}function w(m){t.get("/api/admin/users/"+m,{}).then(C=>{e.userInfo=C.data},C=>{console.error(C)})}w(r.username),f(r.username),e.banUser=()=>{confirm(`Ban user ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/ban`).then(()=>w(r.username),m=>console.error(m))},e.activateUser=()=>{t.post(`/api/admin/users/${r.username}/activate`).then(()=>w(r.username),m=>console.error(m))},e.promoteUser=()=>{confirm(`Promote ${r.username} to admin?`)&&t.post(`/api/admin/users/${r.username}/promote`).then(()=>w(r.username),m=>console.error(m))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/demote`).then(()=>w(r.username),m=>console.error(m))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function h(){t.get("/api/admin/tokens").then(m=>{e.tokens=m.data||[]},m=>{m.status!==401&&m.status!==403&&console.error(m)})}h(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(m=>{e.tokenForm.plaintext=m.data.token,e.tokenForm.name="",h()},m=>console.error(m))},e.revokeToken=m=>{confirm(`Revoke token "${m.name}"?`)&&t.delete("/api/admin/tokens/"+m.id).then(()=>h(),C=>console.error(C))},e.removeCache=m=>{confirm("Remove cached files for "+m.repoId+"?")&&t.delete("/api/admin/repos/"+m.repoId).then(()=>f(r.username),C=>console.error(C))},e.removeRepository=m=>{confirm("Remove repository "+m.repoId+"?")&&t.delete("/api/repo/"+m.repoId+"/").then(()=>f(r.username),C=>console.error(C))},e.updateRepository=m=>{let C=ze({title:`Refreshing ${m.repoId}...`,date:new Date,body:`The repository ${m.repoId} is going to be refreshed.`});e.toasts.push(C),t.post(`/api/repo/${m.repoId}/refresh`).then(y=>{y.data.status=="ready"?C.title=`${m.repoId} is refreshed.`:C.title=`Refreshing of ${m.repoId}.`},y=>{C.title=`Error during the refresh of ${m.repoId}.`,C.body=y.body})},e.getGitHubRepositories=m=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(C=>{e.userInfo.repositories=C.data})};let k=null;e.watch("query",()=>{s.timeout.cancel(k),k=s.timeout(()=>{f(r.username)},500)},!0)},bl=function(e,t,n){let r=ut(),s=Zt();e.Math=Math,e.watch("user.status",()=>{e.user==null&&n.url("/")}),e.user==null&&n.url("/"),e.conferences=[],e.total=-1,e.totalPage=0,e.statusCounts=[];let i=y=>{if(y.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){y.preventDefault();let g=document.querySelector('.admin-filter-toolbar input[type="search"]');g&&g.focus()}};s(document,"keydown",i),e.on("dispose",()=>document.removeEventListener("keydown",i)),e.clearFilter=y=>{y==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[y]="",e.query.page=1},e.chips=[];let a=()=>{let y=[];(e.query.dateFrom||e.query.dateTo)&&y.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=y};e.statusCountFor=y=>{let g=(e.statusCounts||[]).find(S=>S._id===y);return g?g.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=y=>{e.query.sort===y?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=y,e.query.direction="desc"),e.query.page=1},e.sortIcon=y=>e.query.sort===y?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"";let u="admin.conferences.filterPrefs",f={page:1,limit:25,sort:"name",direction:"asc",search:"",dateFrom:"",dateTo:"",ready:!1,expired:!1,removed:!1,error:!0,preparing:!0},w=loadFilterPrefs(u)||{};e.query=Object.assign({},f,w,{page:1,search:""});let h=n.search();h.search&&(e.query.search=h.search);let k="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(k)||"[]"),e.savePreset=()=>{let y=window.prompt("Preset name:");if(!y)return;let g=Object.assign({},e.query);delete g.page,e.presets=(e.presets||[]).filter(S=>S.name!==y),e.presets.push({name:y,query:g}),localStorage.setItem(k,JSON.stringify(e.presets))},e.applyPreset=y=>{Object.assign(e.query,y.query,{page:1})},e.deletePreset=y=>{e.presets=(e.presets||[]).filter(g=>g.name!==y.name),localStorage.setItem(k,JS
Line truncated
|
||||
`).map((pe,fe)=>fe===0?pe:ie+pe).join(`
|
||||
`)}else typeof N=="number"||typeof N=="boolean"?J=String(N):J=JSON.stringify(N);se.push(`${Z}${J}${ee}`)}),se.push("}"),se.join(`
|
||||
`)}function w(R){let T=[],P="",L=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,V=0,M;for(;M=L.exec(R);)P+=R.slice(V,M.index),V=L.lastIndex,T.push({key:M[1],op:M[2]||"=",val:M[3]});return P+=R.slice(V),{filters:T,free:P.trim().toLowerCase()}}function h(R,T){for(let P of T.filters){let L=(M,se,te)=>{let N=parseFloat(M),I=parseFloat(se);return te==="="?String(M)===String(se):te==="!="?String(M)!==String(se):te===">="?N>=I:te==="<="?N<=I:te===">"?N>I:te==="<"?N<I:!0},V;if(P.key==="code")V=R.displayMessage;else if(P.key==="module")V=R.module;else if(P.key==="status")V=R._status;else if(P.key==="url")V=R._url;else if(P.key==="repo")V=R._repoId;else if(P.key==="level")V=R.level;else continue;if(V==null||!L(V,P.val,P.op))return!1}return!(T.free&&((R.displayMessage||"")+" "+(R.module||"")+" "+(R._url||"")+" "+JSON.stringify(R.raw||[])).toLowerCase().indexOf(T.free)===-1)}function k(){let R=w(e.query.search||"");e.parsedFilterCount=R.filters.length;let T=e.query.bucket,P=e.entries.filter(V=>T&&V._bucket!==T?!1:h(V,R)),L=e.query.group;if(L){let V=te=>L==="module"?te.module:te.displayMessage||te.message||"_",M=new Map;for(let te of P){let N=V(te);if(M.has(N)){let I=M.get(N);I.count++,I._related.push(te),new Date(te.ts)>new Date(I.ts)&&(I.ts=te.ts,I._url=te._url,I._status=te._status),new Date(te.ts)<new Date(I._firstSeen)&&(I._firstSeen=te.ts)}else{let I=Object.assign({},te);I._key=`${L}:${N}`,I._related=[te],I._firstSeen=te.ts,I._lastHourCount=0,I.count=1,M.set(N,I)}}let se=Date.now()-3600*1e3;for(let te of M.values())te._lastHourCount=te._related.filter(N=>new Date(N.ts).getTime()>=se).length;P=Array.from(M.values())}else P=P.map((V,M)=>(V._key="row:"+M+":"+V.ts,V._related=[V],V._firstSeen=V.ts,V._lastHourCount=0,V.count=1,V));e.query.sort==="count"?P.sort((V,M)=>M.count-V.count||new Date(M.ts)-new Date(V.ts)):P.sort((V,M)=>new Date(M.ts)-new Date(V.ts)),e.visible=P}function m(R){let T=R?e.entries.length:0,P=R?e.pageSize:Math.max(e.pageSize,e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:T,limit:P}}).then(L=>{let V=(L.data.entries||[]).map(u);e.entries=R?e.entries.concat(V):V,e.available=!!L.data.available,e.cap=L.data.max||e.cap,e.total=L.data.total||e.entries.length,k()},L=>console.error(L))}e.loadMore=()=>m(!0),e.canLoadMore=()=>e.entries.length<e.total;function C(){t.get("/api/admin/errors/stats").then(R=>{let T=R.data||{},P=T.prev24h?Math.round((T.last24h-T.prev24h)/T.prev24h*100):0;e.stats={last24h:T.last24h||0,prev24h:T.prev24h||0,delta:P,severity:T.severity||{error:0,warn:0,info:0},unique:T.unique||{error:0,warn:0,info:0},buckets:T.buckets||[],dropped:T.dropped||0}},R=>console.error(R))}function y(){m(),C()}e.barPx=(R,T)=>{let P=e.stats.buckets||[],L=0;for(let te of P)L=Math.max(L,(te.error||0)+(te.warn||0)+(te.info||0));if(!L)return 0;let V=(R.error||0)+(R.warn||0)+(R.info||0);if(!V)return 0;let M=Math.round(V/L*60),se=R[T]||0;return Math.round(se/V*M)},e.bucketTitle=R=>`${new Date(R.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${R.error||0} err \xB7 ${R.warn||0} warn \xB7 ${R.info||0} info`,e.toggle=R=>{e.expanded[R._key]=!e.expanded[R._key]},e.setBucket=R=>{e.query.bucket=R},e.refreshNow=y,e.clearAll=()=>{confirm("Clear all captured errors?")&&t.delete("/api/admin/errors").then(y,R=>console.error(R))},e.exportCsv=()=>{let R=["ts","level","module","displayMessage","_status","_url","_repoId"],T=[R.join(",")];for(let M of e.visible)T.push(R.map(se=>{let te=M[se]==null?"":String(M[se]);return/[",\n]/.test(te)?`"${te.replace(/"/g,'""')}"`:te}).join(","));let P=new Blob([T.join(`
|
||||
`)],{type:"text/csv;charset=utf-8"}),L=URL.createObjectURL(P),V=document.createElement("a");V.href=L,V.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(L)};function g(R){e.copyHint=`${R} copied`,s.timeout(()=>{e.copyHint=""},1500)}e.copyJson=R=>{navigator.clipboard.writeText(R._detailJson).then(()=>g("JSON"))},e.copyCurl=R=>{if(!R._url)return;let P=`curl -X ${R._method||"GET"} '${window.location.origin}${R._url}'`;navigator.clipboard.writeText(P).then(()=>g("curl"))},y();let S=r(()=>{e.query.autoRefresh&&y()},15e3);e.on("dispose",()=>r.cancel(S)),e.watch("query.search",k),e.watch("query.bucket",k),e.watch("query.sort",k),e.watch("query.group",k)},El=function(e,t,n,r){if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&n.url("/")}),e.user==null){n.url("/");return}e.data=null,e.loading=!0,e.error=null,e.performance=null,e.performanceMinutes=15,e.performanceTab="routes",e.performanceError=null,e.formatMs=function(y){return y==null?"":y<1e3?y+" ms":+(y/1e3).toFixed(1)+" s"},e.latencyBound=function(y,g){return y.count?y[g]==null?"> 60 s":"\u2264 "+e.formatMs(y[g]):"No samples"},e.firstByteBound=function(y){return e.latencyBound({count:y.firstByteCount,p95UpperMs:y.firstByteP95UpperMs},"p95UpperMs")},e.sampleAge=function(y){return Math.max(0,Math.round((Date.now()-y.sampledAt)/1e3))},e.peakRss=function(y){return(e.performance.runtimeSeries||[]).filter(function(g){return g.instance===y.instance}).reduce(function(g,S){return Math.max(g,S.rss)},y.memory.rss)},e.performanceWarning=function(y){return e.sampleAge(y)>45||y.droppedBatches||y.droppedMetrics||y.sockets?.closeWait>0||y.eventLoop.p95Ms>100||y.memoryLimitBytes&&y.memory.rss>y.memoryLimitBytes*.8};var s=!1;e.loadPerformance=function(){var y=e.performanceMinutes;e.performance?.windowMinutes&&e.performance.windowMinutes!==y&&(e.performance=null),!s&&(s=!0,t.get("/api/admin/performance",{params:{minutes:y}}).then(function(g){y===e.performanceMinutes&&(e.performance=g.data,e.performanceError=g.data.available?null:"Performance monitoring is unavailable. Request history may be incomplete.")},function(){y===e.performanceMinutes&&(e.performanceError="Could not refresh performance monitoring. Displayed samples may be stale.")}).finally(function(){s=!1,y!==e.performanceMinutes&&e.loadPerformance()}))};function i(y){if(y==null)return"\u2014";for(var g=["B","KB","MB","GB","TB"],S=0,R=y;R>=1024&&S<g.length-1;)R/=1024,S++;return R.toFixed(S>0?1:0)+" "+g[S]}e.humanBytes=i;function a(y){if(!y)return"\u2014";var g=Math.floor(y/86400),S=Math.floor(y%86400/3600),R=Math.floor(y%3600/60);return g>0?g+"d "+(S<10?"0":"")+S+"h":S>0?S+"h "+(R<10?"0":"")+R+"m":R+"m"}e.humanDuration=a;function u(y){return y==null?"\u2014":y>=1e6?(y/1e6).toFixed(1)+"M":y>=1e3?(y/1e3).toFixed(1)+"K":String(y)}e.humanNum=u,e.queueTotal=function(y){return y?(y.waiting||0)+(y.active||0)+(y.delayed||0)+(y.failed||0):0},e.statusCount=function(y){if(!e.data||!e.data.repos)return 0;for(var g=e.data.repos.statusBreakdown||[],S=0;S<g.length;S++)if(g[S]._id===y)return g[S].count;return 0},e.barPct=function(y){var g=e.data&&e.data.repos?e.data.repos.total:0;if(!g)return 0;var S=[y];y==="expired"&&S.push("expiring"),y==="removed"&&S.push("removing"),y==="preparing"&&S.push("download");var R=0;return S.forEach(function(T){R+=e.statusCount(T)}),Math.max(.4,R/g*100)},e.errPct=function(y){if(!e.data||!e.data.errors)return 0;var g=Math.max(e.data.errors.severity.error,e.data.errors.severity.warn,e.data.errors.severity.info,1);return e.data.errors.severity[y]/g*100};function f(y){var g=y||[];return g.map(function(S,R){var T=g[R-1]||{},P=Object.assign({},S);return P.dailyRepositories=R?Math.max(0,(S.nbRepositories||0)-(T.nbRepositories||0)):0,P.dailyUsers=R?Math.max(0,(S.nbUsers||0)-(T.nbUsers||0)):0,P.dailyPageViews=R?Math.max(0,(S.nbPageViews||0)-(T.nbPageViews||0)):0,P})}function w(y){var g=y&&y.length?y[y.length-1]:{};return{repositories:g.dailyRepositories||0,users:g.dailyUsers||0,pageViews:g.dailyPageViews||0}}var h={},k={};e.historyBarH=function(y,g){return!y||!h[g]?0:Math.max(1,Math.round(y[g]/h[g]*140))},e.historyRangeH=function(y,g){if(!y||h[g]==null)return 0;var S=h[g]-k[g];return S?Math.round(8+(y[g]-k[g])/S*132):70},e.historyRange=function(y){return{min:k[y],max:h[y]}},e.historyLabel=function(y){if(!y||!y.date)return"";var g=new Date(y.date);return g.getUTCMonth()+1+"/"+g.getUTCDate()};function m(){e.loadPerformance(),t.get("/api/admin/overview").then(function(y){y.data.history=f(y.data.history),y.data.daily={today:w(y.data.history)},e.data=y.data,e.loading=!1,e.error=null,h={},k={},(y.data.history||[]).forEach(function(g){["dailyPageViews","dailyRepositories","dailyUsers","nbUsers"].forEach(function(S){(!h[S]||g[S]>h[S])&&(h[S]=g[S]),(k[S]==null||g[S]<k[S])&&(k[S]=g[S])})})},function(y){e.loading=!1,e.error=y.data&&y.data.error||"Failed to load overview"})}m();var C=r(m,3e4);e.on("dispose",function(){r.can
Line truncated
|
||||
anonymous_github`)])])])])]),p(" Limitations "),o("h4",{class:"faq-cat"},[o("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[o("use",{href:"#ui-icon-warning"})]),b("Limitations ")]),o("div",{class:"panel-group",id:"faq-limitations",role:"tablist","aria-multiselectable":"true"},[o("div",{class:"panel panel-default mb-3"},[o("div",{class:"panel-heading p-3",role:"tab",id:"headingLimitation"},[o("h3",{class:"panel-title"},[o("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-limitations",href:"#limitation","aria-expanded":"false","aria-controls":"limitation"}," What are the limitations of Anonymous GitHub? ")])]),o("div",{id:"limitation",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingLimitation"},[o("div",{class:"panel-body p-3"},[o("ul",null,[o("li",null," Anonymous GitHub only anonymizes text-based files. Binary files (compiled executables, archives, etc.) are served as-is without anonymization. "),o("li",null," Files larger than 8 MB are not supported. "),o("li",null," Static site generators (such as Jekyll) used with GitHub Pages are not fully supported, although Markdown files are converted to HTML. "),o("li",null," The anonymization of terms within source code may change the behavior of the program (e.g., if a replaced term appears in a string literal or identifier). ")])])])])]),p(" Privacy & Security "),o("h4",{class:"faq-cat"},[o("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[o("use",{href:"#ui-icon-shield"})]),b("Privacy & Security ")]),o("div",{class:"panel-group",id:"faq-privacy",role:"tablist","aria-multiselectable":"true"},[o("div",{class:"panel panel-default mb-3"},[o("div",{class:"panel-heading p-3",role:"tab",id:"headingData"},[o("h3",{class:"panel-title"},[o("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#data","aria-expanded":"false","aria-controls":"data"}," How is my data handled? ")])]),o("div",{id:"data",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingData"},[o("div",{class:"panel-body p-3"},[o("p",null," Data stored on Anonymous GitHub is never shared or used for any purpose beyond providing the anonymization service. When a repository is removed or expires, only its configuration is retained \u2014 this makes it easy to restore the repository if needed and ensures that no future repository reuses the same ID. ")])])]),o("div",{class:"panel panel-default mb-3"},[o("div",{class:"panel-heading p-3",role:"tab",id:"headingPermissions"},[o("h3",{class:"panel-title"},[o("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#permissions","aria-expanded":"false","aria-controls":"permissions"}," Why does GitHub say Anonymous GitHub asks for write access? ")])]),o("div",{id:"permissions",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingPermissions"},[o("div",{class:"panel-body p-3"},[o("p",null,[b("The GitHub App has read-only access to the repositories you choose. You can change repository access on your "),o("a",{href:"/connections"},"GitHub connections"),b(" page.")]),o("p",null,"Legacy GitHub OAuth includes write access to private repositories because GitHub's OAuth scopes do not offer a read-only option for them. Existing OAuth anonymizations and gists can still use this connection."),o("p",null,"Anonymous GitHub reads repository content. It never pushes, modifies, or deletes files on GitHub.")])])]),o("div",{class:"panel panel-default mb-3"},[o("div",{class:"panel-heading p-3",role:"tab",id:"headingViewer"},[o("h3",{class:"panel-title"},[o("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#viewer","aria-expanded":"false","aria-controls":"viewer"}," Can repository owners see who viewed their anonymized repository? ")])]),o("div",{id:"viewer",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingViewer"},[o("div",{class:"panel-body p-3"},[o("p",null," No. Only the total number of views is tracked as an incremental counter. It is not possible for the repository owner or for Anonymous GitHub to identify individual viewers. Reviewer anonymity is fully preserved. ")])])])]),p(" Self-Hosting "),o("h4",{class:"faq-cat"},[o("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[o("use",{href:"#project-icon-storage"})]),b("Self-Hosting ")]),o("div",{class:"panel-group",id:"faq-hosting",role:"tablist","aria-multiselectable":"true"},[o("div",{class:"panel panel-default mb-3"},[o("div",{class:"panel-heading p-3",role:"tab",id:"headingDeploy"},[o("h3",{class:"panel-title"},[o("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-hosting",href:"#deploy","aria-expanded":"false","aria-controls":"deploy"}," Can I deploy my own instance? ")])]),o("div",{id:"deploy",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingDeploy"},[o("div",{class:"panel-body p-3"},[o("p",null,[b(" Yes. Anonymous Git
Line truncated
|
||||
`+JSON.stringify(t):""}`},[Be.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${ep(t)}" via a navigation guard.`},[Be.NAVIGATION_ABORTED]({from:e,to:t}){return`Navigation aborted from "${e.fullPath}" to "${t.fullPath}" via a navigation guard.`},[Be.NAVIGATION_CANCELLED]({from:e,to:t}){return`Navigation cancelled from "${e.fullPath}" to "${t.fullPath}" with a new navigation.`},[Be.NAVIGATION_DUPLICATED]({from:e,to:t}){return`Avoided redundant navigation to current location: "${e.fullPath}".`}};function fo(e,t){return Te(new Error,{type:e,[Oa]:!0},t)}function Ht(e,t){return e instanceof Error&&Oa in e&&(t==null||!!(e.type&t))}var xc=["params","query","hash"];function ep(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let n of xc)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Ia(e){let t={};if(e===""||e==="?")return t;let n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){let s=n[r].replace(ga," "),i=s.indexOf("="),a=Ao(i<0?s:s.slice(0,i)),u=i<0?null:Ao(s.slice(i+1));if(a in t){let m=t[a];wt(m)||(m=t[a]=[m]),m.push(u)}else t[a]=u}return t}function ir(e){let t="";for(let n in e){let r=e[n];if(n=jc(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(wt(r)?r.map(s=>s&&Zs(s)):[r&&Zs(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function Pa(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=wt(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}var Va=Symbol(""),ar=Symbol(""),os=Symbol(""),ns=Symbol(""),ss=Symbol("");function Io(){let e=[];function t(r){return e.push(r),()=>{let s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Qt(e,t,n,r,s,i=a=>a()){let a=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((u,m)=>{let k=h=>{h===!1?m(fo(Be.NAVIGATION_ABORTED,{from:n,to:t})):h instanceof Error?m(h):Zc(h)?m(fo(Be.NAVIGATION_GUARD_REDIRECT,{from:t,to:h})):(a&&r.enterCallbacks[s]===a&&typeof h=="function"&&a.push(h),u())},y=i(()=>e.call(r&&r.instances[s],t,n,k)),E=Promise.resolve(y);e.length<3&&(E=E.then(k)),E.catch(h=>m(h))})}function rs(e,t,n,r,s=i=>i()){let i=[];for(let a of e)for(let u in a.components){let m=a.components[u];if(!(t!=="beforeRouteEnter"&&!a.instances[u]))if(va(m)){let k=(m.__vccOpts||m)[t];k&&i.push(Qt(k,n,r,a,u,s))}else{let k=m();i.push(()=>k.then(y=>{if(!y)throw new Error(`Couldn't resolve component "${u}" at "${a.path}"`);let E=Vc(y)?y.default:y;a.mods[u]=y,a.components[u]=E;let h=(E.__vccOpts||E)[t];return h&&Qt(h,n,r,a,u,s)()}))}}return i}function qa(e,t){let n=[],r=[],s=[],i=Math.max(t.matched.length,e.matched.length);for(let a=0;a<i;a++){let u=t.matched[a];u&&(e.matched.find(k=>po(k,u))?r.push(u):n.push(u));let m=e.matched[a];m&&(t.matched.find(k=>po(k,m))||s.push(m))}return[n,r,s]}var tp=()=>location.protocol+"//"+location.host;function Wa(e,t){let{pathname:n,search:r,hash:s}=t,i=e.indexOf("#");if(i>-1){let a=s.includes(e.slice(i))?e.slice(i).length:1,u=s.slice(a);return u[0]!=="/"&&(u="/"+u),or(u,"")}return or(n,e)+r+s}function op(e,t,n,r){let s=[],i=[],a=null,u=({state:h})=>{let C=Wa(e,location),g=n.value,b=t.value,S=0;if(h){if(n.value=C,t.value=h,a&&a===g){a=null;return}S=b?h.position-b.position:0}else r(C);s.forEach(R=>{R(n.value,g,{delta:S,type:es.pop,direction:S?S>0?ts.forward:ts.back:ts.unknown})})};function m(){a=n.value}function k(h){s.push(h);let C=()=>{let g=s.indexOf(h);g>-1&&s.splice(g,1)};return i.push(C),C}function y(){if(document.visibilityState==="hidden"){let{history:h}=window;if(!h.state)return;h.replaceState(Te({},h.state,{scroll:hn()}),"")}}function E(){for(let h of i)h();i=[],window.removeEventListener("popstate",u),window.removeEventListener("pagehide",y),document.removeEventListener("visibilitychange",y)}return window.addEventListener("popstate",u),window.addEventListener("pagehide",y),document.addEventListener("visibilitychange",y),{pauseListeners:m,listen:k,destroy:E}}function Ma(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?hn():null}}function np(e){let{history:t,location:n}=window,r={value:Wa(e,n)},s={value:t.state};s.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(m,k,y){let E=e.indexOf("#"),h=E>-1?(n.host&&document.querySelector("base")?e:e.slice(E))+m:tp()+e+m;try{t[y?"replaceState":"pushState"](k,"",h),s.value=k}catch(C){console.error(C),n[y?"replace":"assign"](h)}}function a(m,k){i(m,Te({},t.state,Ma(s.value.back,m,s.value.forward,!0),k,{position:s.value.position}),!0),r.value=m}function u(m,k){let y=Te({},s.value,t.state,{forward:m,scroll:hn()});i(y.current,y,!0),i(m,Te({},Ma(r.value,m,null),{position:y.position+1},k),!1),r.value=m}return{location:r,state:s,push:u,replace:a}}function Ka(e){e=Na(e);let t=np(e),n=op(e,t.state,t.location,t.replace);function r(i,a=!0){a||n.pauseListeners(),history.go(i)}let s=Te({locatLine truncated
|
||||
`)),e.options=Object.assign({},e.options,y.options),a.restore()})}u();let m=null;e.saveDefault=k=>{if(k&&k.preventDefault&&k.preventDefault(),e.saving)return;let y=a.checkpoint(),E={terms:e.terms.split(`
|
||||
`).map(h=>h.trim()).filter(h=>h.length>0),options:e.options};e.saving=!0,e.error=null,t.post("/api/user/default",E).then(()=>{a.accept(y),e.saving=!1,e.message=e.unsavedChanges?null:"Saved",m&&r.cancel(m),m=r(()=>{e.message=null},2500)},h=>{e.saving=!1;let C=h&&h.data&&h.data.error,g="Unable to save your defaults. Please try again.";Promise.all([n("ERRORS."+C),n("ERRORS.unknown_error")]).then(([b,S])=>{e.error=C&&b!==S?b:g},()=>{e.error=g})})},e.deleteAccount=()=>{confirm("Delete your account? All your anonymized repositories, gists, and pull requests will be removed, and your personal data will be erased. This cannot be undone.")&&(e.deletingAccount=!0,t.delete("/api/user").then(()=>{window.location.href="/"},()=>{e.deletingAccount=!1,e.deleteError="Unable to delete the account. Please try again."}))}},il=function(e,t,n){e.repoId=null,e.repoUrl=null,e.claim=()=>{t.post("/api/repo/claim",{repoId:e.repoId,repoUrl:e.repoUrl}).then(r=>{n.url("/dashboard")},r=>{e.error=r.data,e.claimForm.repoUrl.setValidity("not_found",!1),e.claimForm.repoId.setValidity("not_found",!1)})}},al=function(e,t,n,r,s){e.user&&!e.user.status&&n.url("/dashboard"),e.watch("user.status",()=>{e.user&&!e.user.status&&n.url("/dashboard")}),e.features=[{key:"anonymize",num:"01",eyebrow:"Anonymize",title:"Double-anonymous,",accent:"your rules.",text:"Choose what reviewers may see: links, images, PDFs, notebooks, GitHub Pages. Add your own terms, with regex if you need it, and pick the expiration date.",cta:"Start an anonymization",href:"/anonymize",url:"anonymous.4open.science/anonymize",img:"/imgs/anonymize.png",alt:"The anonymize form: source repository, terms to redact, options and a live README preview"},{key:"review",num:"02",eyebrow:"Review",title:"Reviewers browse",accent:"the real thing.",text:"Highlighted source code, rendered PDFs, images, and notebooks, in a familiar file explorer. GitHub Pages is also supported.",cta:"Open the example",href:"https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/",target:"_self",url:"anonymous.4open.science/r/840c8c57-\u2026",img:"/imgs/explorer.png",alt:"The repository explorer with a file tree and a rendered README"},{key:"manage",num:"03",eyebrow:"Manage",title:"One dashboard,",accent:"until the decision.",text:"Monitor views, edit configuration, remove or update your repository. Program chairs can group submissions under a conference with one shared expiry.",cta:"Open the dashboard",href:"/dashboard",needsUser:!0,url:"anonymous.4open.science/dashboard",img:"/imgs/dashboard.png",alt:"The dashboard listing anonymized repositories with status, views and expiry"}],e.feature=e.features[0].key,e.selectFeature=function(u){e.feature=u},e.featureHref=function(u){return u.needsUser&&!e.user?"/signin":u.href},e.featureTarget=function(u){return u.needsUser&&!e.user?"_self":u.target||void 0},e.featureKeydown=function(u,m){let k={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:"first",End:"last"}[u.key];if(k===void 0)return;u.preventDefault();let y=e.features.length,E=k==="first"?0:k==="last"?y-1:(m+k+y)%y;e.feature=e.features[E].key,s(()=>{let h=r.document.getElementById("feature-tab-"+e.feature);h&&h.focus()})},e.cards=[{key:"repositories",total:0,label:"repositories anonymized"},{key:"users",total:0,label:"researchers"},{key:"pageViews",total:0,label:"page views"},{key:"pullRequests",total:0,label:"pull requests"}];function i(){t.get("/api/stat/").then(u=>{e.stat=u.data,e.cards[0].total=u.data.nbRepositories,e.cards[1].total=u.data.nbUsers,e.cards[2].total=u.data.nbPageViews,e.cards[3].total=u.data.nbPullRequests})}i();function a(u){let m={series:u,bars:[],viewW:100,deltaToday:0,pctChange:0,pctAbs:0,isUp:!0};if(!u||u.length<2)return m;let k=new Array(u.length-1);for(let b=1;b<u.length;b++)k[b-1]=u[b]-u[b-1];let y=k.length,E=Math.max.apply(null,k),h=Math.min.apply(null,k),C=Math.min(0,h),g=E-C||1;m.viewW=y*2,m.bars=new Array(y);for(let b=0;b<y;b++){let S=(k[b]-C)/g,R=Math.max(1.5,S*34);m.bars[b]={x:(b*2+.25).toFixed(2),y:(36-R).toFixed(2),w:"1.5",h:R.toFixed(2)}}if(m.deltaToday=k[y-1],y>=2){let b=k[y-2];b&&(m.pctChange=(m.deltaToday-b)/b*100)}return m.pctAbs=Math.round(Math.abs(m.pctChange)),m.isUp=m.pctChange>=0,m}e.history={repositories:a([]),users:a([]),pageViews:a([]),pullRequests:a([])},t.get("/api/stat/history?days=60").then(u=>{let m=u.data||[];e.history={repositories:a(m.map(k=>k.nbRepositories||0)),users:a(m.map(k=>k.nbUsers||0)),pageViews:a(m.map(k=>k.nbPageViews||0)),pullRequests:a(m.map(k=>k.nbPullRequests||0))}})},ll=function(e,t,n,r,s,i){let a=ut();e.on("routeLeave",function(){$('[data-toggle="tooltip"]').tooltip("dispose")}),e.watch("user.status",()=>{e.user==null&&n.url("/")}),e.user==null&&n.url("/"),a.timeout(()=>{$('[data-toggle="tooltip"]').tooltip()},250),e.quotaExpanded=!1,e.closeQuota=()=>{e.quotaExpanded=!1,ot(()=>document.querySelector(".dashboard-quota > summary")?.focus())},Zt()(document,"click",_=>{e.quotaExpanded&&!_.target.closest?.(".dashboard-quota")&
Line truncated
|
||||
`)),e.options=Object.assign({},e.options,D.options),e.options.expirationDate=D.options&&D.options.expirationDate?new Date(D.options.expirationDate):T(),!r.repoId&&!r.pullRequestId&&!r.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),p&&p()})}function _(p,v,D){e.anonymize&&e.anonymize[p]&&e.anonymize[p].setValidity(v,D)}function P(p){try{let v=parseGithubUrl(p);if(v&&v.owner&&v.repo)return v.owner+"/"+v.repo}catch{}return null}e.accessRepairAllowed=!1,e.repairingGitHubAccess=!1,e.accessRepairMessage="",e.repairGitHubAccess=async()=>{if(!e.accessRepairAllowed||e.repairingGitHubAccess||!e.githubConnections?.appEnabled||!r.repoId||e.role!=="owner"||e.githubConnection!=="github-app"||P(e.sourceUrl)!==e._originalFullName)return;e.repairingGitHubAccess=!0,e.accessRepairMessage="";let p=h();try{let v=await t.get("/github/connections");if(e.githubConnections=v.data,!v.data.appEnabled)return;let D=await t.post("/github/connections/migrate",{type:"repository",id:r.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":v.data.csrf}});if(!E(p))return;e.error=null,D.data.fullName&&(e._originalFullName=D.data.fullName,e.source.fullName=D.data.fullName,e.sourceUrl="https://github.com/"+D.data.fullName),e.accessRepairMessage="GitHub access repaired. Your anonymous URL and published commit are unchanged.",await e.urlSelected(!0)}catch{E(p)&&(e.accessRepairMessage="Unable to repair GitHub access. Check the App's repository permissions in Manage access, then retry. Your published snapshot has not been replaced.")}finally{e.repairingGitHubAccess=!1,C(p)}},e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,e.reconnectSource=async()=>{if(confirm("Reconnect to the repository currently at this GitHub URL? Review its branch and commit before saving. Saving will replace the published snapshot.")){e.reconnectingSource=!0,e.reconnectRepositoryId=void 0,e.source.commit="",e.source.branch="",e.readme="",e.branches=[];try{await W()}catch{}}};function G(){return e.reconnectingSource||!e.isUpdate||!e._originalRepositoryID?void 0:P(e.sourceUrl)===e._originalFullName?e._originalRepositoryID:void 0}async function J(){e._preservingDraft=!0;try{await e.urlSelected(!0)}finally{e._preservingDraft=!1}}async function X(){let p;try{p=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!p||p.path!==s.path()||Date.now()-p.savedAt>=30*6e4)return S.restore()?(e.sourceUrl&&await J(),!0):!1;S.restore();for(let v of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(p.draft,v)&&(e[v]=p.draft[v]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await J(),sessionStorage.removeItem("github-access-draft"),!0}ee(()=>{!r.repoId&&!r.pullRequestId&&!r.gistId&&a(X,0),r.repoId&&r.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=r.repoId,t.get("/api/repo/"+e.repoId).then(async p=>{e.accessRepairAllowed=!["removed","archived","preparing","queue","download","removing","expiring"].includes(p.data.status),e.githubConnection=p.data.connection||"oauth",e.sourceUrl="https://github.com/"+p.data.source.fullName,e._originalFullName=p.data.source.fullName,e.terms=p.data.options.terms.filter(v=>v).join(`
|
||||
`),e.source=p.data.source,e.role=p.data.role||"owner",e.coauthors=p.data.coauthors||[],e._originalBranch=p.data.source.branch,e.options=Object.assign({},e.options,p.data.options),e.conference=p.data.conference,e._originalConference=p.data.conference,e.repositoryID=p.data.source.repositoryID,e._originalRepositoryID=p.data.source.repositoryID,p.data.options.expirationDate&&(e.options.expirationDate=new Date(p.data.options.expirationDate)),g=b(parseGithubUrl(e.sourceUrl)),!await X()&&(await Promise.all([W(),se()]),_e())},()=>{s.url("/404")})),r.pullRequestId&&r.pullRequestId!=""&&(e.isUpdate=!0,e.detectedType="pr",e.pullRequestId=r.pullRequestId,t.get("/api/pr/"+e.pullRequestId).then(async p=>{if(e.githubConnection=p.data.connection||"oauth",e.sourceUrl="https://github.com/"+p.data.source.repositoryFullName+"/pull/"+p.data.source.pullRequestId,e.terms=p.data.options.terms.filter(v=>v).join(`
|
||||
`),e.source=p.data.source,e.options=Object.assign({},e.options,p.data.options),e.conference=p.data.conference,e._originalConference=p.data.conference,p.data.options.expirationDate&&(e.options.expirationDate=new Date(p.data.options.expirationDate)),g=b(parseGithubUrl(e.sourceUrl)),!await X())try{await qe()}catch{}},()=>{s.url("/404")})),r.gistId&&r.gistId!=""&&(e.isUpdate=!0,e.detectedType="gist",e.gistId=r.gistId,t.get("/api/gist/"+e.gistId).then(async p=>{e.sourceUrl="https://gist.github.com/"+p.data.source.gistId,e.terms=p.data.options.terms.filter(v=>v).join(`
|
||||
`),e.source=p.data.source,e.options=Object.assign({},e.options,p.data.options),e.conference=p.data.conference,e._originalConference=p.data.conference,p.data.options.expirationDate&&(e.options.expirationDate=new Date(p.data.options.expirationDate)),g=b(parseGithubUrl(e.sourceUrl)),!await X()&&await ze()},()=>{s.url("/404")}))}),t.get("/github/connections").then(p=>{e.githubConnections=p.data,!r.repoId&&!r.pullRequestId&&!r.gistId&&e.githubConnection===void 0&&p.data.appEnabled&&p.data.appConnected&&(e.githubConnection="github-app",e.sourceUrl&&e.workspaceOpen&&J())}).catch(()=>{}),e.urlSelected=async(p=!1)=>{let v=++m;e.previousConfigurations=[],e.previousConfigurationId="";let D;try{D=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,re.cancel(),Se.cancel(),F.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",_("sourceUrl","github",!1);return}let O=b(D),I=p||g===O;g=O,e.sourceUrlError="",_("sourceUrl","github",!0);let U=document.activeElement?.id==="sourceUrl-landing";e.workspaceOpen=!0,U&&a(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!I&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],I||(e.source={type:"GitHubStream",branch:"",commit:""}),re.cancel(),Se.cancel(),F.cancel(),Me.clear(),Ue.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",e.html_readme="",e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=I;try{D.gistId&&!D.repo?(e.detectedType="gist",e.source={gistId:D.gistId},await ze()):D.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:D.owner+"/"+D.repo,pullRequestId:D.pullRequestId},await qe()):(e.detectedType="repo",ne(),await Promise.all([W(),se()]),_e())}catch{}finally{v===m&&(e._preservingDraft=!1)}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let p=e.branches.filter(D=>D.name==e.source.branch)[0];if(!p)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=p.commit),e.readme=p.readme,await se(),_e()}),e.getBranches=async p=>{let v=parseGithubUrl(e.sourceUrl),D=h();try{let O=await t.get(`/api/repo/${v.owner}/${v.repo}/branches`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&P(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:p===!0||e.reconnectingSource?"1":"0",repositoryID:G()}});if(!E(D))return;e.branches=O.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let I=e.branches.filter(U=>U.name==e.source.branch);I.length>0&&(!(!e.reconnectingSource&&!p&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=I[0].commit),e.readme=I[0].readme,await se(p))}catch(O){if(!E(D))return;e.branches=[],e.sourceUnreachable=O&&(O.status===404||O.data&&O.data.error==="repo_not_found");let I=O&&O.data&&O.data.error||(O&&O.status===404?"repo_not_found":"unknown_error");i("ERRORS."+I).then(U=>{e.toasts=e.toasts||[],e.addToast({title:"Error",date:new Date,body:U}),e.error=U},console.error),typeof _=="function"&&_("sourceUrl","missing",!1)}finally{C(D)}};async function W(){let p=parseGithubUrl(e.sourceUrl),v=h();try{te();let D=await t.get(`/api/repo/${p.owner}/${p.repo}/`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&P(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,repositoryID:G(),force:"1"}});if(!E(v))return;e.details=D.data,e.reconnectingSource&&(e.reconnectRepositoryId=e.details.externalId),e.details&&e.details.id&&(e.repositoryID=e.details.id),e.repoId||(e.repoId=e.details.repo+"-"+generateRandomId(4)),await e.getBranches(e.reconnectingSource)}catch(D){if(!E(v))return;throw D.data&&(i("ERRORS."+D.data.error).then(O=>{e.addToast({title:"Error",date:new Date,body:O}),e.error=O},console.error),Ee(D.data.error)),_("sourceUrl","missing",!1),D}finally{C(v)}}async function se(p){if(e.readme&&!p)return e.readme;let v=parseGithubUrl(e.sourceUrl),D=h();try{let O=await t.get(`/api/repo/${v.owner}/${v.repo}/readme`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&P(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:p===!0?"1":"0",branch:e.source.branch,repositoryID:G()}});E(D,!0)&&(e.readme=O.data)}catch{E(D,!0)&&(e.readme="")}finally{C(D)}}function ce(){let p={terms:e.terms?e.terms.split(`
|
||||
`):[],image:!!e.options.image,link:!!e.options.link,repoId:e.repoId};e.source&&e.source.branch&&(p.branchName=e.source.branch);try{let v=parseGithubUrl(e.sourceUrl);p.repoName=`${v.owner}/${v.repo}`}catch{}return p}function de(p,v,D){let O=null,I=0,U=()=>{if(e.detectedType!==p)return;O&&a.cancel(O);let L=++I;e.previewStatus="loading",O=a(()=>{O=null;let H=v();if(!H){e.previewStatus="idle";return}t.post("/api/anonymize-preview",H).then(Y=>{L===I&&(D(Y.data,H),e.previewStatus="ready")}).catch(()=>{L===I&&(e.previewStatus="error")})},200)};return U.cancel=()=>{I++,O&&a.cancel(O),O=null},e.on("dispose",U.cancel),U}e.retryPreview=()=>{e.detectedType==="repo"&&re(),e.detectedType==="pr"&&Se(),e.detectedType==="gist"&&F()};let re=de("repo",()=>e.readme?{content:e.readme,options:ce()}:null,p=>{if(typeof p?.content!="string")throw Error("Invalid preview response");e.anonymize_readme=p.content;let v="";try{let O=parseGithubUrl(e.sourceUrl),I=e.source.branch||e.details&&e.details.defaultBranch||"main";v=`https://github.com/${O.owner}/${O.repo}/raw/${I}/`}catch{}let D=renderMD(e.anonymize_readme,v);e.html_readme=D,a(Prism.highlightAll,150)});function _e(){!e.anonymize||!e.anonymize.terms||(e.termsRegexWarning=!!e.terms&&!!e.terms.match(/[-[\]{}()*+?.,\\^$|#]/g),re())}async function qe(){let p=parseGithubUrl(e.sourceUrl),v=h();try{te();let D=await t.get(`/api/pr/${p.owner}/${p.repo}/${p.pullRequestId}`,{params:{connection:e.githubConnection}});if(!E(v))return;e.details=D.data,e.pullRequestId||(e.pullRequestId=p.repo+"-PR"+p.pullRequestId+"-"+generateRandomId(4))}catch(D){if(!E(v))return;throw D.data&&(i("ERRORS."+D.data.error).then(O=>{e.addToast({title:"Error",date:new Date,body:O}),e.error=O},console.error),Ee(D.data.error)),_("sourceUrl","missing",!1),D}finally{C(v)}}let Me=Fe(new Map);function Pe(){let p=new Set,v=e.details&&e.details.pullRequest;if(!v)return p;typeof v.title=="string"&&p.add(v.title),typeof v.body=="string"&&p.add(v.body),typeof v.diff=="string"&&p.add(v.diff);let D=v.comments||[];for(let O of D)typeof O.author=="string"&&p.add(O.author),typeof O.body=="string"&&p.add(O.body);return p}let Se=de("pr",()=>{let p=Pe(),v=Array.from(p);return v.length===0?null:{contents:v,options:ce()}},(p,v)=>{if(!Array.isArray(p?.contents)||p.contents.length!==v.contents.length||p.contents.some(I=>typeof I!="string"))throw Error("Invalid preview response");let D=v.contents,O=new Map;for(let I=0;I<D.length&&I<p.contents.length;I++)O.set(D[I],p.contents[I]);Me.clear(),O.forEach((I,U)=>Me.set(U,I))});e.anonymizePrContent=function(p){return p&&(Me.has(p)?Me.get(p):"")};async function ze(){let p=parseGithubUrl(e.sourceUrl),v=h();try{te(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let D=await t.get(`/api/gist/source/${p.gistId}`);if(!E(v))return;e.details=D.data,e.gistId||(e.gistId="gist-"+p.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(D){if(!E(v))return;if(D.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,_("sourceUrl","missing",!1);return}if(D.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,_("sourceUrl","missing",!1);return}throw D.data&&(i("ERRORS."+D.data.error).then(O=>{e.addToast({title:"Error",date:new Date,body:O}),e.error=O},console.error),Ee(D.data.error)),_("sourceUrl","missing",!1),D}finally{C(v)}}let Ue=Fe(new Map);function ke(){let p=new Set,v=e.details&&e.details.gist;if(!v)return p;typeof v.description=="string"&&p.add(v.description),typeof v.ownerLogin=="string"&&p.add(v.ownerLogin);let D=v.files||[];for(let I of D)typeof I.filename=="string"&&p.add(I.filename),typeof I.content=="string"&&p.add(I.content);let O=v.comments||[];for(let I of O)typeof I.author=="string"&&p.add(I.author),typeof I.body=="string"&&p.add(I.body);return p}let F=de("gist",()=>{let p=ke(),v=Array.from(p);return v.length===0?null:{contents:v,options:ce()}},(p,v)=>{if(!Array.isArray(p?.contents)||p.contents.length!==v.contents.length||p.contents.some(I=>typeof I!="string"))throw Error("Invalid preview response");let D=v.contents,O=new Map;for(let I=0;I<D.length&&I<p.contents.length;I++)O.set(D[I],p.contents[I]);Ue.clear(),O.forEach((I,U)=>Ue.set(U,I)),Z()});e.anonymizeGistContent=function(p){return p&&(Ue.has(p)?Ue.get(p):"")},e.previewGistFiles=[];function Z(){let p=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=p.map(v=>({filename:e.anonymizeGistContent(v.filename),content:e.anonymizeGistContent(v.content),language:v.language}))}e.watch("details.gist.files",Z,!0),e.watch("terms",Z);function Q(){let p=e.conference;if(e.conference_data=null,!p)return;let v=e.isUpdate&&p===e._originalConference;t.get("/api/conferences/"+p).then(D=>{e.conference===p&&(e.conference_data=D.data,e.conference_data.startDate=new Date(e.conference_data.startDate),e.conference_data.endDate=new Date(e.conference_data.endDate),!v&&(e.options.expirationDate=new Date(e.conference_data.endDate),e.options.expirationMode="remove",e.options.update=e.conference_data.options.update,e.options.image=e.conf
Line truncated
|
||||
`).filter(U=>U),connection:e.githubConnection,fullName:`${D.owner}/${D.repo}`,repository:e.sourceUrl,reconnectRepositoryId:e.reconnectRepositoryId,options:e.options,source:e.source,conference:e.conference};e.details&&(O.options.pageSource=e.details.pageSource),te();let I=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(I,O,{headers:{"Content-Type":"application/json"}}).then(()=>{S.clear(),window.location.href="/status/"+e.repoId},U=>{U.data&&(i("ERRORS."+U.data.error).then(L=>{e.error=L},console.error),Ee(U.data.error))}).finally(()=>{v.disabled=!1})},e.anonymizeGist=p=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(ye())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let v=p.currentTarget||p.target.closest?.("button")||p.target;v.disabled=!0;let D=parseGithubUrl(e.sourceUrl),O={gistId:e.gistId,terms:e.terms.trim().split(`
|
||||
`).filter(U=>U),source:{gistId:D.gistId},options:e.options,conference:e.conference};te();let I=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(I,O,{headers:{"Content-Type":"application/json"}}).then(()=>{S.clear(),window.location.href="/gist/"+e.gistId},U=>{U.data&&(i("ERRORS."+U.data.error).then(L=>{e.error=L},console.error),Ee(U.data.error))}).finally(()=>{v.disabled=!1})},e.anonymizePullRequest=p=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(ye())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let v=p.currentTarget||p.target.closest?.("button")||p.target;v.disabled=!0;let D=parseGithubUrl(e.sourceUrl),O={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
|
||||
`).filter(U=>U),source:{repositoryFullName:`${D.owner}/${D.repo}`,pullRequestId:D.pullRequestId},options:e.options,conference:e.conference};te();let I=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(I,O,{headers:{"Content-Type":"application/json"}}).then(()=>{S.clear(),window.location.href="/pr/"+e.pullRequestId},U=>{U.data&&(i("ERRORS."+U.data.error).then(L=>{e.error=L},console.error),Ee(U.data.error))}).finally(()=>{v.disabled=!1})},e.watch("conference",()=>{Q()}),e.watch("terms",()=>{e.detectedType==="repo"&&_e(),e.detectedType==="pr"&&Se(),e.detectedType==="gist"&&F()}),e.watch("options.image",()=>{e.detectedType==="repo"&&_e(),e.detectedType==="pr"&&Se(),e.detectedType==="gist"&&F()}),e.watch("options.link",()=>{e.detectedType==="repo"&&_e(),e.detectedType==="pr"&&Se(),e.detectedType==="gist"&&F()}),e.watch("details",()=>{e.detectedType==="pr"&&Se(),e.detectedType==="gist"&&F()},!0)},pr=function(e,t,n,r,s,i){let a=ut();window.Prism?.hooks&&!window.Prism.redactionHook&&(window.Prism.hooks.add("complete",P=>el(P.element)),window.Prism.redactionHook=!0);let u=Zt();e.on("dark-mode",(P,G)=>{e.aceOption&&(G?e.aceOption.theme="nord_dark":e.aceOption.theme="chrome")});let m=0,k=!1;e.on("dispose",()=>{k=!0,m++,y&&y.resolve()}),e.files=[],e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent),e.fileSearchQuery="",e.fileSearchResults=null,e.fileSearchLoading=!1,u(document,"keydown",function(P){if((P.metaKey||P.ctrlKey)&&P.key==="k"){P.preventDefault();var G=document.querySelector(".tree-search-input");G&&(G.focus(),G.select())}});var y=null;e.onFileSearchChange=function(){y&&(y.resolve(),y=null);let P=e.fileSearchQuery;if(!P||P.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let G=i.defer();y=G,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(P)}`,{timeout:G.promise}).then(function(J){if(!(k||y!==G)){y=null,e.fileSearchLoading=!1;var X={};e.files.forEach(function(F){X[(F.path||"")+"/"+F.name]=!0});for(var W=[],se={},ce=0;ce<J.data.length;ce++){var de=J.data[ce];if(de.path)for(var re=de.path.split("/"),_e="",qe=0;qe<re.length;qe++){var Me=_e;_e=_e?_e+"/"+re[qe]:re[qe];var Pe=Me+"/"+re[qe];!X[Pe]&&!se[Pe]&&(se[Pe]=!0,W.push({name:re[qe],path:Me}))}}W.sort(function(F,Z){return(F.path||"").split("/").length-(Z.path||"").split("/").length}),W.length>0&&e.files.push.apply(e.files,W);for(var Se=[],ze=0;ze<J.data.length;ze++){var Ue=J.data[ze],ke=(Ue.path||"")+"/"+Ue.name;!X[ke]&&Ue.size!=null&&(Se.push(Ue),X[ke]=!0)}Se.length>0&&e.files.push.apply(e.files,Se),e.fileSearchResults=J.data}},function(){!k&&y===G&&(y=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})};let E={yml:"yaml",txt:"text",py:"python",js:"javascript",ts:"typescript"},h=["license","txt"],C=["png","jpg","jpeg","gif","svg","ico","bmp","tiff","tif","webp","avif","heif","heic"],g=["wav","mp3","ogg","wma","flac","aac","m4a"],b=["mp4","avi","webm","mov","mpg","mpeg","mkv","flv","wmv","3gp","3g2","m4v","f4v","f4p","f4a","f4b"];e.on("routeUpdate",function(P,G){if(e.repoId!=r.repoId)return _();if((r.path||"")!=e.filePath){e.filePath=r.path||"",e.paths=e.filePath.split("/").filter(J=>J&&J.trim().length>0),ee();for(let J=0;J<e.paths.length-1;J++){let X=J>0?e.paths.slice(0,J).join("/"):"";e.files.some(se=>se.path===X)||e.getFiles(X)}}});function S(){if(e.paths[0]!="")return;let P=["readme.md","readme.txt","readme.org","readme.1st","readme"],G={};for(let X of e.files)X.name.toLowerCase().indexOf("readme")>-1&&(G[X.name.toLowerCase()]=X.name);let J=null;for(let X of P)if(G[X]){J=X;break}if(!J&&Object.keys(G).length>0&&(J=Object.keys(G)[0]),J){let X=n.url();X[X.length-1]!="/"&&(X+="/"),n.url(X+encodePathForUrl(G[J]))}}e.fileCounts=null,e.getFiles=function(P){let G=e.repoId;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(P)}&v=${e.options.lastUpdateDate}`).then(function(J){if(k||G!==e.repoId)return[];let X=P||"";return e.files=e.files.filter(W=>W.path!==X),e.files.push(...J.data),J.data},function(J){if(k||G!==e.repoId)return[];e.type="error",e.content=cr(J),e.files=[]})};function R(){let P=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts`).then(function(G){k||P!==e.repoId||(e.fileCounts=G.data)},function(){e.fileCounts={}})}function T(){return e.files.filter(P=>P.name==e.paths[e.paths.length-1]&&P.path==e.paths.slice(0,e.paths.length-1).join("/"))[0]}var q=null;e.on("dispose",function(){q&&a.interval.cancel(q)});function M(P){if(k)return;let G=e.repoId;t.get(`/api/repo/${e.repoId}/options`).then(J=>{if(!(k||G!==e.repoId)){if(e.options=J.data,e.options.url){window.location=e.options.url;return}P&&P(J.data)}},J=>{if(!(k||G!==e.repoId)){var X=J.data||{};if(X.error==="rate_limited"&&X.resetAt){let se=function(){var ce=Math.max(0,Math.ceil((e.rateLimitResetAt-Date.now())/1e3));if(ce<=0)e.rateLimitCountdown="",e.rateLimitResetAt=0,q&&(a.interval.cancel(q),q=null),M(P);else{var de=Math.floor(ce/60),re=ce%60;e.rateLimitCountdown=de>0?de+"m "+re+"s":re+"s"}};var W=s
Line truncated
|
||||
`+b.join(`
|
||||
`)],{type:"text/csv"}),R=document.createElement("a");R.href=URL.createObjectURL(S),R.download=r.username+"-repositories.csv",R.click()},e.showStatusMessage=h=>{let C=h.statusMessage||"(no message)";window.prompt(`Status message for ${h.repoId} (${h.status}):`,C)},e.fetchGithubInfo=h=>{let C=window.open("","_blank");C&&C.document.write("<pre>Loading GitHub info for "+h.repoId+"...</pre>"),t.get("/api/admin/repos/"+h.repoId+"/github").then(g=>{C&&(C.document.open(),C.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(g.data,null,2).replace(/[<>]/g,b=>b==="<"?"<":">")+"</pre>"),C.document.close())},g=>{let b=g&&g.data?JSON.stringify(g.data,null,2):String(g);C&&(C.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+b+"</pre>")})};function m(h){t.get("/api/admin/users/"+h+"/repos",{}).then(C=>{e.repositories=C.data},C=>{console.error(C)})}function k(h){t.get("/api/admin/users/"+h,{}).then(C=>{e.userInfo=C.data},C=>{console.error(C)})}k(r.username),m(r.username),e.banUser=()=>{confirm(`Ban user ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/ban`).then(()=>k(r.username),h=>console.error(h))},e.activateUser=()=>{t.post(`/api/admin/users/${r.username}/activate`).then(()=>k(r.username),h=>console.error(h))},e.promoteUser=()=>{confirm(`Promote ${r.username} to admin?`)&&t.post(`/api/admin/users/${r.username}/promote`).then(()=>k(r.username),h=>console.error(h))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/demote`).then(()=>k(r.username),h=>console.error(h))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function y(){t.get("/api/admin/tokens").then(h=>{e.tokens=h.data||[]},h=>{h.status!==401&&h.status!==403&&console.error(h)})}y(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(h=>{e.tokenForm.plaintext=h.data.token,e.tokenForm.name="",y()},h=>console.error(h))},e.revokeToken=h=>{confirm(`Revoke token "${h.name}"?`)&&t.delete("/api/admin/tokens/"+h.id).then(()=>y(),C=>console.error(C))},e.removeCache=h=>{confirm("Remove cached files for "+h.repoId+"?")&&t.delete("/api/admin/repos/"+h.repoId).then(()=>m(r.username),C=>console.error(C))},e.removeRepository=h=>{confirm("Remove repository "+h.repoId+"?")&&t.delete("/api/repo/"+h.repoId+"/").then(()=>m(r.username),C=>console.error(C))},e.updateRepository=h=>{let C=Fe({title:`Refreshing ${h.repoId}...`,date:new Date,body:`The repository ${h.repoId} is going to be refreshed.`});e.toasts.push(C),t.post(`/api/repo/${h.repoId}/refresh`).then(g=>{g.data.status=="ready"?C.title=`${h.repoId} is refreshed.`:C.title=`Refreshing of ${h.repoId}.`},g=>{C.title=`Error during the refresh of ${h.repoId}.`,C.body=g.body})},e.getGitHubRepositories=h=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(C=>{e.userInfo.repositories=C.data})};let E=null;e.watch("query",()=>{s.timeout.cancel(E),E=s.timeout(()=>{m(r.username)},500)},!0)},bl=function(e,t,n){let r=ut(),s=Zt();e.Math=Math,e.watch("user.status",()=>{e.user==null&&n.url("/")}),e.user==null&&n.url("/"),e.conferences=[],e.total=-1,e.totalPage=0,e.statusCounts=[];let i=g=>{if(g.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){g.preventDefault();let b=document.querySelector('.admin-filter-toolbar input[type="search"]');b&&b.focus()}};s(document,"keydown",i),e.on("dispose",()=>document.removeEventListener("keydown",i)),e.clearFilter=g=>{g==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[g]="",e.query.page=1},e.chips=[];let a=()=>{let g=[];(e.query.dateFrom||e.query.dateTo)&&g.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=g};e.statusCountFor=g=>{let b=(e.statusCounts||[]).find(S=>S._id===g);return b?b.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=g=>{e.query.sort===g?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=g,e.query.direction="desc"),e.query.page=1},e.sortIcon=g=>e.query.sort===g?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"";let u="admin.conferences.filterPrefs",m={page:1,limit:25,sort:"name",direction:"asc",search:"",dateFrom:"",dateTo:"",ready:!1,expired:!1,removed:!1,error:!0,preparing:!0},k=loadFilterPrefs(u)||{};e.query=Object.assign({},m,k,{page:1,search:""});let y=n.search();y.search&&(e.query.search=y.search);let E="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(E)||"[]"),e.savePreset=()=>{let g=window.prompt("Preset name:");if(!g)return;let b=Object.assign({},e.query);delete b.page,e.presets=(e.presets||[]).filter(S=>S.name!==g),e.presets.push({name:g,query:b}),localStorage.setItem(E,JSON.stringify(e.presets))},e.applyPreset=g=>{Object.assign(e.query,g.query,{page:1})},e.deletePreset=g=>{e.presets=(e.presets||[]).filter(b=>b.name!==g.name),localStorage.setItem(E,JS
Line truncated
|
||||
`).map((ce,de)=>de===0?ce:se+ce).join(`
|
||||
`)}else typeof _=="number"||typeof _=="boolean"?W=String(_):W=JSON.stringify(_);ne.push(`${J}${W}${X}`)}),ne.push("}"),ne.join(`
|
||||
`)}function k(R){let T=[],q="",M=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,V=0,z;for(;z=M.exec(R);)q+=R.slice(V,z.index),V=M.lastIndex,T.push({key:z[1],op:z[2]||"=",val:z[3]});return q+=R.slice(V),{filters:T,free:q.trim().toLowerCase()}}function y(R,T){for(let q of T.filters){let M=(z,ne,ee)=>{let _=parseFloat(z),P=parseFloat(ne);return ee==="="?String(z)===String(ne):ee==="!="?String(z)!==String(ne):ee===">="?_>=P:ee==="<="?_<=P:ee===">"?_>P:ee==="<"?_<P:!0},V;if(q.key==="code")V=R.displayMessage;else if(q.key==="module")V=R.module;else if(q.key==="status")V=R._status;else if(q.key==="url")V=R._url;else if(q.key==="repo")V=R._repoId;else if(q.key==="level")V=R.level;else continue;if(V==null||!M(V,q.val,q.op))return!1}return!(T.free&&((R.displayMessage||"")+" "+(R.module||"")+" "+(R._url||"")+" "+JSON.stringify(R.raw||[])).toLowerCase().indexOf(T.free)===-1)}function E(){let R=k(e.query.search||"");e.parsedFilterCount=R.filters.length;let T=e.query.bucket,q=e.entries.filter(V=>T&&V._bucket!==T?!1:y(V,R)),M=e.query.group;if(M){let V=ee=>M==="module"?ee.module:ee.displayMessage||ee.message||"_",z=new Map;for(let ee of q){let _=V(ee);if(z.has(_)){let P=z.get(_);P.count++,P._related.push(ee),new Date(ee.ts)>new Date(P.ts)&&(P.ts=ee.ts,P._url=ee._url,P._status=ee._status),new Date(ee.ts)<new Date(P._firstSeen)&&(P._firstSeen=ee.ts)}else{let P=Object.assign({},ee);P._key=`${M}:${_}`,P._related=[ee],P._firstSeen=ee.ts,P._lastHourCount=0,P.count=1,z.set(_,P)}}let ne=Date.now()-3600*1e3;for(let ee of z.values())ee._lastHourCount=ee._related.filter(_=>new Date(_.ts).getTime()>=ne).length;q=Array.from(z.values())}else q=q.map((V,z)=>(V._key="row:"+z+":"+V.ts,V._related=[V],V._firstSeen=V.ts,V._lastHourCount=0,V.count=1,V));e.query.sort==="count"?q.sort((V,z)=>z.count-V.count||new Date(z.ts)-new Date(V.ts)):q.sort((V,z)=>new Date(z.ts)-new Date(V.ts)),e.visible=q}function h(R){let T=R?e.entries.length:0,q=R?e.pageSize:Math.max(e.pageSize,e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:T,limit:q}}).then(M=>{let V=(M.data.entries||[]).map(u);e.entries=R?e.entries.concat(V):V,e.available=!!M.data.available,e.cap=M.data.max||e.cap,e.total=M.data.total||e.entries.length,E()},M=>console.error(M))}e.loadMore=()=>h(!0),e.canLoadMore=()=>e.entries.length<e.total;function C(){t.get("/api/admin/errors/stats").then(R=>{let T=R.data||{},q=T.prev24h?Math.round((T.last24h-T.prev24h)/T.prev24h*100):0;e.stats={last24h:T.last24h||0,prev24h:T.prev24h||0,delta:q,severity:T.severity||{error:0,warn:0,info:0},unique:T.unique||{error:0,warn:0,info:0},buckets:T.buckets||[],dropped:T.dropped||0}},R=>console.error(R))}function g(){h(),C()}e.barPx=(R,T)=>{let q=e.stats.buckets||[],M=0;for(let ee of q)M=Math.max(M,(ee.error||0)+(ee.warn||0)+(ee.info||0));if(!M)return 0;let V=(R.error||0)+(R.warn||0)+(R.info||0);if(!V)return 0;let z=Math.round(V/M*60),ne=R[T]||0;return Math.round(ne/V*z)},e.bucketTitle=R=>`${new Date(R.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${R.error||0} err \xB7 ${R.warn||0} warn \xB7 ${R.info||0} info`,e.toggle=R=>{e.expanded[R._key]=!e.expanded[R._key]},e.setBucket=R=>{e.query.bucket=R},e.refreshNow=g,e.clearAll=()=>{confirm("Clear all captured errors?")&&t.delete("/api/admin/errors").then(g,R=>console.error(R))},e.exportCsv=()=>{let R=["ts","level","module","displayMessage","_status","_url","_repoId"],T=[R.join(",")];for(let z of e.visible)T.push(R.map(ne=>{let ee=z[ne]==null?"":String(z[ne]);return/[",\n]/.test(ee)?`"${ee.replace(/"/g,'""')}"`:ee}).join(","));let q=new Blob([T.join(`
|
||||
`)],{type:"text/csv;charset=utf-8"}),M=URL.createObjectURL(q),V=document.createElement("a");V.href=M,V.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(M)};function b(R){e.copyHint=`${R} copied`,s.timeout(()=>{e.copyHint=""},1500)}e.copyJson=R=>{navigator.clipboard.writeText(R._detailJson).then(()=>b("JSON"))},e.copyCurl=R=>{if(!R._url)return;let q=`curl -X ${R._method||"GET"} '${window.location.origin}${R._url}'`;navigator.clipboard.writeText(q).then(()=>b("curl"))},g();let S=r(()=>{e.query.autoRefresh&&g()},15e3);e.on("dispose",()=>r.cancel(S)),e.watch("query.search",E),e.watch("query.bucket",E),e.watch("query.sort",E),e.watch("query.group",E)},El=function(e,t,n,r){if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&n.url("/")}),e.user==null){n.url("/");return}e.data=null,e.loading=!0,e.error=null,e.performance=null,e.performanceMinutes=15,e.performanceTab="routes",e.performanceError=null,e.formatMs=function(g){return g==null?"":g<1e3?g+" ms":+(g/1e3).toFixed(1)+" s"},e.latencyBound=function(g,b){return g.count?g[b]==null?"> 60 s":"\u2264 "+e.formatMs(g[b]):"No samples"},e.firstByteBound=function(g){return e.latencyBound({count:g.firstByteCount,p95UpperMs:g.firstByteP95UpperMs},"p95UpperMs")},e.sampleAge=function(g){return Math.max(0,Math.round((Date.now()-g.sampledAt)/1e3))},e.peakRss=function(g){return(e.performance.runtimeSeries||[]).filter(function(b){return b.instance===g.instance}).reduce(function(b,S){return Math.max(b,S.rss)},g.memory.rss)},e.performanceWarning=function(g){return e.sampleAge(g)>45||g.droppedBatches||g.droppedMetrics||g.sockets?.closeWait>0||g.eventLoop.p95Ms>100||g.memoryLimitBytes&&g.memory.rss>g.memoryLimitBytes*.8};var s=!1;e.loadPerformance=function(){var g=e.performanceMinutes;e.performance?.windowMinutes&&e.performance.windowMinutes!==g&&(e.performance=null),!s&&(s=!0,t.get("/api/admin/performance",{params:{minutes:g}}).then(function(b){g===e.performanceMinutes&&(e.performance=b.data,e.performanceError=b.data.available?null:"Performance monitoring is unavailable. Request history may be incomplete.")},function(){g===e.performanceMinutes&&(e.performanceError="Could not refresh performance monitoring. Displayed samples may be stale.")}).finally(function(){s=!1,g!==e.performanceMinutes&&e.loadPerformance()}))};function i(g){if(g==null)return"\u2014";for(var b=["B","KB","MB","GB","TB"],S=0,R=g;R>=1024&&S<b.length-1;)R/=1024,S++;return R.toFixed(S>0?1:0)+" "+b[S]}e.humanBytes=i;function a(g){if(!g)return"\u2014";var b=Math.floor(g/86400),S=Math.floor(g%86400/3600),R=Math.floor(g%3600/60);return b>0?b+"d "+(S<10?"0":"")+S+"h":S>0?S+"h "+(R<10?"0":"")+R+"m":R+"m"}e.humanDuration=a;function u(g){return g==null?"\u2014":g>=1e6?(g/1e6).toFixed(1)+"M":g>=1e3?(g/1e3).toFixed(1)+"K":String(g)}e.humanNum=u,e.queueTotal=function(g){return g?(g.waiting||0)+(g.active||0)+(g.delayed||0)+(g.failed||0):0},e.statusCount=function(g){if(!e.data||!e.data.repos)return 0;for(var b=e.data.repos.statusBreakdown||[],S=0;S<b.length;S++)if(b[S]._id===g)return b[S].count;return 0},e.barPct=function(g){var b=e.data&&e.data.repos?e.data.repos.total:0;if(!b)return 0;var S=[g];g==="expired"&&S.push("expiring"),g==="removed"&&S.push("removing"),g==="preparing"&&S.push("download");var R=0;return S.forEach(function(T){R+=e.statusCount(T)}),Math.max(.4,R/b*100)},e.errPct=function(g){if(!e.data||!e.data.errors)return 0;var b=Math.max(e.data.errors.severity.error,e.data.errors.severity.warn,e.data.errors.severity.info,1);return e.data.errors.severity[g]/b*100};function m(g){var b=g||[];return b.map(function(S,R){var T=b[R-1]||{},q=Object.assign({},S);return q.dailyRepositories=R?Math.max(0,(S.nbRepositories||0)-(T.nbRepositories||0)):0,q.dailyUsers=R?Math.max(0,(S.nbUsers||0)-(T.nbUsers||0)):0,q.dailyPageViews=R?Math.max(0,(S.nbPageViews||0)-(T.nbPageViews||0)):0,q})}function k(g){var b=g&&g.length?g[g.length-1]:{};return{repositories:b.dailyRepositories||0,users:b.dailyUsers||0,pageViews:b.dailyPageViews||0}}var y={},E={};e.historyBarH=function(g,b){return!g||!y[b]?0:Math.max(1,Math.round(g[b]/y[b]*140))},e.historyRangeH=function(g,b){if(!g||y[b]==null)return 0;var S=y[b]-E[b];return S?Math.round(8+(g[b]-E[b])/S*132):70},e.historyRange=function(g){return{min:E[g],max:y[g]}},e.historyLabel=function(g){if(!g||!g.date)return"";var b=new Date(g.date);return b.getUTCMonth()+1+"/"+b.getUTCDate()};function h(){e.loadPerformance(),t.get("/api/admin/overview").then(function(g){g.data.history=m(g.data.history),g.data.daily={today:k(g.data.history)},e.data=g.data,e.loading=!1,e.error=null,y={},E={},(g.data.history||[]).forEach(function(b){["dailyPageViews","dailyRepositories","dailyUsers","nbUsers"].forEach(function(S){(!y[S]||b[S]>y[S])&&(y[S]=b[S]),(E[S]==null||b[S]<E[S])&&(E[S]=b[S])})})},function(g){e.loading=!1,e.error=g.data&&g.data.error||"Failed to load overview"})}h();var C=r(h,3e4);e.on("dispose",function(){r.can
Line truncated
|
||||
anonymous_github`)])])])])]),f(" Limitations "),o("h4",{class:"faq-cat"},[o("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[o("use",{href:"#ui-icon-warning"})]),w("Limitations ")]),o("div",{class:"panel-group",id:"faq-limitations",role:"tablist","aria-multiselectable":"true"},[o("div",{class:"panel panel-default mb-3"},[o("div",{class:"panel-heading p-3",role:"tab",id:"headingLimitation"},[o("h3",{class:"panel-title"},[o("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-limitations",href:"#limitation","aria-expanded":"false","aria-controls":"limitation"}," What are the limitations of Anonymous GitHub? ")])]),o("div",{id:"limitation",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingLimitation"},[o("div",{class:"panel-body p-3"},[o("ul",null,[o("li",null," Anonymous GitHub only anonymizes text-based files. Binary files (compiled executables, archives, etc.) are served as-is without anonymization. "),o("li",null," Files larger than 8 MB are not supported. "),o("li",null," Static site generators (such as Jekyll) used with GitHub Pages are not fully supported, although Markdown files are converted to HTML. "),o("li",null," The anonymization of terms within source code may change the behavior of the program (e.g., if a replaced term appears in a string literal or identifier). ")])])])])]),f(" Privacy & Security "),o("h4",{class:"faq-cat"},[o("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[o("use",{href:"#ui-icon-shield"})]),w("Privacy & Security ")]),o("div",{class:"panel-group",id:"faq-privacy",role:"tablist","aria-multiselectable":"true"},[o("div",{class:"panel panel-default mb-3"},[o("div",{class:"panel-heading p-3",role:"tab",id:"headingData"},[o("h3",{class:"panel-title"},[o("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#data","aria-expanded":"false","aria-controls":"data"}," How is my data handled? ")])]),o("div",{id:"data",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingData"},[o("div",{class:"panel-body p-3"},[o("p",null," Data stored on Anonymous GitHub is never shared or used for any purpose beyond providing the anonymization service. When a repository is removed or expires, only its configuration is retained \u2014 this makes it easy to restore the repository if needed and ensures that no future repository reuses the same ID. ")])])]),o("div",{class:"panel panel-default mb-3"},[o("div",{class:"panel-heading p-3",role:"tab",id:"headingPermissions"},[o("h3",{class:"panel-title"},[o("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#permissions","aria-expanded":"false","aria-controls":"permissions"}," Why does GitHub say Anonymous GitHub asks for write access? ")])]),o("div",{id:"permissions",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingPermissions"},[o("div",{class:"panel-body p-3"},[o("p",null,[w("The GitHub App has read-only access to the repositories you choose. You can change repository access on your "),o("a",{href:"/connections"},"GitHub connections"),w(" page.")]),o("p",null,"Legacy GitHub OAuth includes write access to private repositories because GitHub's OAuth scopes do not offer a read-only option for them. Existing OAuth anonymizations and gists can still use this connection."),o("p",null,"Anonymous GitHub reads repository content. It never pushes, modifies, or deletes files on GitHub.")])])]),o("div",{class:"panel panel-default mb-3"},[o("div",{class:"panel-heading p-3",role:"tab",id:"headingViewer"},[o("h3",{class:"panel-title"},[o("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#viewer","aria-expanded":"false","aria-controls":"viewer"}," Can repository owners see who viewed their anonymized repository? ")])]),o("div",{id:"viewer",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingViewer"},[o("div",{class:"panel-body p-3"},[o("p",null," No. Only the total number of views is tracked as an incremental counter. It is not possible for the repository owner or for Anonymous GitHub to identify individual viewers. Reviewer anonymity is fully preserved. ")])])])]),f(" Self-Hosting "),o("h4",{class:"faq-cat"},[o("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[o("use",{href:"#project-icon-storage"})]),w("Self-Hosting ")]),o("div",{class:"panel-group",id:"faq-hosting",role:"tablist","aria-multiselectable":"true"},[o("div",{class:"panel panel-default mb-3"},[o("div",{class:"panel-heading p-3",role:"tab",id:"headingDeploy"},[o("h3",{class:"panel-title"},[o("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-hosting",href:"#deploy","aria-expanded":"false","aria-controls":"deploy"}," Can I deploy my own instance? ")])]),o("div",{id:"deploy",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingDeploy"},[o("div",{class:"panel-body p-3"},[o("p",null,[w(" Yes. Anonymous Git
Line truncated
|
||||
anonymized repository often think it is about the paper, so the
|
||||
label names the service and the tooltip says who to contact. `),t[17]||(t[17]=o("li",{class:"nav-item d-none d-lg-block"},[o("a",{class:"nav-link",target:"_blank",rel:"noopener",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",title:"Report a problem with the Anonymous GitHub service. Questions about an anonymized repository or paper go to its authors.","data-offset":"30"},[o("svg",{class:"ui-icon d-lg-none mr-1","aria-hidden":"true"},[o("use",{href:"#ui-icon-bug"})]),b("Report a bug ")])],-1)),e.isDarkMode?p("v-if",!0):(l(),d("li",z3,[o("a",{class:"nav-link nav-icon",href:"#",title:"Switch to dark mode","aria-label":"Switch to dark mode",role:"button",onClick:t[0]||(t[0]=le(n=>{e.darkMode(!0)},["prevent"]))},[...t[13]||(t[13]=[o("svg",{class:"ui-icon","aria-hidden":"true"},[o("use",{href:"#ui-icon-moon"})],-1)])])])),e.isDarkMode?(l(),d("li",H3,[o("a",{class:"nav-link nav-icon",href:"#",title:"Switch to light mode","aria-label":"Switch to light mode",role:"button",onClick:t[1]||(t[1]=le(n=>{e.darkMode(!1)},["prevent"]))},[...t[14]||(t[14]=[o("svg",{class:"ui-icon","aria-hidden":"true"},[o("use",{href:"#ui-icon-sun"})],-1)])])])):p("v-if",!0),!e.user&&!e.isReviewerRoute?(l(),d("li",B3,[...t[15]||(t[15]=[o("a",{class:"nav-link btn-signin",target:"_self",href:"/signin","data-offset":"30"},[o("i",{class:"fab fa-github mr-1"}),b(" Sign in ")],-1)])])):p("v-if",!0),e.user?(l(),d("li",j3,[o("a",G3,[e.user?.photo?(l(),d("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,W3)):p("v-if",!0),o("span",K3,c(e.user?.username),1)]),o("div",Y3,[o("h6",J3,"Signed in as @"+c(e.user?.username),1),t[16]||(t[16]=ce('<a class="dropdown-item" href="/profile"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-filter"></use></svg><span>Settings<small>Defaults, quotas, account</small></span></a><a class="dropdown-item" href="/connections"><i class="fab fa-github" aria-hidden="true"></i><span>GitHub connections<small>Repository access and OAuth</small></span></a><a class="dropdown-item" href="/claim"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-link"></use></svg><span>Claim an anonymization<small>Attach an existing mirror to your account</small></span></a><div class="dropdown-divider"></div><a class="dropdown-item" href="https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml" target="_blank" rel="noopener"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-bug"></use></svg><span>Report a bug<small>About this service, not a paper</small></span></a><a class="dropdown-item" href="https://github.com/tdurieux/anonymous_github/" target="_blank" rel="noopener"><i class="fab fa-github" aria-hidden="true"></i><span>Source code</span></a><a class="dropdown-item" href="https://ko-fi.com/tdurieux" target="_blank" rel="noopener"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-heart"></use></svg><span>Support the project</span></a><div class="dropdown-divider"></div><a class="dropdown-item" href="/api/user/logout" target="_self"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-logout"></use></svg><span>Sign out</span></a>',9))])])):p("v-if",!0)])])],2),e.generalMessage?(l(),d("div",{key:0,class:"navbar shadow generalMessage",innerHTML:e.sanitize(e.generalMessage)},null,8,Q3)):p("v-if",!0),e.emailPromptOpen?(l(),d("dialog",{key:1,id:"email-prompt",class:"email-prompt","aria-labelledby":"email-prompt-title","aria-describedby":"email-prompt-reason",onCancel:t[6]||(t[6]=le(n=>e.respondToEmailPrompt("later"),["prevent"]))},[o("form",{onSubmit:t[5]||(t[5]=le(n=>e.respondToEmailPrompt("save"),["prevent"]))},[t[19]||(t[19]=o("h2",{id:"email-prompt-title"},"Stay informed about access problems",-1)),t[20]||(t[20]=o("p",{id:"email-prompt-reason"},"Get email alerts when your GitHub token or repository access fails.",-1)),t[21]||(t[21]=o("label",{for:"email-prompt-address"},"Email address",-1)),D(o("input",{id:"email-prompt-address",class:"form-control",type:"email",autocomplete:"email",maxlength:"254",required:"","onUpdate:modelValue":t[2]||(t[2]=n=>e.emailPromptAddress=n),disabled:e.emailPromptBusy},null,8,X3),[[zt,e.emailPromptAddress]]),e.emailPromptError?(l(),d("p",Z3,c(e.emailPromptError),1)):p("v-if",!0),o("div",x3,[o("button",{type:"button",class:"btn btn-outline-ink",disabled:e.emailPromptBusy,onClick:t[3]||(t[3]=n=>e.respondToEmailPrompt("later"))},"Remind me later",8,eP),o("button",{type:"button",class:"btn btn-outline-ink",disabled:e.emailPromptBusy,onClick:t[4]||(t[4]=n=>e.respondToEmailPrompt("never"))},"Never",8,tP),o("button",{type:"submit",class:"btn btn-ink",disabled:e.emailPromptBusy},c(e.emailPromptBusy?"Saving\u2026":"Save"),9,oP)])],32)],32)):p("v-if",!0)],64)}var nP={class:"paper-landing"},sP={class:"paper-hero"},rP={class:"paper-hero-copy"},iP={class:"paper-cta-row"},aP={key:0,href:"/signin",target:"_self",class:"btn-hero"},lP={key:1,href:"/anonymize",cla
Line truncated
|
||||
label names the service and the tooltip says who to contact. `),t[17]||(t[17]=o("li",{class:"nav-item d-none d-lg-block"},[o("a",{class:"nav-link",target:"_blank",rel:"noopener",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",title:"Report a problem with the Anonymous GitHub service. Questions about an anonymized repository or paper go to its authors.","data-offset":"30"},[o("svg",{class:"ui-icon d-lg-none mr-1","aria-hidden":"true"},[o("use",{href:"#ui-icon-bug"})]),w("Report a bug ")])],-1)),e.isDarkMode?f("v-if",!0):(l(),d("li",K3,[o("a",{class:"nav-link nav-icon",href:"#",title:"Switch to dark mode","aria-label":"Switch to dark mode",role:"button",onClick:t[0]||(t[0]=ie(n=>{e.darkMode(!0)},["prevent"]))},[...t[13]||(t[13]=[o("svg",{class:"ui-icon","aria-hidden":"true"},[o("use",{href:"#ui-icon-moon"})],-1)])])])),e.isDarkMode?(l(),d("li",Y3,[o("a",{class:"nav-link nav-icon",href:"#",title:"Switch to light mode","aria-label":"Switch to light mode",role:"button",onClick:t[1]||(t[1]=ie(n=>{e.darkMode(!1)},["prevent"]))},[...t[14]||(t[14]=[o("svg",{class:"ui-icon","aria-hidden":"true"},[o("use",{href:"#ui-icon-sun"})],-1)])])])):f("v-if",!0),!e.user&&!e.isReviewerRoute?(l(),d("li",J3,[...t[15]||(t[15]=[o("a",{class:"nav-link btn-signin",target:"_self",href:"/signin","data-offset":"30"},[o("i",{class:"fab fa-github mr-1"}),w(" Sign in ")],-1)])])):f("v-if",!0),e.user?(l(),d("li",Q3,[o("a",X3,[e.user?.photo?(l(),d("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,Z3)):f("v-if",!0),o("span",x3,c(e.user?.username),1)]),o("div",eP,[o("h6",tP,"Signed in as @"+c(e.user?.username),1),t[16]||(t[16]=ue('<a class="dropdown-item" href="/profile"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-filter"></use></svg><span>Settings<small>Defaults, quotas, account</small></span></a><a class="dropdown-item" href="/connections"><i class="fab fa-github" aria-hidden="true"></i><span>GitHub connections<small>Repository access and OAuth</small></span></a><a class="dropdown-item" href="/claim"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-link"></use></svg><span>Claim an anonymization<small>Attach an existing mirror to your account</small></span></a><div class="dropdown-divider"></div><a class="dropdown-item" href="https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml" target="_blank" rel="noopener"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-bug"></use></svg><span>Report a bug<small>About this service, not a paper</small></span></a><a class="dropdown-item" href="https://github.com/tdurieux/anonymous_github/" target="_blank" rel="noopener"><i class="fab fa-github" aria-hidden="true"></i><span>Source code</span></a><a class="dropdown-item" href="https://ko-fi.com/tdurieux" target="_blank" rel="noopener"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-heart"></use></svg><span>Support the project</span></a><div class="dropdown-divider"></div><a class="dropdown-item" href="/api/user/logout" target="_self"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-logout"></use></svg><span>Sign out</span></a>',9))])])):f("v-if",!0)])])],2),e.generalMessage?(l(),d("div",{key:0,class:"navbar shadow generalMessage",innerHTML:e.sanitize(e.generalMessage)},null,8,oP)):f("v-if",!0),e.emailPromptOpen?(l(),d("dialog",{key:1,id:"email-prompt",class:"email-prompt","aria-labelledby":"email-prompt-title","aria-describedby":"email-prompt-reason",onCancel:t[6]||(t[6]=ie(n=>e.respondToEmailPrompt("later"),["prevent"]))},[o("form",{onSubmit:t[5]||(t[5]=ie(n=>e.respondToEmailPrompt("save"),["prevent"]))},[t[19]||(t[19]=o("h2",{id:"email-prompt-title"},"Stay informed about access problems",-1)),t[20]||(t[20]=o("p",{id:"email-prompt-reason"},"Get email alerts when your GitHub token or repository access fails.",-1)),t[21]||(t[21]=o("label",{for:"email-prompt-address"},"Email address",-1)),N(o("input",{id:"email-prompt-address",class:"form-control",type:"email",autocomplete:"email",maxlength:"254",required:"","onUpdate:modelValue":t[2]||(t[2]=n=>e.emailPromptAddress=n),disabled:e.emailPromptBusy},null,8,nP),[[zt,e.emailPromptAddress]]),e.emailPromptError?(l(),d("p",sP,c(e.emailPromptError),1)):f("v-if",!0),o("div",rP,[o("button",{type:"button",class:"btn btn-outline-ink",disabled:e.emailPromptBusy,onClick:t[3]||(t[3]=n=>e.respondToEmailPrompt("later"))},"Remind me later",8,iP),o("button",{type:"button",class:"btn btn-outline-ink",disabled:e.emailPromptBusy,onClick:t[4]||(t[4]=n=>e.respondToEmailPrompt("never"))},"Never",8,aP),o("button",{type:"submit",class:"btn btn-ink",disabled:e.emailPromptBusy},c(e.emailPromptBusy?"Saving\u2026":"Save"),9,lP)])],32)],32)):f("v-if",!0)],64)}var dP={class:"paper-landing"},uP={class:"paper-hero"},cP={class:"paper-hero-copy"},pP={class:"paper-cta-row"},fP={key:0,href:"/signin",target:"_self",class:"btn-hero"},mP={key:1,href:"/anonymize",cla
Line truncated
|
||||
MIT CSAIL
|
||||
jane.smith@example.org`},Aq={id:"termsHelp",class:"form-text text-muted"},Oq={class:"invalid-feedback"},Iq={id:"settings-display",class:"paper-settings-section"},Pq={class:"form-group paper-check-list"},Vq={class:"form-check"},qq={class:"form-check-input",type:"checkbox",id:"link",name:"link"},Mq={class:"form-check"},$q={class:"form-check-input",type:"checkbox",id:"image",name:"image"},Lq={class:"form-check"},Uq={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},Fq={class:"form-check"},zq={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},Hq={id:"settings-features",class:"paper-settings-section"},Bq={class:"form-group paper-check-list"},jq={class:"form-check"},Gq={class:"form-check-input",type:"checkbox",id:"page",name:"page"},Wq={class:"form-check"},Kq={class:"form-check-input",type:"checkbox",id:"loc",name:"loc"},Yq={class:"form-check"},Jq={class:"form-check-input",type:"checkbox",id:"update",name:"update"},Qq={class:"form-group"},Xq={class:"form-control",id:"mode",name:"mode"},Zq={class:"form-text text-muted"},xq={id:"settings-expiration",class:"paper-settings-section"},eM={class:"form-group"},tM={class:"form-control",id:"expiration",name:"expiration"},oM={key:0,class:"draft-status",role:"status"},nM={key:1,class:"draft-status"},sM={class:"paper-settings-footer"},rM={key:0,class:"paper-inline-alert paper-inline-alert-error",role:"alert"},iM=["textContent"],aM={class:"paper-settings-actions"},lM=["disabled"],dM={key:0,class:"ui-icon mr-1","aria-hidden":"true"},uM={id:"settings-account",class:"paper-settings-section"},cM={class:"paper-account-card"},pM=["src"],fM={class:"paper-account-identity"},mM={class:"paper-account-name"},hM=["disabled"],vM={key:0,role:"status"},yM={key:1,class:"paper-inline-alert paper-inline-alert-error",role:"alert"},gM=["disabled"],bM={key:3,role:"status"},wM={class:"paper-danger-zone"},kM={key:0,class:"paper-inline-alert paper-inline-alert-error",role:"alert"},EM=["textContent"],CM=["disabled"];function Ql(e,t){let n=Ge("quota-usage"),r=ge("paper-scrollspy"),s=ge("field"),i=ge("form");return l(),d("div",wq,[t[58]||(t[58]=ce('<div class="paper-crumbs"><a href="/dashboard">My work</a> \xA0/\xA0 <span class="here">Settings</span></div><h1 class="paper-page-title">Your <em>settings</em></h1><p class="paper-page-lede">Defaults applied to every new anonymization, your quotas, and your account.</p>',3)),o("div",kq,[D((l(),d("aside",Eq,[...t[8]||(t[8]=[ce('<div class="paper-settings-toc-head">On this page</div><nav><a href="#settings-quota">Quota</a><a href="#settings-terms">Terms to redact</a><a href="#settings-display">Display</a><a href="#settings-features">Features</a><a href="#settings-expiration">Expiration</a><a href="#settings-account">Account</a></nav>',2)])])),[[r]]),o("div",Cq,[p(" Account usage shares the dashboard component. "),o("section",_q,[t[10]||(t[10]=o("div",{class:"paper-section-eyebrow"},"Quota",-1)),t[11]||(t[11]=o("p",{class:"paper-section-copy"},"What you are using across all your anonymizations. Conferences can lift these limits during a review window.",-1)),e.quota?(l(),Ut(n,{key:0,quota:e.quota,fmt:e.fmt},null,8,["quota","fmt"])):p("v-if",!0),e.quota?p("v-if",!0):(l(),d("div",Sq,[(l(),d(Q,null,re([1,2,3],(a,u)=>o("div",Nq,[...t[9]||(t[9]=[o("div",{class:"quota-header"},[o("span",{class:"skeleton skeleton-line",style:{width:"40%"}}),o("span",{class:"skeleton skeleton-line",style:{width:"25%"}})],-1),o("div",{class:"quota-track"},null,-1)])])),64))]))]),D((l(),d("form",{class:"form needs-validation",name:"defaultsForm",novalidate:"",onSubmit:t[2]||(t[2]=le(a=>e.submitForm(a,()=>{e.saveDefault(a)}),["prevent"]))},[o("section",Dq,[t[17]||(t[17]=o("div",{class:"paper-section-eyebrow"},"Terms to redact",-1)),t[18]||(t[18]=o("p",{class:"paper-section-copy"},"Pre-filled in every new anonymization. You can still edit the list per anonymization.",-1)),o("div",Rq,[t[16]||(t[16]=o("label",{class:"paper-field-label",for:"terms"},"Default terms",-1)),D(o("textarea",Tq,null,512),[[s,{state:e.viewState,set:a=>{e.terms=a},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),o("small",Aq,[t[12]||(t[12]=b(" One term per line (regex allowed). Each match is replaced by ",-1)),o("code",null,c(e.site_options?.ANONYMIZATION_MASK||"XXX")+"-[N]",1),t[13]||(t[13]=b(", or use ",-1)),t[14]||(t[14]=o("code",null,"term=>replacement",-1)),t[15]||(t[15]=b(" to pick your own. ",-1))]),D(o("div",Oq," Terms are in an invalid format ",512),[[K,e.defaultsForm?.terms?.errors?.format]])])]),o("section",Iq,[t[27]||(t[27]=o("div",{class:"paper-section-eyebrow"},"Display",-1)),t[28]||(t[28]=o("p",{class:"paper-section-copy"},"What reviewers can see inside an anonymized repository.",-1)),o("div",Pq,[o("div",Vq,[D(o("input",qq,null,512),[[s,{state:e.viewState,set:a=>{e.options.link=a},value:e.options?.link,form:"defaultsForm",options:{}}]]),t[19]||(t[19]=o("label",{class:"form-check-label",for:"link"},"Keep links",-1)),t[20]||(t[20]=o("small",{class:"form-text t
Line truncated
|
||||
`);for(let k=0;k<h.length;k++){let m=h[k];if(m.startsWith("diff --git")){w(),f();continue}if(m.startsWith("--- ")){i&&i.lines.length&&w(),f().oldPath=m.replace(/^--- (a\/)?/,"").trim();continue}if(m.startsWith("+++ ")){f().newPath=m.replace(/^\+\+\+ (b\/)?/,"").trim();continue}if(!(m.startsWith("index ")||m.startsWith("similarity index")||m.startsWith("rename ")||m.startsWith("new file mode")||m.startsWith("deleted file mode")||m.startsWith("Binary files"))){if(m.startsWith("@@")){let C=m.match(/@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);C&&(a=parseInt(C[1],10),u=parseInt(C[2],10)),f().lines.push({kind:"hunk",oldNo:"",newNo:"",text:m});continue}i&&(m.startsWith("+")?(i.lines.push({kind:"add",oldNo:"",newNo:u,text:m.slice(1)}),u++):m.startsWith("-")?(i.lines.push({kind:"remove",oldNo:a,newNo:"",text:m.slice(1)}),a++):(i.lines.push({kind:"ctx",oldNo:a,newNo:u,text:m.startsWith(" ")?m.slice(1):m}),a++,u++))}}return n(s,i),s.join("")}})({trustAsHtml:e=>e});function F8(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function z8(e){return String(e??"").toUpperCase()}function H8(e,t,n=0){return(e||[]).slice(n,n+t)}function B8(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function j8(e,t){if(!t)return e||[];let n=Array.isArray(t)?t:[t];return[...e||[]].sort((r,s)=>{for(let i of n){let a=i[0]==="-"?-1:1;i=i.replace(/^[+-]/,"");let u=i.split(".").reduce((w,h)=>w?.[h],r),f=i.split(".").reduce((w,h)=>w?.[h],s);if(typeof u=="string"&&(u=u.toLowerCase()),typeof f=="string"&&(f=f.toLowerCase()),u!==f)return(u==null?-1:f==null?1:u<f?-1:1)*a}return 0})}function G8(e,t){if(!e)return"";let n=new Date(e);if(isNaN(n))return String(e);if(!t||t==="mediumDate")return n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});let r={yyyy:n.getFullYear(),MMM:n.toLocaleDateString(void 0,{month:"short"}),MM:String(n.getMonth()+1).padStart(2,"0"),dd:String(n.getDate()).padStart(2,"0"),d:n.getDate(),HH:String(n.getHours()).padStart(2,"0"),mm:String(n.getMinutes()).padStart(2,"0"),ss:String(n.getSeconds()).padStart(2,"0")};return t.replace(/yyyy|MMM|MM|dd|HH|mm|ss|d/g,s=>r[s])}function W8(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}var sd={name:"htmlDoc",props:["content","baseUrl","allowScripts"],setup(e){let t=xe(null);return Lt(()=>{let r=[t.value][0];r.classList.add("html-doc");function s(){r.innerHTML="";let i=e.content;if(typeof i!="string")return;let a=document.createElement("iframe");a.className="html-doc-frame",a.setAttribute("title","Rendered HTML document");let u=["allow-popups","allow-popups-to-escape-sandbox"];e.allowScripts&&u.push("allow-scripts","allow-forms","allow-modals"),a.setAttribute("sandbox",u.join(" ")),a.setAttribute("referrerpolicy","no-referrer"),r.appendChild(a);let f="";e.baseUrl&&(f='<base href="'+e.baseUrl.replace(/&/g,"&").replace(/"/g,""")+'">'),a.srcdoc=f+i}He(()=>e.content,s,{immediate:!0}),He(()=>e.baseUrl,s,{immediate:!0}),He(()=>e.allowScripts,s,{immediate:!0})}),()=>we("html-doc",{ref:t})}};var rd={name:"pdfviewer",props:["src"],setup(e){let t=xe(null);return Lt(()=>{let n=[t.value],r=400,s=[.5,.75,1,1.25,1.5,2,3],i=1e3,a=n[0];a.classList.add("pdf-viewer");let u=null,f=[],w=!1,h=null,k=1,m=1,C=0,y=0,g=612/792,S=0,R=null,T=new Map,P=0;function L(v){let E=T.get(v);E&&(E.cancelled=!0,E.task?.cancel?.(),T.delete(v));let O=v.querySelector("canvas");O&&(O.width=0,O.height=0),v.innerHTML="",delete v.dataset.state}let V=document.createElement("div");V.className="pdf-toolbar";let M=document.createElement("div");M.className="pdf-pages",M.tabIndex=0,M.setAttribute("aria-label","PDF pages"),a.appendChild(V),a.appendChild(M);function se(v,E,O){let H=document.createElement("button");return H.type="button",H.className="pdf-toolbar-btn",H.title=E,H.setAttribute("aria-label",E),H.innerHTML='<i class="fas '+v+'"></i>',H.addEventListener("click",O),H}let te=se("fa-chevron-up","Previous page",function(){Se(m-1)}),N=se("fa-chevron-down","Next page",function(){Se(m+1)}),I=document.createElement("input");I.type="text",I.className="pdf-toolbar-page",I.setAttribute("aria-label","Page number"),I.title="Page number \u2014 type a page and press Enter",I.addEventListener("keydown",function(v){v.key==="Enter"&&(Se(parseInt(I.value,10)),I.blur())}),I.addEventListener("blur",function(){I.value=String(m)});let Y=document.createElement("span");Y.className="pdf-toolbar-count";let Z=se("fa-search-minus","Zoom out",function(){_(s[Math.max(0,fe()-1)])}),ee=se("fa-search-plus","Zoom in",function(){_(s[Math.min(s.length-1,fe()+1)])}),J=document.createElement("button");J.type="button",J.className="pdf-toolbar-btn pdf-toolbar-zoom",J.title="Reset zoom to fit the width",J.setAttribute("aria-label","Reset zoom to fit the width"),J.addEventListener("click",function(){_(1)}),V.appendChild(te),V.appendChild(N);let ie=document.createElement("span");ie.className="pdf-toolbar-group",ie.appendChild(I),ie.
Line truncated
|
||||
jane.smith@example.org`},Mq={id:"termsHelp",class:"form-text text-muted"},Uq={class:"invalid-feedback"},$q={id:"settings-display",class:"paper-settings-section"},Lq={class:"form-group paper-check-list"},Fq={class:"form-check"},zq={class:"form-check-input",type:"checkbox",id:"link",name:"link"},Hq={class:"form-check"},Bq={class:"form-check-input",type:"checkbox",id:"image",name:"image"},jq={class:"form-check"},Gq={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},Wq={class:"form-check"},Kq={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},Yq={id:"settings-features",class:"paper-settings-section"},Jq={class:"form-group paper-check-list"},Qq={class:"form-check"},Xq={class:"form-check-input",type:"checkbox",id:"page",name:"page"},Zq={class:"form-check"},xq={class:"form-check-input",type:"checkbox",id:"loc",name:"loc"},eM={class:"form-check"},tM={class:"form-check-input",type:"checkbox",id:"update",name:"update"},oM={class:"form-group"},nM={class:"form-control",id:"mode",name:"mode"},sM={class:"form-text text-muted"},rM={id:"settings-expiration",class:"paper-settings-section"},iM={class:"form-group"},aM={class:"form-control",id:"expiration",name:"expiration"},lM={key:0,class:"draft-status",role:"status"},dM={key:1,class:"draft-status"},uM={class:"paper-settings-footer"},cM={key:0,class:"paper-inline-alert paper-inline-alert-error",role:"alert"},pM=["textContent"],fM={class:"paper-settings-actions"},mM=["disabled"],hM={key:0,class:"ui-icon mr-1","aria-hidden":"true"},vM={id:"settings-account",class:"paper-settings-section"},yM={class:"paper-account-card"},gM=["src"],bM={class:"paper-account-identity"},wM={class:"paper-account-name"},kM=["disabled"],EM={key:0,role:"status"},CM={key:1,class:"paper-inline-alert paper-inline-alert-error",role:"alert"},_M=["disabled"],SM={key:3,role:"status"},NM={class:"paper-danger-zone"},DM={key:0,class:"paper-inline-alert paper-inline-alert-error",role:"alert"},RM=["textContent"],TM=["disabled"];function Ql(e,t){let n=Ge("quota-usage"),r=ve("paper-scrollspy"),s=ve("field"),i=ve("form");return l(),d("div",Nq,[t[58]||(t[58]=ue('<div class="paper-crumbs"><a href="/dashboard">My work</a> \xA0/\xA0 <span class="here">Settings</span></div><h1 class="paper-page-title">Your <em>settings</em></h1><p class="paper-page-lede">Defaults applied to every new anonymization, your quotas, and your account.</p>',3)),o("div",Dq,[N((l(),d("aside",Rq,[...t[8]||(t[8]=[ue('<div class="paper-settings-toc-head">On this page</div><nav><a href="#settings-quota">Quota</a><a href="#settings-terms">Terms to redact</a><a href="#settings-display">Display</a><a href="#settings-features">Features</a><a href="#settings-expiration">Expiration</a><a href="#settings-account">Account</a></nav>',2)])])),[[r]]),o("div",Tq,[f(" Account usage shares the dashboard component. "),o("section",Aq,[t[10]||(t[10]=o("div",{class:"paper-section-eyebrow"},"Quota",-1)),t[11]||(t[11]=o("p",{class:"paper-section-copy"},"What you are using across all your anonymizations. Conferences can lift these limits during a review window.",-1)),e.quota?(l(),Lt(n,{key:0,quota:e.quota,fmt:e.fmt},null,8,["quota","fmt"])):f("v-if",!0),e.quota?f("v-if",!0):(l(),d("div",Oq,[(l(),d(K,null,oe([1,2,3],(a,u)=>o("div",Iq,[...t[9]||(t[9]=[o("div",{class:"quota-header"},[o("span",{class:"skeleton skeleton-line",style:{width:"40%"}}),o("span",{class:"skeleton skeleton-line",style:{width:"25%"}})],-1),o("div",{class:"quota-track"},null,-1)])])),64))]))]),N((l(),d("form",{class:"form needs-validation",name:"defaultsForm",novalidate:"",onSubmit:t[2]||(t[2]=ie(a=>e.submitForm(a,()=>{e.saveDefault(a)}),["prevent"]))},[o("section",Pq,[t[17]||(t[17]=o("div",{class:"paper-section-eyebrow"},"Terms to redact",-1)),t[18]||(t[18]=o("p",{class:"paper-section-copy"},"Pre-filled in every new anonymization. You can still edit the list per anonymization.",-1)),o("div",Vq,[t[16]||(t[16]=o("label",{class:"paper-field-label",for:"terms"},"Default terms",-1)),N(o("textarea",qq,null,512),[[s,{state:e.viewState,set:a=>{e.terms=a},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),o("small",Mq,[t[12]||(t[12]=w(" One term per line (regex allowed). Each match is replaced by ",-1)),o("code",null,c(e.site_options?.ANONYMIZATION_MASK||"XXX")+"-[N]",1),t[13]||(t[13]=w(", or use ",-1)),t[14]||(t[14]=o("code",null,"term=>replacement",-1)),t[15]||(t[15]=w(" to pick your own. ",-1))]),N(o("div",Uq," Terms are in an invalid format ",512),[[j,e.defaultsForm?.terms?.errors?.format]])])]),o("section",$q,[t[27]||(t[27]=o("div",{class:"paper-section-eyebrow"},"Display",-1)),t[28]||(t[28]=o("p",{class:"paper-section-copy"},"What reviewers can see inside an anonymized repository.",-1)),o("div",Lq,[o("div",Fq,[N(o("input",zq,null,512),[[s,{state:e.viewState,set:a=>{e.options.link=a},value:e.options?.link,form:"defaultsForm",options:{}}]]),t[19]||(t[19]=o("label",{class:"form-check-label",for:"link"},"Keep links",-1)),t[20]||(t[20]=o("small",{class:"form-text t
Line truncated
|
||||
`);for(let E=0;E<y.length;E++){let h=y[E];if(h.startsWith("diff --git")){k(),m();continue}if(h.startsWith("--- ")){i&&i.lines.length&&k(),m().oldPath=h.replace(/^--- (a\/)?/,"").trim();continue}if(h.startsWith("+++ ")){m().newPath=h.replace(/^\+\+\+ (b\/)?/,"").trim();continue}if(!(h.startsWith("index ")||h.startsWith("similarity index")||h.startsWith("rename ")||h.startsWith("new file mode")||h.startsWith("deleted file mode")||h.startsWith("Binary files"))){if(h.startsWith("@@")){let C=h.match(/@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);C&&(a=parseInt(C[1],10),u=parseInt(C[2],10)),m().lines.push({kind:"hunk",oldNo:"",newNo:"",text:h});continue}i&&(h.startsWith("+")?(i.lines.push({kind:"add",oldNo:"",newNo:u,text:h.slice(1)}),u++):h.startsWith("-")?(i.lines.push({kind:"remove",oldNo:a,newNo:"",text:h.slice(1)}),a++):(i.lines.push({kind:"ctx",oldNo:a,newNo:u,text:h.startsWith(" ")?h.slice(1):h}),a++,u++))}}return n(s,i),s.join("")}})({trustAsHtml:e=>e});function W8(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function K8(e){return String(e??"").toUpperCase()}function Y8(e,t,n=0){return(e||[]).slice(n,n+t)}function J8(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function Q8(e,t){if(!t)return e||[];let n=Array.isArray(t)?t:[t];return[...e||[]].sort((r,s)=>{for(let i of n){let a=i[0]==="-"?-1:1;i=i.replace(/^[+-]/,"");let u=i.split(".").reduce((k,y)=>k?.[y],r),m=i.split(".").reduce((k,y)=>k?.[y],s);if(typeof u=="string"&&(u=u.toLowerCase()),typeof m=="string"&&(m=m.toLowerCase()),u!==m)return(u==null?-1:m==null?1:u<m?-1:1)*a}return 0})}function X8(e,t){if(!e)return"";let n=new Date(e);if(isNaN(n))return String(e);if(!t||t==="mediumDate")return n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});let r={yyyy:n.getFullYear(),MMM:n.toLocaleDateString(void 0,{month:"short"}),MM:String(n.getMonth()+1).padStart(2,"0"),dd:String(n.getDate()).padStart(2,"0"),d:n.getDate(),HH:String(n.getHours()).padStart(2,"0"),mm:String(n.getMinutes()).padStart(2,"0"),ss:String(n.getSeconds()).padStart(2,"0")};return t.replace(/yyyy|MMM|MM|dd|HH|mm|ss|d/g,s=>r[s])}function Z8(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}var sd={name:"htmlDoc",props:["content","baseUrl","allowScripts"],setup(e){let t=xe(null);return $t(()=>{let r=[t.value][0];r.classList.add("html-doc");function s(){r.innerHTML="";let i=e.content;if(typeof i!="string")return;let a=document.createElement("iframe");a.className="html-doc-frame",a.setAttribute("title","Rendered HTML document");let u=["allow-popups","allow-popups-to-escape-sandbox"];e.allowScripts&&u.push("allow-scripts","allow-forms","allow-modals"),a.setAttribute("sandbox",u.join(" ")),a.setAttribute("referrerpolicy","no-referrer"),r.appendChild(a);let m="";e.baseUrl&&(m='<base href="'+e.baseUrl.replace(/&/g,"&").replace(/"/g,""")+'">'),a.srcdoc=m+i}He(()=>e.content,s,{immediate:!0}),He(()=>e.baseUrl,s,{immediate:!0}),He(()=>e.allowScripts,s,{immediate:!0})}),()=>be("html-doc",{ref:t})}};var rd={name:"pdfviewer",props:["src"],setup(e){let t=xe(null);return $t(()=>{let n=[t.value],r=400,s=[.5,.75,1,1.25,1.5,2,3],i=1e3,a=n[0];a.classList.add("pdf-viewer");let u=null,m=[],k=!1,y=null,E=1,h=1,C=0,g=0,b=612/792,S=0,R=null,T=new Map,q=0;function M(p){let v=T.get(p);v&&(v.cancelled=!0,v.task?.cancel?.(),T.delete(p));let D=p.querySelector("canvas");D&&(D.width=0,D.height=0),p.innerHTML="",delete p.dataset.state}let V=document.createElement("div");V.className="pdf-toolbar";let z=document.createElement("div");z.className="pdf-pages",z.tabIndex=0,z.setAttribute("aria-label","PDF pages"),a.appendChild(V),a.appendChild(z);function ne(p,v,D){let O=document.createElement("button");return O.type="button",O.className="pdf-toolbar-btn",O.title=v,O.setAttribute("aria-label",v),O.innerHTML='<i class="fas '+p+'"></i>',O.addEventListener("click",D),O}let ee=ne("fa-chevron-up","Previous page",function(){qe(h-1)}),_=ne("fa-chevron-down","Next page",function(){qe(h+1)}),P=document.createElement("input");P.type="text",P.className="pdf-toolbar-page",P.setAttribute("aria-label","Page number"),P.title="Page number \u2014 type a page and press Enter",P.addEventListener("keydown",function(p){p.key==="Enter"&&(qe(parseInt(P.value,10)),P.blur())}),P.addEventListener("blur",function(){P.value=String(h)});let G=document.createElement("span");G.className="pdf-toolbar-count";let J=ne("fa-search-minus","Zoom out",function(){te(s[Math.max(0,de()-1)])}),X=ne("fa-search-plus","Zoom in",function(){te(s[Math.min(s.length-1,de()+1)])}),W=document.createElement("button");W.type="button",W.className="pdf-toolbar-btn pdf-toolbar-zoom",W.title="Reset zoom to fit the width",W.setAttribute("aria-label","Reset zoom to fit the width"),W.addEventListener("click",function(){te(1)}),V.appendChild(ee),V.appendChild(_);let se=document.createElement("span");se.className="pdf-toolbar-group",se.appendChild(P),s
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
@vue/shared/dist/shared.esm-bundler.js:
|
||||
|
||||
@@ -236,6 +236,95 @@ describe("Vue 3 UI", function () {
|
||||
"/api/anonymize-preview": request => ({ content: request.payload.content.replaceAll("Private Author", "MASKED") }),
|
||||
};
|
||||
|
||||
it("suggests opening existing configurations for the same repository URL without copying settings", async () => {
|
||||
ui = await browser("/anonymize", {
|
||||
...repositorySource,
|
||||
"/api/user/anonymized_repositories": [
|
||||
{ repoId: "older", source: { fullName: "Owner/Repo" }, options: { terms: ["Old Author"] }, anonymizeDate: "2025-01-01" },
|
||||
{ repoId: "newer", source: { fullName: "owner/repo" }, options: { terms: ["New Author"] }, anonymizeDate: "2026-01-01" },
|
||||
{ repoId: "unrelated", source: { fullName: "owner/other" }, options: {} },
|
||||
],
|
||||
});
|
||||
const state = ui.window.document.querySelector("#sourceUrl")._field.binding.state;
|
||||
state.sourceUrl = "https://github.com/owner/repo.git/";
|
||||
await state.urlSelected();
|
||||
await delay(30);
|
||||
const suggestion = ui.window.document.querySelector('[aria-label="Previous repository configuration"]');
|
||||
expect(suggestion.textContent).to.include("avoid creating another repository");
|
||||
expect([...suggestion.querySelectorAll("option")].map(option => option.value)).to.deep.equal(["newer", "older"]);
|
||||
expect(suggestion.querySelector("a").getAttribute("href")).to.equal("/anonymize/newer");
|
||||
await ui.input("#previousConfiguration", "older", "change");
|
||||
expect(suggestion.querySelector("a").getAttribute("href")).to.equal("/anonymize/older");
|
||||
expect(state.terms).to.equal("Default Author");
|
||||
expect(state.isUpdate).to.equal(false);
|
||||
suggestion.querySelector("button").click();
|
||||
await delay(10);
|
||||
expect(ui.window.document.querySelector('[aria-label="Previous repository configuration"]')).to.equal(null);
|
||||
expect(ui.requests.filter(request => request.method === "POST" && request.url.pathname === "/api/repo/")).to.have.length(0);
|
||||
expect(ui.errors).to.deep.equal([]);
|
||||
});
|
||||
|
||||
it("opens the existing configuration from the suggestion without creating a repository", async () => {
|
||||
const existing = { repoId: "existing-review", status: "ready", role: "owner",
|
||||
source: { fullName: "owner/repo", branch: "main", commit: "abcdef123" },
|
||||
options: { terms: ["Existing Author"], expirationMode: "never" } };
|
||||
ui = await browser("/anonymize", {
|
||||
...repositorySource,
|
||||
"/api/user/anonymized_repositories": [existing],
|
||||
"/api/repo/existing-review": existing,
|
||||
});
|
||||
const sourceInput = await ui.input("#sourceUrl-landing", "https://github.com/owner/repo");
|
||||
sourceInput.dispatchEvent(new ui.window.Event("blur"));
|
||||
await delay(250);
|
||||
const link = ui.window.document.querySelector('[aria-label="Previous repository configuration"] a');
|
||||
expect(link).not.to.equal(null);
|
||||
link.click();
|
||||
await delay(250);
|
||||
const state = ui.window.document.querySelector("#sourceUrl")._field.binding.state;
|
||||
expect(ui.window.location.pathname).to.equal("/anonymize/existing-review");
|
||||
expect(state.isUpdate).to.equal(true);
|
||||
expect(state.repoId).to.equal("existing-review");
|
||||
expect(state.terms).to.equal("Existing Author");
|
||||
expect(state.source.commit).to.equal("abcdef123");
|
||||
expect(ui.window.document.querySelector('[aria-label="Previous repository configuration"]')).to.equal(null);
|
||||
expect(ui.requests.filter(request => request.method === "POST" && request.url.pathname.startsWith("/api/repo"))).to.have.length(0);
|
||||
expect(ui.errors).to.deep.equal([]);
|
||||
});
|
||||
|
||||
it("ignores delayed duplicate suggestions after switching to an invalid URL", async () => {
|
||||
let finishLookup;
|
||||
ui = await browser("/anonymize", {
|
||||
...repositorySource,
|
||||
"/api/user/anonymized_repositories": () => new Promise(resolve => {
|
||||
finishLookup = () => resolve([{ repoId: "existing", source: { fullName: "owner/repo" }, options: {} }]);
|
||||
}),
|
||||
});
|
||||
const state = ui.window.document.querySelector("#sourceUrl")._field.binding.state;
|
||||
state.sourceUrl = "https://github.com/owner/repo";
|
||||
await state.urlSelected();
|
||||
state.sourceUrl = "invalid";
|
||||
await state.urlSelected();
|
||||
finishLookup();
|
||||
await delay(30);
|
||||
expect(state.previousConfigurations).to.have.length(0);
|
||||
expect(ui.errors).to.deep.equal([]);
|
||||
});
|
||||
|
||||
it("allows creation when duplicate lookup fails", async () => {
|
||||
ui = await browser("/anonymize", {
|
||||
...repositorySource,
|
||||
"/api/user/anonymized_repositories": { __status: 503, body: { error: "unavailable" } },
|
||||
});
|
||||
const state = ui.window.document.querySelector("#sourceUrl")._field.binding.state;
|
||||
state.sourceUrl = "https://github.com/owner/repo";
|
||||
await state.urlSelected();
|
||||
await delay(30);
|
||||
expect(state.previousConfigurations).to.have.length(0);
|
||||
expect(state.details.repo).to.equal("repo");
|
||||
expect(state.sourceLoading).to.equal(false);
|
||||
expect(ui.errors).to.deep.equal([]);
|
||||
});
|
||||
|
||||
it("keeps the current repository when earlier metadata and README responses arrive late", async () => {
|
||||
let finishMetadata, finishReadme;
|
||||
ui = await browser("/anonymize", {
|
||||
|
||||
Reference in new issue
Block a user