mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-10-01 06:19:33 +02:00
Merge pull request #852 from tdurieux/fix/reconnect-recreated-repository
fix: reconnect anonymizations to recreated source repositories
This commit is contained in:
7 files changed
+284
-30
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"core.min.js": "core.3b07189932.min.js",
|
||||
"vendor.min.js": "vendor.3036803e29.min.js",
|
||||
"vendor.min.js": "vendor.bc790a8831.min.js",
|
||||
"mermaid.min.js": "mermaid.f848a72d16.min.js",
|
||||
"all.min.css": "all.5fbafcda4e.min.css",
|
||||
"markdown.min.js": "markdown.44f2e93820.min.js",
|
||||
|
||||
@@ -106,6 +106,12 @@
|
||||
<div class="repo-access-note"><span v-if="detectedType !== 'gist' && githubConnection !== 'oauth'">Select repositories on GitHub, then return here.</span><span><i class="fas fa-info-circle" aria-hidden="true"></i> Selected content will be published, including content from private repositories.</span></div>
|
||||
</aside>
|
||||
|
||||
<aside class="repo-access-details" v-if="isUpdate && detectedType === 'repo' && role === 'owner' && sourceUrl === 'https://github.com/' + _originalFullName">
|
||||
<p>If you deleted and recreated this repository, reconnect it before choosing a branch.</p>
|
||||
<button type="button" class="btn btn-outline-ink" @click="reconnectSource()">Reconnect source repository</button>
|
||||
<p v-if="reconnectRepositoryId" role="status">Source reloaded. Review the branch, commit, and anonymization preview, then save to replace the published snapshot.</p>
|
||||
</aside>
|
||||
|
||||
<div class="form-grid-2" v-if="detectedType === 'repo'">
|
||||
<div class="form-group">
|
||||
<label class="paper-field-label" for="branch">Branch</label>
|
||||
|
||||
+26
-4
@@ -1006,7 +1006,22 @@ export const anonymizeController = function (state, http, html, params, location
|
||||
return null;
|
||||
}
|
||||
|
||||
state.reconnectingSource = false;
|
||||
state.reconnectRepositoryId = undefined;
|
||||
state.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.")) return;
|
||||
state.reconnectingSource = true;
|
||||
state.reconnectRepositoryId = undefined;
|
||||
state.source.commit = "";
|
||||
state.source.branch = "";
|
||||
state.readme = "";
|
||||
state.branches = [];
|
||||
try { await getRepoDetails(); }
|
||||
catch (_) { /* getRepoDetails displays the access error. */ }
|
||||
};
|
||||
|
||||
function sourceRepositoryID() {
|
||||
if (state.reconnectingSource) return undefined;
|
||||
if (!state.isUpdate || !state._originalRepositoryID) return undefined;
|
||||
const currentFullName = parseRepoFullName(state.sourceUrl);
|
||||
return currentFullName === state._originalFullName
|
||||
@@ -1143,6 +1158,8 @@ export const anonymizeController = function (state, http, html, params, location
|
||||
|
||||
// URL change handler - auto-detect type
|
||||
state.urlSelected = async (preserveDraft = false) => {
|
||||
state.reconnectingSource = false;
|
||||
state.reconnectRepositoryId = undefined;
|
||||
if (!preserveDraft) state.terms = state.defaultTerms;
|
||||
if (!preserveDraft && !state.isUpdate) {
|
||||
state.repoId = "";
|
||||
@@ -1199,6 +1216,7 @@ export const anonymizeController = function (state, http, html, params, location
|
||||
// auto-update) used to bump the commit to GitHub HEAD because this
|
||||
// watcher overwrote it on edit-page load.
|
||||
const keepSavedCommit =
|
||||
!state.reconnectingSource &&
|
||||
state.isUpdate &&
|
||||
state._originalBranch === state.source.branch &&
|
||||
!!state.source.commit;
|
||||
@@ -1215,7 +1233,7 @@ export const anonymizeController = function (state, http, html, params, location
|
||||
const o = parseGithubUrl(state.sourceUrl);
|
||||
try {
|
||||
const branches = await http.get(`/api/repo/${o.owner}/${o.repo}/branches`, {
|
||||
params: { anonymizedRepoId: state.isUpdate && params.repoId && parseRepoFullName(state.sourceUrl) === state._originalFullName ? params.repoId : undefined, connection: state.githubConnection, force: force === true ? "1" : "0", repositoryID: sourceRepositoryID() },
|
||||
params: { reconnect: state.reconnectingSource ? "1" : undefined, anonymizedRepoId: state.isUpdate && params.repoId && parseRepoFullName(state.sourceUrl) === state._originalFullName ? params.repoId : undefined, connection: state.githubConnection, force: force === true || state.reconnectingSource ? "1" : "0", repositoryID: sourceRepositoryID() },
|
||||
});
|
||||
state.branches = branches.data;
|
||||
state.sourceUnreachable = false;
|
||||
@@ -1228,6 +1246,7 @@ export const anonymizeController = function (state, http, html, params, location
|
||||
// update the commit to the latest on the branch. Only preserve
|
||||
// the saved commit on the initial edit-page load (#360).
|
||||
const keepSavedCommit =
|
||||
!state.reconnectingSource &&
|
||||
!force &&
|
||||
state.isUpdate &&
|
||||
!state.options.update &&
|
||||
@@ -1263,16 +1282,17 @@ export const anonymizeController = function (state, http, html, params, location
|
||||
// #364) are reflected without waiting for the cached metadata to
|
||||
// expire. The endpoint hits the GitHub API once.
|
||||
const res = await http.get(`/api/repo/${o.owner}/${o.repo}/`, {
|
||||
params: { anonymizedRepoId: state.isUpdate && params.repoId && parseRepoFullName(state.sourceUrl) === state._originalFullName ? params.repoId : undefined, connection: state.githubConnection, repositoryID: sourceRepositoryID(), force: "1" },
|
||||
params: { reconnect: state.reconnectingSource ? "1" : undefined, anonymizedRepoId: state.isUpdate && params.repoId && parseRepoFullName(state.sourceUrl) === state._originalFullName ? params.repoId : undefined, connection: state.githubConnection, repositoryID: sourceRepositoryID(), force: "1" },
|
||||
});
|
||||
state.details = res.data;
|
||||
if (state.reconnectingSource) state.reconnectRepositoryId = state.details.externalId;
|
||||
if (state.details && state.details.id) {
|
||||
state.repositoryID = state.details.id;
|
||||
}
|
||||
if (!state.repoId) {
|
||||
state.repoId = state.details.repo + "-" + generateRandomId(4);
|
||||
}
|
||||
await state.getBranches();
|
||||
await state.getBranches(state.reconnectingSource);
|
||||
} catch (error) {
|
||||
if (error.data) {
|
||||
translate("ERRORS." + error.data.error).then((translation) => {
|
||||
@@ -1291,7 +1311,7 @@ export const anonymizeController = function (state, http, html, params, location
|
||||
const o = parseGithubUrl(state.sourceUrl);
|
||||
try {
|
||||
const res = await http.get(`/api/repo/${o.owner}/${o.repo}/readme`, {
|
||||
params: { anonymizedRepoId: state.isUpdate && params.repoId && parseRepoFullName(state.sourceUrl) === state._originalFullName ? params.repoId : undefined, connection: state.githubConnection, force: force === true ? "1" : "0", branch: state.source.branch, repositoryID: sourceRepositoryID() },
|
||||
params: { reconnect: state.reconnectingSource ? "1" : undefined, anonymizedRepoId: state.isUpdate && params.repoId && parseRepoFullName(state.sourceUrl) === state._originalFullName ? params.repoId : undefined, connection: state.githubConnection, force: force === true ? "1" : "0", branch: state.source.branch, repositoryID: sourceRepositoryID() },
|
||||
});
|
||||
state.readme = res.data;
|
||||
} catch (error) {
|
||||
@@ -1711,6 +1731,7 @@ export const anonymizeController = function (state, http, html, params, location
|
||||
|
||||
// Submit: repo
|
||||
state.anonymizeRepo = (event) => {
|
||||
if (state.reconnectingSource && !state.reconnectRepositoryId) return;
|
||||
if (expirationDateInvalid()) return;
|
||||
event.target.disabled = true;
|
||||
const o = parseGithubUrl(state.sourceUrl);
|
||||
@@ -1720,6 +1741,7 @@ export const anonymizeController = function (state, http, html, params, location
|
||||
connection: state.githubConnection,
|
||||
fullName: `${o.owner}/${o.repo}`,
|
||||
repository: state.sourceUrl,
|
||||
reconnectRepositoryId: state.reconnectRepositoryId,
|
||||
options: state.options,
|
||||
source: state.source,
|
||||
conference: state.conference,
|
||||
|
||||
Vendored
+14
-14
@@ -1,29 +1,29 @@
|
||||
"use strict";(()=>{var zl=Object.defineProperty;var Hl=(e,t)=>{for(var o in t)zl(e,o,{get:t[o],enumerable:!0})};var ye={notebook:"/script/notebook.c3144c18ae.min.js",org:"/script/org.f61f262915.min.js",markdown:"/script/markdown.44f2e93820.min.js",editor:"/script/editor.4f142d3adc.min.js",pdf:"/script/pdf.0175d53d2f.min.js"};var rn=new Map,Gl=ye;function Wt(e){if(!rn.has(e)){let t=document.createElement("script");t.src=Gl[e];let o=new Promise((r,n)=>{t.onload=r,t.onerror=()=>{rn.delete(e),t.remove(),n(new Error(`Unable to load ${e}. Please retry.`))}});rn.set(e,o),document.head.appendChild(t)}return rn.get(e)}async function tr(){await Wt("editor"),ace.config.set("basePath","/script/external/ace/")}function ds(e){let t=Object.create(null);for(let o of e.split(","))t[o]=1;return o=>o in t}var Me={},Kt=[],rt=()=>{},Xn=()=>!1,us=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),cs=e=>e.startsWith("onUpdate:"),Ge=Object.assign,Ss=(e,t)=>{let o=e.indexOf(t);o>-1&&e.splice(o,1)},jl=Object.prototype.hasOwnProperty,Ae=(e,t)=>jl.call(e,t),Ee=Array.isArray,Pt=e=>Ds(e)==="[object Map]",ls=e=>Ds(e)==="[object Set]",sr=e=>Ds(e)==="[object Date]";var _e=e=>typeof e=="function",Fe=e=>typeof e=="string",ct=e=>typeof e=="symbol",Ve=e=>e!==null&&typeof e=="object",Zn=e=>(Ve(e)||_e(e))&&_e(e.then)&&_e(e.catch),rr=Object.prototype.toString,Ds=e=>rr.call(e),xn=e=>Ds(e).slice(8,-1),an=e=>Ds(e)==="[object Object]",ln=e=>Fe(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,ps=ds(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");var dn=e=>{let t=Object.create(null);return(o=>t[o]||(t[o]=e(o)))},Wl=/-\w/g,Ke=dn(e=>e.replace(Wl,t=>t.slice(1).toUpperCase())),Kl=/\B([A-Z])/g,qt=dn(e=>e.replace(Kl,"-$1").toLowerCase()),Yt=dn(e=>e.charAt(0).toUpperCase()+e.slice(1)),Rs=dn(e=>e?`on${Yt(e)}`:""),ht=(e,t)=>!Object.is(e,t),Ts=(e,...t)=>{for(let o=0;o<e.length;o++)e[o](...t)},un=(e,t,o,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:o})},eo=e=>{let t=parseFloat(e);return isNaN(t)?e:t};var nr,Os=()=>nr||(nr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Pe(e){if(Ee(e)){let t={};for(let o=0;o<e.length;o++){let r=e[o],n=Fe(r)?Xl(r):Pe(r);if(n)for(let i in n)t[i]=n[i]}return t}else if(Fe(e)||Ve(e))return e}var Yl=/;(?![^(]*\))/g,Jl=/:([^]+)/,Ql=/\/\*[^]*?\*\//g;function Xl(e){let t={};return e.replace(Ql,"").split(Yl).forEach(o=>{if(o){let r=o.split(Jl);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function O(e){let t="";if(Fe(e))t=e;else if(Ee(e))for(let o=0;o<e.length;o++){let r=O(e[o]);r&&(t+=r+" ")}else if(Ve(e))for(let o in e)e[o]&&(t+=o+" ");return t.trim()}var ir="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",ar=ds(ir),Zl=ds(ir+",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");function cn(e){return!!e||e===""}function xl(e,t){if(e.length!==t.length)return!1;let o=!0;for(let r=0;o&&r<e.length;r++)o=fs(e[r],t[r]);return o}function or(e,t){if(e.size!==t.size)return!1;let o=Array.from(t),r=new Uint8Array(o.length);for(let n of e){let i=-1;for(let a=0;a<o.length;a++)if(!r[a]&&fs(n,o[a])){i=a;break}if(i<0)return!1;r[i]=1}return!0}function fs(e,t){if(e===t)return!0;let o=sr(e),r=sr(t);if(o||r)return o&&r?e.getTime()===t.getTime():!1;if(o=ct(e),r=ct(t),o||r)return e===t;if(o=Ee(e),r=Ee(t),o||r)return o&&r?xl(e,t):!1;if(o=Ve(e),r=Ve(t),o||r){if(!o||!r)return!1;if(o=Pt(e),r=Pt(t),o||r||(o=ls(e),r=ls(t),o||r))return o&&r?or(e,t):!1;let n=Object.keys(e).length,i=Object.keys(t).length;if(n!==i)return!1;for(let a in e){let u=e.hasOwnProperty(a),m=t.hasOwnProperty(a);if(u&&!m||!u&&m||!fs(e[a],t[a]))return!1}}return String(e)===String(t)}var lr=e=>!!(e&&e.__v_isRef===!0),c=e=>Fe(e)?e:e==null?"":Ee(e)||Ve(e)&&(e.toString===rr||!_e(e.toString))?lr(e)?c(e.value):JSON.stringify(e,dr,2):String(e),dr=(e,t)=>lr(t)?dr(e,t.value):Pt(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((o,[r,n],i)=>(o[Qn(r,i)+" =>"]=n,o),{})}:ls(t)?{[`Set(${t.size})`]:[...t.values()].map(o=>Qn(o))}:ct(t)?Qn(t):Ve(t)&&!Ee(t)&&!an(t)?String(t):t,Qn=(e,t="")=>{var o;return ct(e)?`Symbol(${(o=e.description)!=null?o:t})`:e};function ed(e,...t){console.warn(`[Vue warn] ${e}`,...t)}var Ye,Ps=class{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&Ye&&(Ye.active?(this.parent=Ye,this.index=(Ye.scopes||(Ye.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,o;if(this.scopes){let r=this.scopes.slice();for(t=0,o=r.length;t<o;t++)r[t].pause()}for(t=0,o=this.effects.length;t<o;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!Line truncated
|
||||
"use strict";(()=>{var zl=Object.defineProperty;var Hl=(e,t)=>{for(var o in t)zl(e,o,{get:t[o],enumerable:!0})};var ye={notebook:"/script/notebook.c3144c18ae.min.js",org:"/script/org.f61f262915.min.js",markdown:"/script/markdown.44f2e93820.min.js",pdf:"/script/pdf.0175d53d2f.min.js",editor:"/script/editor.4f142d3adc.min.js"};var rn=new Map,Gl=ye;function Wt(e){if(!rn.has(e)){let t=document.createElement("script");t.src=Gl[e];let o=new Promise((r,n)=>{t.onload=r,t.onerror=()=>{rn.delete(e),t.remove(),n(new Error(`Unable to load ${e}. Please retry.`))}});rn.set(e,o),document.head.appendChild(t)}return rn.get(e)}async function tr(){await Wt("editor"),ace.config.set("basePath","/script/external/ace/")}function ds(e){let t=Object.create(null);for(let o of e.split(","))t[o]=1;return o=>o in t}var Me={},Kt=[],rt=()=>{},Xn=()=>!1,us=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),cs=e=>e.startsWith("onUpdate:"),Ge=Object.assign,Ss=(e,t)=>{let o=e.indexOf(t);o>-1&&e.splice(o,1)},jl=Object.prototype.hasOwnProperty,Ae=(e,t)=>jl.call(e,t),Ee=Array.isArray,Pt=e=>Ds(e)==="[object Map]",ls=e=>Ds(e)==="[object Set]",sr=e=>Ds(e)==="[object Date]";var _e=e=>typeof e=="function",Fe=e=>typeof e=="string",ct=e=>typeof e=="symbol",Ve=e=>e!==null&&typeof e=="object",Zn=e=>(Ve(e)||_e(e))&&_e(e.then)&&_e(e.catch),rr=Object.prototype.toString,Ds=e=>rr.call(e),xn=e=>Ds(e).slice(8,-1),an=e=>Ds(e)==="[object Object]",ln=e=>Fe(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,ps=ds(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");var dn=e=>{let t=Object.create(null);return(o=>t[o]||(t[o]=e(o)))},Wl=/-\w/g,Ke=dn(e=>e.replace(Wl,t=>t.slice(1).toUpperCase())),Kl=/\B([A-Z])/g,qt=dn(e=>e.replace(Kl,"-$1").toLowerCase()),Yt=dn(e=>e.charAt(0).toUpperCase()+e.slice(1)),Rs=dn(e=>e?`on${Yt(e)}`:""),ht=(e,t)=>!Object.is(e,t),Ts=(e,...t)=>{for(let o=0;o<e.length;o++)e[o](...t)},un=(e,t,o,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:o})},eo=e=>{let t=parseFloat(e);return isNaN(t)?e:t};var nr,Os=()=>nr||(nr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Pe(e){if(Ee(e)){let t={};for(let o=0;o<e.length;o++){let r=e[o],n=Fe(r)?Xl(r):Pe(r);if(n)for(let i in n)t[i]=n[i]}return t}else if(Fe(e)||Ve(e))return e}var Yl=/;(?![^(]*\))/g,Jl=/:([^]+)/,Ql=/\/\*[^]*?\*\//g;function Xl(e){let t={};return e.replace(Ql,"").split(Yl).forEach(o=>{if(o){let r=o.split(Jl);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function O(e){let t="";if(Fe(e))t=e;else if(Ee(e))for(let o=0;o<e.length;o++){let r=O(e[o]);r&&(t+=r+" ")}else if(Ve(e))for(let o in e)e[o]&&(t+=o+" ");return t.trim()}var ir="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",ar=ds(ir),Zl=ds(ir+",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");function cn(e){return!!e||e===""}function xl(e,t){if(e.length!==t.length)return!1;let o=!0;for(let r=0;o&&r<e.length;r++)o=fs(e[r],t[r]);return o}function or(e,t){if(e.size!==t.size)return!1;let o=Array.from(t),r=new Uint8Array(o.length);for(let n of e){let i=-1;for(let a=0;a<o.length;a++)if(!r[a]&&fs(n,o[a])){i=a;break}if(i<0)return!1;r[i]=1}return!0}function fs(e,t){if(e===t)return!0;let o=sr(e),r=sr(t);if(o||r)return o&&r?e.getTime()===t.getTime():!1;if(o=ct(e),r=ct(t),o||r)return e===t;if(o=Ee(e),r=Ee(t),o||r)return o&&r?xl(e,t):!1;if(o=Ve(e),r=Ve(t),o||r){if(!o||!r)return!1;if(o=Pt(e),r=Pt(t),o||r||(o=ls(e),r=ls(t),o||r))return o&&r?or(e,t):!1;let n=Object.keys(e).length,i=Object.keys(t).length;if(n!==i)return!1;for(let a in e){let u=e.hasOwnProperty(a),m=t.hasOwnProperty(a);if(u&&!m||!u&&m||!fs(e[a],t[a]))return!1}}return String(e)===String(t)}var lr=e=>!!(e&&e.__v_isRef===!0),c=e=>Fe(e)?e:e==null?"":Ee(e)||Ve(e)&&(e.toString===rr||!_e(e.toString))?lr(e)?c(e.value):JSON.stringify(e,dr,2):String(e),dr=(e,t)=>lr(t)?dr(e,t.value):Pt(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((o,[r,n],i)=>(o[Qn(r,i)+" =>"]=n,o),{})}:ls(t)?{[`Set(${t.size})`]:[...t.values()].map(o=>Qn(o))}:ct(t)?Qn(t):Ve(t)&&!Ee(t)&&!an(t)?String(t):t,Qn=(e,t="")=>{var o;return ct(e)?`Symbol(${(o=e.description)!=null?o:t})`:e};function ed(e,...t){console.warn(`[Vue warn] ${e}`,...t)}var Ye,Ps=class{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&Ye&&(Ye.active?(this.parent=Ye,this.index=(Ye.scopes||(Ye.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,o;if(this.scopes){let r=this.scopes.slice();for(t=0,o=r.length;t<o;t++)r[t].pause()}for(t=0,o=this.effects.length;t<o;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!Line 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 "${vc(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 os(e,t){return qe(new Error,{type:e,[na]:!0},t)}function Vt(e,t){return e instanceof Error&&na in e&&(t==null||!!(e.type&t))}var hc=["params","query","hash"];function vc(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let o of hc)o in e&&(t[o]=e[o]);return JSON.stringify(t,null,2)}function oa(e){let t={};if(e===""||e==="?")return t;let o=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<o.length;++r){let n=o[r].replace(Gi," "),i=n.indexOf("="),a=_s(i<0?n:n.slice(0,i)),u=i<0?null:_s(n.slice(i+1));if(a in t){let m=t[a];gt(m)||(m=t[a]=[m]),m.push(u)}else t[a]=u}return t}function Go(e){let t="";for(let o in e){let r=e[o];if(o=ic(o),r==null){r!==void 0&&(t+=(t.length?"&":"")+o);continue}(gt(r)?r.map(n=>n&&Mo(n)):[r&&Mo(r)]).forEach(n=>{n!==void 0&&(t+=(t.length?"&":"")+o,n!=null&&(t+="="+n))})}return t}function ra(e){let t={};for(let o in e){let r=e[o];r!==void 0&&(t[o]=gt(r)?r.map(n=>n==null?null:""+n):r==null?r:""+r)}return t}var ia=Symbol(""),jo=Symbol(""),Gn=Symbol(""),jn=Symbol(""),Wn=Symbol("");function Cs(){let e=[];function t(r){return e.push(r),()=>{let n=e.indexOf(r);n>-1&&e.splice(n,1)}}function o(){e=[]}return{add:t,list:()=>e.slice(),reset:o}}function Bt(e,t,o,r,n,i=a=>a()){let a=r&&(r.enterCallbacks[n]=r.enterCallbacks[n]||[]);return()=>new Promise((u,m)=>{let h=p=>{p===!1?m(os(Be.NAVIGATION_ABORTED,{from:o,to:t})):p instanceof Error?m(p):mc(p)?m(os(Be.NAVIGATION_GUARD_REDIRECT,{from:t,to:p})):(a&&r.enterCallbacks[n]===a&&typeof p=="function"&&a.push(p),u())},v=i(()=>e.call(r&&r.instances[n],t,o,h)),k=Promise.resolve(v);e.length<3&&(k=k.then(h)),k.catch(p=>m(p))})}function Kn(e,t,o,r,n=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(Hi(m)){let h=(m.__vccOpts||m)[t];h&&i.push(Bt(h,o,r,a,u,n))}else{let h=m();i.push(()=>h.then(v=>{if(!v)throw new Error(`Couldn't resolve component "${u}" at "${a.path}"`);let k=Qu(v)?v.default:v;a.mods[u]=v,a.components[u]=k;let p=(k.__vccOpts||k)[t];return p&&Bt(p,o,r,a,u,n)()}))}}return i}function aa(e,t){let o=[],r=[],n=[],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(h=>ns(h,u))?r.push(u):o.push(u));let m=e.matched[a];m&&(t.matched.find(h=>ns(h,m))||n.push(m))}return[o,r,n]}var yc=()=>location.protocol+"//"+location.host;function ga(e,t){let{pathname:o,search:r,hash:n}=t,i=e.indexOf("#");if(i>-1){let a=n.includes(e.slice(i))?e.slice(i).length:1,u=n.slice(a);return u[0]!=="/"&&(u="/"+u),Fo(u,"")}return Fo(o,e)+r+n}function gc(e,t,o,r){let n=[],i=[],a=null,u=({state:p})=>{let g=ga(e,location),w=o.value,b=t.value,T=0;if(p){if(o.value=g,t.value=p,a&&a===w){a=null;return}T=b?p.position-b.position:0}else r(g);n.forEach(N=>{N(o.value,w,{delta:T,type:Hn.pop,direction:T?T>0?Bn.forward:Bn.back:Bn.unknown})})};function m(){a=o.value}function h(p){n.push(p);let g=()=>{let w=n.indexOf(p);w>-1&&n.splice(w,1)};return i.push(g),g}function v(){if(document.visibilityState==="hidden"){let{history:p}=window;if(!p.state)return;p.replaceState(qe({},p.state,{scroll:on()}),"")}}function k(){for(let p of i)p();i=[],window.removeEventListener("popstate",u),window.removeEventListener("pagehide",v),document.removeEventListener("visibilitychange",v)}return window.addEventListener("popstate",u),window.addEventListener("pagehide",v),document.addEventListener("visibilitychange",v),{pauseListeners:m,listen:h,destroy:k}}function la(e,t,o,r=!1,n=!1){return{back:e,current:t,forward:o,replaced:r,position:window.history.length,scroll:n?on():null}}function bc(e){let{history:t,location:o}=window,r={value:ga(e,o)},n={value:t.state};n.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(m,h,v){let k=e.indexOf("#"),p=k>-1?(o.host&&document.querySelector("base")?e:e.slice(k))+m:yc()+e+m;try{t[v?"replaceState":"pushState"](h,"",p),n.value=h}catch(g){console.error(g),o[v?"replace":"assign"](p)}}function a(m,h){i(m,qe({},t.state,la(n.value.back,m,n.value.forward,!0),h,{position:n.value.position}),!0),r.value=m}function u(m,h){let v=qe({},n.value,t.state,{forward:m,scroll:on()});i(v.current,v,!0),i(m,qe({},la(r.value,m,null),{position:v.position+1},h),!1),r.value=m}return{location:r,state:n,push:u,replace:a}}function ba(e){e=Zi(e);let t=bc(e),o=gc(e,t.state,t.location,t.replace);function r(i,a=!0){a||o.pauseListeners(),history.go(i)}let n=qe({locatLine truncated
|
||||
`+JSON.stringify(t):""}`},[Be.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${vc(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 os(e,t){return qe(new Error,{type:e,[na]:!0},t)}function Vt(e,t){return e instanceof Error&&na in e&&(t==null||!!(e.type&t))}var hc=["params","query","hash"];function vc(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let o of hc)o in e&&(t[o]=e[o]);return JSON.stringify(t,null,2)}function oa(e){let t={};if(e===""||e==="?")return t;let o=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<o.length;++r){let n=o[r].replace(Gi," "),i=n.indexOf("="),a=_s(i<0?n:n.slice(0,i)),u=i<0?null:_s(n.slice(i+1));if(a in t){let m=t[a];gt(m)||(m=t[a]=[m]),m.push(u)}else t[a]=u}return t}function Go(e){let t="";for(let o in e){let r=e[o];if(o=ic(o),r==null){r!==void 0&&(t+=(t.length?"&":"")+o);continue}(gt(r)?r.map(n=>n&&Mo(n)):[r&&Mo(r)]).forEach(n=>{n!==void 0&&(t+=(t.length?"&":"")+o,n!=null&&(t+="="+n))})}return t}function ra(e){let t={};for(let o in e){let r=e[o];r!==void 0&&(t[o]=gt(r)?r.map(n=>n==null?null:""+n):r==null?r:""+r)}return t}var ia=Symbol(""),jo=Symbol(""),Gn=Symbol(""),jn=Symbol(""),Wn=Symbol("");function Cs(){let e=[];function t(r){return e.push(r),()=>{let n=e.indexOf(r);n>-1&&e.splice(n,1)}}function o(){e=[]}return{add:t,list:()=>e.slice(),reset:o}}function Bt(e,t,o,r,n,i=a=>a()){let a=r&&(r.enterCallbacks[n]=r.enterCallbacks[n]||[]);return()=>new Promise((u,m)=>{let h=p=>{p===!1?m(os(Be.NAVIGATION_ABORTED,{from:o,to:t})):p instanceof Error?m(p):mc(p)?m(os(Be.NAVIGATION_GUARD_REDIRECT,{from:t,to:p})):(a&&r.enterCallbacks[n]===a&&typeof p=="function"&&a.push(p),u())},v=i(()=>e.call(r&&r.instances[n],t,o,h)),k=Promise.resolve(v);e.length<3&&(k=k.then(h)),k.catch(p=>m(p))})}function Kn(e,t,o,r,n=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(Hi(m)){let h=(m.__vccOpts||m)[t];h&&i.push(Bt(h,o,r,a,u,n))}else{let h=m();i.push(()=>h.then(v=>{if(!v)throw new Error(`Couldn't resolve component "${u}" at "${a.path}"`);let k=Qu(v)?v.default:v;a.mods[u]=v,a.components[u]=k;let p=(k.__vccOpts||k)[t];return p&&Bt(p,o,r,a,u,n)()}))}}return i}function aa(e,t){let o=[],r=[],n=[],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(h=>ns(h,u))?r.push(u):o.push(u));let m=e.matched[a];m&&(t.matched.find(h=>ns(h,m))||n.push(m))}return[o,r,n]}var yc=()=>location.protocol+"//"+location.host;function ga(e,t){let{pathname:o,search:r,hash:n}=t,i=e.indexOf("#");if(i>-1){let a=n.includes(e.slice(i))?e.slice(i).length:1,u=n.slice(a);return u[0]!=="/"&&(u="/"+u),Fo(u,"")}return Fo(o,e)+r+n}function gc(e,t,o,r){let n=[],i=[],a=null,u=({state:p})=>{let g=ga(e,location),w=o.value,b=t.value,T=0;if(p){if(o.value=g,t.value=p,a&&a===w){a=null;return}T=b?p.position-b.position:0}else r(g);n.forEach(N=>{N(o.value,w,{delta:T,type:Hn.pop,direction:T?T>0?Bn.forward:Bn.back:Bn.unknown})})};function m(){a=o.value}function h(p){n.push(p);let g=()=>{let w=n.indexOf(p);w>-1&&n.splice(w,1)};return i.push(g),g}function v(){if(document.visibilityState==="hidden"){let{history:p}=window;if(!p.state)return;p.replaceState(qe({},p.state,{scroll:on()}),"")}}function k(){for(let p of i)p();i=[],window.removeEventListener("popstate",u),window.removeEventListener("pagehide",v),document.removeEventListener("visibilitychange",v)}return window.addEventListener("popstate",u),window.addEventListener("pagehide",v),document.addEventListener("visibilitychange",v),{pauseListeners:m,listen:h,destroy:k}}function la(e,t,o,r=!1,n=!1){return{back:e,current:t,forward:o,replaced:r,position:window.history.length,scroll:n?on():null}}function bc(e){let{history:t,location:o}=window,r={value:ga(e,o)},n={value:t.state};n.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(m,h,v){let k=e.indexOf("#"),p=k>-1?(o.host&&document.querySelector("base")?e:e.slice(k))+m:yc()+e+m;try{t[v?"replaceState":"pushState"](h,"",p),n.value=h}catch(g){console.error(g),o[v?"replace":"assign"](p)}}function a(m,h){i(m,qe({},t.state,la(n.value.back,m,n.value.forward,!0),h,{position:n.value.position}),!0),r.value=m}function u(m,h){let v=qe({},n.value,t.state,{forward:m,scroll:on()});i(v.current,v,!0),i(m,qe({},la(r.value,m,null),{position:v.position+1},h),!1),r.value=m}return{location:r,state:n,push:u,replace:a}}function ba(e){e=Zi(e);let t=bc(e),o=gc(e,t.state,t.location,t.replace);function r(i,a=!0){a||o.pauseListeners(),history.go(i)}let n=qe({locatLine truncated
|
||||
`)),e.options=Object.assign({},e.options,m.options)})}i();let a=null;e.saveDefault=u=>{u&&u.preventDefault&&u.preventDefault();let m={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",m).then(()=>{i(),e.saving=!1,e.message="Saved",a&&r.cancel(a),a=r(()=>{e.message=null},2500)},h=>{e.saving=!1;let v=h&&h.data&&h.data.error;o("ERRORS."+v).then(k=>{e.error=k},()=>{e.error="Unable to save your defaults. Please try again."})})},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."}))}},Ra=function(e,t,o){e.repoId=null,e.repoUrl=null,e.claim=()=>{t.post("/api/repo/claim",{repoId:e.repoId,repoUrl:e.repoUrl}).then(r=>{o.url("/dashboard")},r=>{e.error=r.data,e.claimForm.repoUrl.setValidity("not_found",!1),e.claimForm.repoId.setValidity("not_found",!1)})}},Ta=function(e,t,o,r,n){e.user&&!e.user.status&&o.url("/dashboard"),e.watch("user.status",()=>{e.user&&!e.user.status&&o.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 h={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:"first",End:"last"}[u.key];if(h===void 0)return;u.preventDefault();let v=e.features.length,k=h==="first"?0:h==="last"?v-1:(m+h+v)%v;e.feature=e.features[k].key,n(()=>{let p=r.document.getElementById("feature-tab-"+e.feature);p&&p.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 h=new Array(u.length-1);for(let b=1;b<u.length;b++)h[b-1]=u[b]-u[b-1];let v=h.length,k=Math.max.apply(null,h),p=Math.min.apply(null,h),g=Math.min(0,p),w=k-g||1;m.viewW=v*2,m.bars=new Array(v);for(let b=0;b<v;b++){let T=(h[b]-g)/w,N=Math.max(1.5,T*34);m.bars[b]={x:(b*2+.25).toFixed(2),y:(36-N).toFixed(2),w:"1.5",h:N.toFixed(2)}}if(m.deltaToday=h[v-1],v>=2){let b=h[v-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(h=>h.nbRepositories||0)),users:a(m.map(h=>h.nbUsers||0)),pageViews:a(m.map(h=>h.nbPageViews||0)),pullRequests:a(m.map(h=>h.nbPullRequests||0))}})},Oa=function(e,t,o,r,n,i){let a=mt();e.on("routeLeave",function(){$('[data-toggle="tooltip"]').tooltip("dispose")}),e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null&&o.url("/"),a.timeout(()=>{$('[data-toggle="tooltip"]').tooltip()},250),e.items=[],e.search="",e.loading=!0,e.statusKeyLabels={ready:"Ready",progress:"In progress",error:"Error",expired:"Expired",removed:"Removed"};let u=["queue","download","downloaded","preparing","anonymizing"];function m(C){return C==="ready"||C==="error"?C:C==="expired"||C==="expiring"?"expired":C==="
Line truncated
|
||||
`)),e.options=Object.assign({},e.options,W.options),e.options.expirationDate=W.options&&W.options.expirationDate?new Date(W.options.expirationDate):m(),D&&D()})}function p(D,V,W){e.anonymize&&e.anonymize[D]&&e.anonymize[D].setValidity(V,W)}function g(D){try{let V=parseGithubUrl(D);if(V&&V.owner&&V.repo)return V.owner+"/"+V.repo}catch{}return null}function w(){return!e.isUpdate||!e._originalRepositoryID?void 0:g(e.sourceUrl)===e._originalFullName?e._originalRepositoryID:void 0}async function b(){e._preservingDraft=!0;try{await e.urlSelected(!0)}finally{e._preservingDraft=!1}}async function T(){let D;try{D=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!D||D.path!==n.path()||Date.now()-D.savedAt>=30*6e4)return!1;for(let V of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(D.draft,V)&&(e[V]=D.draft[V]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await b(),sessionStorage.removeItem("github-access-draft"),!0}k(()=>{!r.repoId&&!r.pullRequestId&&!r.gistId&&a(T,0),r.repoId&&r.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=r.repoId,t.get("/api/repo/"+e.repoId).then(async D=>{e.githubConnection=D.data.connection||"oauth",e.sourceUrl="https://github.com/"+D.data.source.fullName,e._originalFullName=D.data.source.fullName,e.terms=D.data.options.terms.filter(V=>V).join(`
|
||||
`)),e.options=Object.assign({},e.options,W.options),e.options.expirationDate=W.options&&W.options.expirationDate?new Date(W.options.expirationDate):m(),D&&D()})}function p(D,V,W){e.anonymize&&e.anonymize[D]&&e.anonymize[D].setValidity(V,W)}function g(D){try{let V=parseGithubUrl(D);if(V&&V.owner&&V.repo)return V.owner+"/"+V.repo}catch{}return null}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 N()}catch{}}};function w(){return e.reconnectingSource||!e.isUpdate||!e._originalRepositoryID?void 0:g(e.sourceUrl)===e._originalFullName?e._originalRepositoryID:void 0}async function b(){e._preservingDraft=!0;try{await e.urlSelected(!0)}finally{e._preservingDraft=!1}}async function T(){let D;try{D=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!D||D.path!==n.path()||Date.now()-D.savedAt>=30*6e4)return!1;for(let V of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(D.draft,V)&&(e[V]=D.draft[V]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await b(),sessionStorage.removeItem("github-access-draft"),!0}k(()=>{!r.repoId&&!r.pullRequestId&&!r.gistId&&a(T,0),r.repoId&&r.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=r.repoId,t.get("/api/repo/"+e.repoId).then(async D=>{e.githubConnection=D.data.connection||"oauth",e.sourceUrl="https://github.com/"+D.data.source.fullName,e._originalFullName=D.data.source.fullName,e.terms=D.data.options.terms.filter(V=>V).join(`
|
||||
`),e.source=D.data.source,e.role=D.data.role||"owner",e.coauthors=D.data.coauthors||[],e._originalBranch=D.data.source.branch,e.options=Object.assign({},e.options,D.data.options),e.conference=D.data.conference,e._originalConference=D.data.conference,e.repositoryID=D.data.source.repositoryID,e._originalRepositoryID=D.data.source.repositoryID,D.data.options.expirationDate&&(e.options.expirationDate=new Date(D.data.options.expirationDate)),!await T()&&(await Promise.all([N(),R()]),P())},()=>{n.url("/404")})),r.pullRequestId&&r.pullRequestId!=""&&(e.isUpdate=!0,e.detectedType="pr",e.pullRequestId=r.pullRequestId,t.get("/api/pr/"+e.pullRequestId).then(async D=>{if(e.githubConnection=D.data.connection||"oauth",e.sourceUrl="https://github.com/"+D.data.source.repositoryFullName+"/pull/"+D.data.source.pullRequestId,e.terms=D.data.options.terms.filter(V=>V).join(`
|
||||
`),e.source=D.data.source,e.options=Object.assign({},e.options,D.data.options),e.conference=D.data.conference,e._originalConference=D.data.conference,D.data.options.expirationDate&&(e.options.expirationDate=new Date(D.data.options.expirationDate)),!await T())try{e.details=(await t.get(`/api/pr/${D.data.source.repositoryFullName}/${D.data.source.pullRequestId}`,{params:{connection:e.githubConnection}})).data}catch(V){let W=V&&V.data&&V.data.error;W&&(i("ERRORS."+W).then(oe=>{e.addToast({title:"Error",date:new Date,body:oe}),e.error=oe},console.error),Se(W))}},()=>{n.url("/404")})),r.gistId&&r.gistId!=""&&(e.isUpdate=!0,e.detectedType="gist",e.gistId=r.gistId,t.get("/api/gist/"+e.gistId).then(async D=>{e.sourceUrl="https://gist.github.com/"+D.data.source.gistId,e.terms=D.data.options.terms.filter(V=>V).join(`
|
||||
`),e.source=D.data.source,e.options=Object.assign({},e.options,D.data.options),e.conference=D.data.conference,e._originalConference=D.data.conference,D.data.options.expirationDate&&(e.options.expirationDate=new Date(D.data.options.expirationDate)),!await T()&&await se()},()=>{n.url("/404")}))}),t.get("/github/connections").then(D=>{e.githubConnections=D.data,!r.repoId&&!r.pullRequestId&&!r.gistId&&e.githubConnection===void 0&&D.data.appEnabled&&D.data.appConnected&&(e.githubConnection="github-app")}).catch(()=>{}),e.urlSelected=async(D=!1)=>{D||(e.terms=e.defaultTerms),!D&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],D||(e.source={type:"GitHubStream",branch:"",commit:""}),e.anonymize_readme="",e.readme="",e.html_readme="",e.detectedType=null,e.gistOAuthRequired=!1;let V;try{V=parseGithubUrl(e.sourceUrl)}catch{p("sourceUrl","github",!1);return}p("sourceUrl","github",!0);try{V.gistId&&!V.repo?(e.detectedType="gist",e.source={gistId:V.gistId},await se()):V.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:V.owner+"/"+V.repo,pullRequestId:V.pullRequestId},await Z()):(e.detectedType="repo",await Promise.all([N(),R()]),P())}catch{return}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let D=e.branches.filter(W=>W.name==e.source.branch)[0];if(!D)return;!(e.isUpdate&&e._originalBranch===e.source.branch&&!!e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=D.commit),e.readme=D.readme,await R(),P()}),e.getBranches=async D=>{let V=parseGithubUrl(e.sourceUrl);try{let W=await t.get(`/api/repo/${V.owner}/${V.repo}/branches`,{params:{anonymizedRepoId:e.isUpdate&&r.repoId&&g(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:D===!0?"1":"0",repositoryID:w()}});e.branches=W.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let oe=e.branches.filter(le=>le.name==e.source.branch);oe.length>0&&(!(!D&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=oe[0].commit),e.readme=oe[0].readme,await R(D))}catch(W){e.branches=[],e.sourceUnreachable=W&&(W.status===404||W.data&&W.data.error==="repo_not_found");let oe=W&&W.data&&W.data.error||(W&&W.status===404?"repo_not_found":"unknown_error");i("ERRORS."+oe).then(le=>{e.toasts=e.toasts||[],e.addToast({title:"Error",date:new Date,body:le}),e.error=le},console.error),typeof p=="function"&&p("sourceUrl","missing",!1)}};async function N(){let D=parseGithubUrl(e.sourceUrl);try{Te();let V=await t.get(`/api/repo/${D.owner}/${D.repo}/`,{params:{anonymizedRepoId:e.isUpdate&&r.repoId&&g(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,repositoryID:w(),force:"1"}});e.details=V.data,e.details&&e.details.id&&(e.repositoryID=e.details.id),e.repoId||(e.repoId=e.details.repo+"-"+generateRandomId(4)),await e.getBranches()}catch(V){throw V.data&&(i("ERRORS."+V.data.error).then(W=>{e.addToast({title:"Error",date:new Date,body:W}),e.error=W},console.error),Se(V.data.error)),p("sourceUrl","missing",!1),V}}async function R(D){if(e.readme&&!D)return e.readme;let V=parseGithubUrl(e.sourceUrl);try{let W=await t.get(`/api/repo/${V.owner}/${V.repo}/readme`,{params:{anonymizedRepoId:e.isUpdate&&r.repoId&&g(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:D===!0?"1":"0",branch:e.source.branch,repositoryID:w()}});e.readme=W.data}catch{e.readme=""}}function I(){let D={terms:e.terms?e.terms.split(`
|
||||
`):[],image:!!e.options.image,link:!!e.options.link,repoId:e.repoId};e.source&&e.source.branch&&(D.branchName=e.source.branch);try{let V=parseGithubUrl(e.sourceUrl);D.repoName=`${V.owner}/${V.repo}`}catch{}return D}function C(D,V){let W=null,oe=0;return function(){W&&a.cancel(W),W=a(()=>{W=null;let L=++oe,te=D();te&&t.post("/api/anonymize-preview",te).then(U=>{L===oe&&V(U.data)},()=>{})},200)}}let A=C(()=>e.readme?{content:e.readme,options:I()}:null,D=>{e.anonymize_readme=D.content||"";let V="";try{let oe=parseGithubUrl(e.sourceUrl),le=e.source.branch||e.details&&e.details.defaultBranch||"main";V=`https://github.com/${oe.owner}/${oe.repo}/raw/${le}/`}catch{}let W=renderMD(e.anonymize_readme,V);e.html_readme=W,a(Prism.highlightAll,150)});function P(){!e.anonymize||!e.anonymize.terms||(e.termsRegexWarning=!!e.terms&&!!e.terms.match(/[-[\]{}()*+?.,\\^$|#]/g),A())}async function Z(){let D=parseGithubUrl(e.sourceUrl);try{Te();let V=await t.get(`/api/pr/${D.owner}/${D.repo}/${D.pullRequestId}`,{params:{connection:e.githubConnection}});e.details=V.data,e.pullRequestId||(e.pullRequestId=D.repo+"-PR"+D.pullRequestId+"-"+generateRandomId(4))}catch(V){throw V.data&&(i("ERRORS."+V.data.error).then(W=>{e.addToast({title:"Error",date:new Date,body:W}),e.error=W},console.error),Se(V.data.error)),p("sourceUrl","missing",!1),V}}let Y=ze(new Map),j=new Set;function z(){let D=new Set,V=e.details&&e.details.pullRequest;if(!V)return D;typeof V.title=="string"&&D.add(V.title),typeof V.body=="string"&&D.add(V.body),typeof V.diff=="string"&&D.add(V.diff);let W=V.comments||[];for(let oe of W)typeof oe.author=="string"&&D.add(oe.author),typeof oe.body=="string"&&D.add(oe.body);return D}let ae=C(()=>{let D=z();j=D;let V=Array.from(D);return V.length===0?null:{contents:V,options:I()}},D=>{if(!D||!Array.isArray(D.contents))return;let V=Array.from(j),W=new Map;for(let oe=0;oe<V.length&&oe<D.contents.length;oe++)W.set(V[oe],D.contents[oe]);Y.clear(),W.forEach((oe,le)=>Y.set(le,oe))});e.anonymizePrContent=function(D){return D&&(Y.has(D)?Y.get(D):(j.has(D)||ae(),D))};async function se(){let D=parseGithubUrl(e.sourceUrl);try{if(Te(),e.gistOAuthRequired=!1,e.githubConnections?.oauthConnected===!1){e.gistOAuthRequired=!0,p("sourceUrl","missing",!1);return}let V=await t.get(`/api/gist/source/${D.gistId}`);e.details=V.data,e.gistId||(e.gistId="gist-"+D.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(V){if(V.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,p("sourceUrl","missing",!1);return}throw V.data&&(i("ERRORS."+V.data.error).then(W=>{e.addToast({title:"Error",date:new Date,body:W}),e.error=W},console.error),Se(V.data.error)),p("sourceUrl","missing",!1),V}}let re=ze(new Map),ue=new Set;function ke(){let D=new Set,V=e.details&&e.details.gist;if(!V)return D;typeof V.description=="string"&&D.add(V.description),typeof V.ownerLogin=="string"&&D.add(V.ownerLogin);let W=V.files||[];for(let le of W)typeof le.filename=="string"&&D.add(le.filename),typeof le.content=="string"&&D.add(le.content);let oe=V.comments||[];for(let le of oe)typeof le.author=="string"&&D.add(le.author),typeof le.body=="string"&&D.add(le.body);return D}let he=C(()=>{let D=ke();ue=D;let V=Array.from(D);return V.length===0?null:{contents:V,options:I()}},D=>{if(!D||!Array.isArray(D.contents))return;let V=Array.from(ue),W=new Map;for(let oe=0;oe<V.length&&oe<D.contents.length;oe++)W.set(V[oe],D.contents[oe]);re.clear(),W.forEach((oe,le)=>re.set(le,oe)),me()});e.anonymizeGistContent=function(D){return D&&(re.has(D)?re.get(D):(ue.has(D)||he(),D))},e.previewGistFiles=[];function me(){let D=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=D.map(V=>({filename:e.anonymizeGistContent(V.filename),content:e.anonymizeGistContent(V.content),language:V.language}))}e.watch("details.gist.files",me,!0),e.watch("terms",me);function pe(){let D=e.conference;if(e.conference_data=null,!D)return;let V=e.isUpdate&&D===e._originalConference;t.get("/api/conferences/"+D).then(W=>{e.conference===D&&(e.conference_data=W.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.conference_data.options.image,e.options.pdf=e.conference_data.options.pdf,e.options.notebook=e.conference_data.options.notebook,e.options.link=e.conference_data.options.link))},()=>{e.conference===D&&(e.conference_data=null)})}function Te(){p("repoId","used",!0),p("repoId","format",!0),p("pullRequestId","used",!0),p("pullRequestId","format",!0),p("gistId","used",!0),p("gistId","format",!0),p("sourceUrl","used",!0),p("sourceUrl","missing",!0),p("sourceUrl","access",!0),p("sourceUrl","github",!0),p("commit","exists",!0),p("conference","activated",!0),p("terms","format",!0),e.termsRegexWarning=!1}function Re(){let D=e.anonymize&&e.anonymize.expirationDate;ret
Line truncated
|
||||
`).filter(le=>le),connection:e.githubConnection,fullName:`${V.owner}/${V.repo}`,repository:e.sourceUrl,options:e.options,source:e.source,conference:e.conference};e.details&&(W.options.pageSource=e.details.pageSource),Te();let oe=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(oe,W,{headers:{"Content-Type":"application/json"}}).then(()=>{window.location.href="/status/"+e.repoId},le=>{le.data&&(i("ERRORS."+le.data.error).then(L=>{e.error=L},console.error),Se(le.data.error))}).finally(()=>{D.target.disabled=!1})},e.anonymizeGist=D=>{if(Re())return;D.target.disabled=!0;let V=parseGithubUrl(e.sourceUrl),W={gistId:e.gistId,terms:e.terms.trim().split(`
|
||||
`).filter(le=>le),source:{gistId:V.gistId},options:e.options,conference:e.conference};Te();let oe=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(oe,W,{headers:{"Content-Type":"application/json"}}).then(()=>{window.location.href="/gist/"+e.gistId},le=>{le.data&&(i("ERRORS."+le.data.error).then(L=>{e.error=L},console.error),Se(le.data.error))}).finally(()=>{D.target.disabled=!1})},e.anonymizePullRequest=D=>{if(Re())return;D.target.disabled=!0;let V=parseGithubUrl(e.sourceUrl),W={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
|
||||
`).filter(le=>le),source:{repositoryFullName:`${V.owner}/${V.repo}`,pullRequestId:V.pullRequestId},options:e.options,conference:e.conference};Te();let oe=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(oe,W,{headers:{"Content-Type":"application/json"}}).then(()=>{window.location.href="/pr/"+e.pullRequestId},le=>{le.data&&(i("ERRORS."+le.data.error).then(L=>{e.error=L},console.error),Se(le.data.error))}).finally(()=>{D.target.disabled=!1})},e.watch("conference",()=>{pe()}),e.watch("terms",()=>{e.detectedType==="repo"&&P(),e.detectedType==="pr"&&ae(),e.detectedType==="gist"&&he()}),e.watch("options.image",()=>{e.detectedType==="repo"&&P(),e.detectedType==="pr"&&ae(),e.detectedType==="gist"&&he()}),e.watch("options.link",()=>{e.detectedType==="repo"&&P(),e.detectedType==="pr"&&ae(),e.detectedType==="gist"&&he()}),e.watch("details",()=>{e.detectedType==="pr"&&ae(),e.detectedType==="gist"&&he()},!0)},Yo=function(e,t,o,r,n,i){let a=mt(),u=as(),m=0,h=!1;e.on("dispose",()=>{h=!0,m++,v&&v.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(z){if((z.metaKey||z.ctrlKey)&&z.key==="k"){z.preventDefault();var ae=document.querySelector(".tree-search-input");ae&&(ae.focus(),ae.select())}});var v=null;e.onFileSearchChange=function(){v&&(v.resolve(),v=null);let z=e.fileSearchQuery;if(!z||z.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let ae=i.defer();v=ae,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(z)}`,{timeout:ae.promise}).then(function(se){if(!(h||v!==ae)){v=null,e.fileSearchLoading=!1;var re={};e.files.forEach(function(L){re[(L.path||"")+"/"+L.name]=!0});for(var ue=[],ke={},he=0;he<se.data.length;he++){var me=se.data[he];if(me.path)for(var pe=me.path.split("/"),Te="",Re=0;Re<pe.length;Re++){var Se=Te;Te=Te?Te+"/"+pe[Re]:pe[Re];var D=Se+"/"+pe[Re];!re[D]&&!ke[D]&&(ke[D]=!0,ue.push({name:pe[Re],path:Se}))}}ue.sort(function(L,te){return(L.path||"").split("/").length-(te.path||"").split("/").length}),ue.length>0&&e.files.push.apply(e.files,ue);for(var V=[],W=0;W<se.data.length;W++){var oe=se.data[W],le=(oe.path||"")+"/"+oe.name;!re[le]&&oe.size!=null&&(V.push(oe),re[le]=!0)}V.length>0&&e.files.push.apply(e.files,V),e.fileSearchResults=se.data}},function(){!h&&v===ae&&(v=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})};let k={yml:"yaml",txt:"text",py:"python",js:"javascript",ts:"typescript"},p=["license","txt"],g=["png","jpg","jpeg","gif","svg","ico","bmp","tiff","tif","webp","avif","heif","heic"],w=["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(z,ae){if(e.repoId!=r.repoId)return j();if((r.path||"")!=e.filePath){e.filePath=r.path||"",e.paths=e.filePath.split("/").filter(se=>se&&se.trim().length>0),Y();for(let se=0;se<e.paths.length-1;se++){let re=se>0?e.paths.slice(0,se).join("/"):"";e.files.some(ke=>ke.path===re)||e.getFiles(re)}}});function T(){if(e.paths[0]!="")return;let z=["readme.md","readme.txt","readme.org","readme.1st","readme"],ae={};for(let re of e.files)re.name.toLowerCase().indexOf("readme")>-1&&(ae[re.name.toLowerCase()]=re.name);let se=null;for(let re of z)if(ae[re]){se=re;break}if(!se&&Object.keys(ae).length>0&&(se=Object.keys(ae)[0]),se){let re=o.url();re[re.length-1]!="/"&&(re+="/"),o.url(re+encodePathForUrl(ae[se]))}}e.fileCounts=null,e.getFiles=function(z){let ae=e.repoId;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(z)}&v=${e.options.lastUpdateDate}`).then(function(se){if(h||ae!==e.repoId)return[];let re=z||"";return e.files=e.files.filter(ue=>ue.path!==re),e.files.push(...se.data),se.data},function(se){if(h||ae!==e.repoId)return[];e.type="error",e.content=se&&se.data&&se.data.error||"unknown_error",e.files=[]})};function N(){let z=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts`).then(function(ae){h||z!==e.repoId||(e.fileCounts=ae.data)},function(){e.fileCounts={}})}function R(){return e.files.filter(z=>z.name==e.paths[e.paths.length-1]&&z.path==e.paths.slice(0,e.paths.length-1).join("/"))[0]}var I=null;e.on("dispose",function(){I&&a.interval.cancel(I)});function C(z){if(h)return;let ae=e.repoId;t.get(`/api/repo/${e.repoId}/options`).then(se=>{if(!(h||ae!==e.repoId)){if(e.options=se.data,e.options.url){window.location=e.options.url;return}z&&z(se.data)}},se=>{if(!(h||ae!==e.repoId)){var re=se.data||{};if(re.error==="rate_limited"&&re.resetAt){let ke=function(){var he=Math.max(0,Math.ceil((e.rateLimitResetAt-Date.now())/1e3));if(he<=0)e.rateLimitCountdown="",e.rateLimitResetAt=0,I&&(a.interval.cancel(I),I=null),C(z);else{var me=Math.floor(he/60),pe=he%60;e.rateLimitCountdown=me>0?me+"m "+pe+"s":pe+"s"}};var ue=ke;e.type="rate_limited",e.rateLimitResetAt=re.resetAt,I&&a.interval.cancel(I),ke(),I=a.interval(ke,1e3)}else re.error==="re
Line truncated
|
||||
`),e.source=D.data.source,e.options=Object.assign({},e.options,D.data.options),e.conference=D.data.conference,e._originalConference=D.data.conference,D.data.options.expirationDate&&(e.options.expirationDate=new Date(D.data.options.expirationDate)),!await T()&&await se()},()=>{n.url("/404")}))}),t.get("/github/connections").then(D=>{e.githubConnections=D.data,!r.repoId&&!r.pullRequestId&&!r.gistId&&e.githubConnection===void 0&&D.data.appEnabled&&D.data.appConnected&&(e.githubConnection="github-app")}).catch(()=>{}),e.urlSelected=async(D=!1)=>{e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,D||(e.terms=e.defaultTerms),!D&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],D||(e.source={type:"GitHubStream",branch:"",commit:""}),e.anonymize_readme="",e.readme="",e.html_readme="",e.detectedType=null,e.gistOAuthRequired=!1;let V;try{V=parseGithubUrl(e.sourceUrl)}catch{p("sourceUrl","github",!1);return}p("sourceUrl","github",!0);try{V.gistId&&!V.repo?(e.detectedType="gist",e.source={gistId:V.gistId},await se()):V.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:V.owner+"/"+V.repo,pullRequestId:V.pullRequestId},await Z()):(e.detectedType="repo",await Promise.all([N(),R()]),P())}catch{return}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let D=e.branches.filter(W=>W.name==e.source.branch)[0];if(!D)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&!!e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=D.commit),e.readme=D.readme,await R(),P()}),e.getBranches=async D=>{let V=parseGithubUrl(e.sourceUrl);try{let W=await t.get(`/api/repo/${V.owner}/${V.repo}/branches`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&g(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:D===!0||e.reconnectingSource?"1":"0",repositoryID:w()}});e.branches=W.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let oe=e.branches.filter(le=>le.name==e.source.branch);oe.length>0&&(!(!e.reconnectingSource&&!D&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=oe[0].commit),e.readme=oe[0].readme,await R(D))}catch(W){e.branches=[],e.sourceUnreachable=W&&(W.status===404||W.data&&W.data.error==="repo_not_found");let oe=W&&W.data&&W.data.error||(W&&W.status===404?"repo_not_found":"unknown_error");i("ERRORS."+oe).then(le=>{e.toasts=e.toasts||[],e.addToast({title:"Error",date:new Date,body:le}),e.error=le},console.error),typeof p=="function"&&p("sourceUrl","missing",!1)}};async function N(){let D=parseGithubUrl(e.sourceUrl);try{Te();let V=await t.get(`/api/repo/${D.owner}/${D.repo}/`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&g(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,repositoryID:w(),force:"1"}});e.details=V.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(V){throw V.data&&(i("ERRORS."+V.data.error).then(W=>{e.addToast({title:"Error",date:new Date,body:W}),e.error=W},console.error),Se(V.data.error)),p("sourceUrl","missing",!1),V}}async function R(D){if(e.readme&&!D)return e.readme;let V=parseGithubUrl(e.sourceUrl);try{let W=await t.get(`/api/repo/${V.owner}/${V.repo}/readme`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&g(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:D===!0?"1":"0",branch:e.source.branch,repositoryID:w()}});e.readme=W.data}catch{e.readme=""}}function I(){let D={terms:e.terms?e.terms.split(`
|
||||
`):[],image:!!e.options.image,link:!!e.options.link,repoId:e.repoId};e.source&&e.source.branch&&(D.branchName=e.source.branch);try{let V=parseGithubUrl(e.sourceUrl);D.repoName=`${V.owner}/${V.repo}`}catch{}return D}function C(D,V){let W=null,oe=0;return function(){W&&a.cancel(W),W=a(()=>{W=null;let U=++oe,te=D();te&&t.post("/api/anonymize-preview",te).then(L=>{U===oe&&V(L.data)},()=>{})},200)}}let A=C(()=>e.readme?{content:e.readme,options:I()}:null,D=>{e.anonymize_readme=D.content||"";let V="";try{let oe=parseGithubUrl(e.sourceUrl),le=e.source.branch||e.details&&e.details.defaultBranch||"main";V=`https://github.com/${oe.owner}/${oe.repo}/raw/${le}/`}catch{}let W=renderMD(e.anonymize_readme,V);e.html_readme=W,a(Prism.highlightAll,150)});function P(){!e.anonymize||!e.anonymize.terms||(e.termsRegexWarning=!!e.terms&&!!e.terms.match(/[-[\]{}()*+?.,\\^$|#]/g),A())}async function Z(){let D=parseGithubUrl(e.sourceUrl);try{Te();let V=await t.get(`/api/pr/${D.owner}/${D.repo}/${D.pullRequestId}`,{params:{connection:e.githubConnection}});e.details=V.data,e.pullRequestId||(e.pullRequestId=D.repo+"-PR"+D.pullRequestId+"-"+generateRandomId(4))}catch(V){throw V.data&&(i("ERRORS."+V.data.error).then(W=>{e.addToast({title:"Error",date:new Date,body:W}),e.error=W},console.error),Se(V.data.error)),p("sourceUrl","missing",!1),V}}let Y=ze(new Map),j=new Set;function z(){let D=new Set,V=e.details&&e.details.pullRequest;if(!V)return D;typeof V.title=="string"&&D.add(V.title),typeof V.body=="string"&&D.add(V.body),typeof V.diff=="string"&&D.add(V.diff);let W=V.comments||[];for(let oe of W)typeof oe.author=="string"&&D.add(oe.author),typeof oe.body=="string"&&D.add(oe.body);return D}let ae=C(()=>{let D=z();j=D;let V=Array.from(D);return V.length===0?null:{contents:V,options:I()}},D=>{if(!D||!Array.isArray(D.contents))return;let V=Array.from(j),W=new Map;for(let oe=0;oe<V.length&&oe<D.contents.length;oe++)W.set(V[oe],D.contents[oe]);Y.clear(),W.forEach((oe,le)=>Y.set(le,oe))});e.anonymizePrContent=function(D){return D&&(Y.has(D)?Y.get(D):(j.has(D)||ae(),D))};async function se(){let D=parseGithubUrl(e.sourceUrl);try{if(Te(),e.gistOAuthRequired=!1,e.githubConnections?.oauthConnected===!1){e.gistOAuthRequired=!0,p("sourceUrl","missing",!1);return}let V=await t.get(`/api/gist/source/${D.gistId}`);e.details=V.data,e.gistId||(e.gistId="gist-"+D.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(V){if(V.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,p("sourceUrl","missing",!1);return}throw V.data&&(i("ERRORS."+V.data.error).then(W=>{e.addToast({title:"Error",date:new Date,body:W}),e.error=W},console.error),Se(V.data.error)),p("sourceUrl","missing",!1),V}}let re=ze(new Map),ue=new Set;function ke(){let D=new Set,V=e.details&&e.details.gist;if(!V)return D;typeof V.description=="string"&&D.add(V.description),typeof V.ownerLogin=="string"&&D.add(V.ownerLogin);let W=V.files||[];for(let le of W)typeof le.filename=="string"&&D.add(le.filename),typeof le.content=="string"&&D.add(le.content);let oe=V.comments||[];for(let le of oe)typeof le.author=="string"&&D.add(le.author),typeof le.body=="string"&&D.add(le.body);return D}let he=C(()=>{let D=ke();ue=D;let V=Array.from(D);return V.length===0?null:{contents:V,options:I()}},D=>{if(!D||!Array.isArray(D.contents))return;let V=Array.from(ue),W=new Map;for(let oe=0;oe<V.length&&oe<D.contents.length;oe++)W.set(V[oe],D.contents[oe]);re.clear(),W.forEach((oe,le)=>re.set(le,oe)),me()});e.anonymizeGistContent=function(D){return D&&(re.has(D)?re.get(D):(ue.has(D)||he(),D))},e.previewGistFiles=[];function me(){let D=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=D.map(V=>({filename:e.anonymizeGistContent(V.filename),content:e.anonymizeGistContent(V.content),language:V.language}))}e.watch("details.gist.files",me,!0),e.watch("terms",me);function pe(){let D=e.conference;if(e.conference_data=null,!D)return;let V=e.isUpdate&&D===e._originalConference;t.get("/api/conferences/"+D).then(W=>{e.conference===D&&(e.conference_data=W.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.conference_data.options.image,e.options.pdf=e.conference_data.options.pdf,e.options.notebook=e.conference_data.options.notebook,e.options.link=e.conference_data.options.link))},()=>{e.conference===D&&(e.conference_data=null)})}function Te(){p("repoId","used",!0),p("repoId","format",!0),p("pullRequestId","used",!0),p("pullRequestId","format",!0),p("gistId","used",!0),p("gistId","format",!0),p("sourceUrl","used",!0),p("sourceUrl","missing",!0),p("sourceUrl","access",!0),p("sourceUrl","github",!0),p("commit","exists",!0),p("conference","activated",!0),p("terms","format",!0),e.termsRegexWarning=!1}function Re(){let D=e.anonymize&&e.anonymize.expirationDate;ret
Line truncated
|
||||
`).filter(le=>le),connection:e.githubConnection,fullName:`${V.owner}/${V.repo}`,repository:e.sourceUrl,reconnectRepositoryId:e.reconnectRepositoryId,options:e.options,source:e.source,conference:e.conference};e.details&&(W.options.pageSource=e.details.pageSource),Te();let oe=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(oe,W,{headers:{"Content-Type":"application/json"}}).then(()=>{window.location.href="/status/"+e.repoId},le=>{le.data&&(i("ERRORS."+le.data.error).then(U=>{e.error=U},console.error),Se(le.data.error))}).finally(()=>{D.target.disabled=!1})},e.anonymizeGist=D=>{if(Re())return;D.target.disabled=!0;let V=parseGithubUrl(e.sourceUrl),W={gistId:e.gistId,terms:e.terms.trim().split(`
|
||||
`).filter(le=>le),source:{gistId:V.gistId},options:e.options,conference:e.conference};Te();let oe=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(oe,W,{headers:{"Content-Type":"application/json"}}).then(()=>{window.location.href="/gist/"+e.gistId},le=>{le.data&&(i("ERRORS."+le.data.error).then(U=>{e.error=U},console.error),Se(le.data.error))}).finally(()=>{D.target.disabled=!1})},e.anonymizePullRequest=D=>{if(Re())return;D.target.disabled=!0;let V=parseGithubUrl(e.sourceUrl),W={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
|
||||
`).filter(le=>le),source:{repositoryFullName:`${V.owner}/${V.repo}`,pullRequestId:V.pullRequestId},options:e.options,conference:e.conference};Te();let oe=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(oe,W,{headers:{"Content-Type":"application/json"}}).then(()=>{window.location.href="/pr/"+e.pullRequestId},le=>{le.data&&(i("ERRORS."+le.data.error).then(U=>{e.error=U},console.error),Se(le.data.error))}).finally(()=>{D.target.disabled=!1})},e.watch("conference",()=>{pe()}),e.watch("terms",()=>{e.detectedType==="repo"&&P(),e.detectedType==="pr"&&ae(),e.detectedType==="gist"&&he()}),e.watch("options.image",()=>{e.detectedType==="repo"&&P(),e.detectedType==="pr"&&ae(),e.detectedType==="gist"&&he()}),e.watch("options.link",()=>{e.detectedType==="repo"&&P(),e.detectedType==="pr"&&ae(),e.detectedType==="gist"&&he()}),e.watch("details",()=>{e.detectedType==="pr"&&ae(),e.detectedType==="gist"&&he()},!0)},Yo=function(e,t,o,r,n,i){let a=mt(),u=as(),m=0,h=!1;e.on("dispose",()=>{h=!0,m++,v&&v.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(z){if((z.metaKey||z.ctrlKey)&&z.key==="k"){z.preventDefault();var ae=document.querySelector(".tree-search-input");ae&&(ae.focus(),ae.select())}});var v=null;e.onFileSearchChange=function(){v&&(v.resolve(),v=null);let z=e.fileSearchQuery;if(!z||z.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let ae=i.defer();v=ae,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(z)}`,{timeout:ae.promise}).then(function(se){if(!(h||v!==ae)){v=null,e.fileSearchLoading=!1;var re={};e.files.forEach(function(U){re[(U.path||"")+"/"+U.name]=!0});for(var ue=[],ke={},he=0;he<se.data.length;he++){var me=se.data[he];if(me.path)for(var pe=me.path.split("/"),Te="",Re=0;Re<pe.length;Re++){var Se=Te;Te=Te?Te+"/"+pe[Re]:pe[Re];var D=Se+"/"+pe[Re];!re[D]&&!ke[D]&&(ke[D]=!0,ue.push({name:pe[Re],path:Se}))}}ue.sort(function(U,te){return(U.path||"").split("/").length-(te.path||"").split("/").length}),ue.length>0&&e.files.push.apply(e.files,ue);for(var V=[],W=0;W<se.data.length;W++){var oe=se.data[W],le=(oe.path||"")+"/"+oe.name;!re[le]&&oe.size!=null&&(V.push(oe),re[le]=!0)}V.length>0&&e.files.push.apply(e.files,V),e.fileSearchResults=se.data}},function(){!h&&v===ae&&(v=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})};let k={yml:"yaml",txt:"text",py:"python",js:"javascript",ts:"typescript"},p=["license","txt"],g=["png","jpg","jpeg","gif","svg","ico","bmp","tiff","tif","webp","avif","heif","heic"],w=["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(z,ae){if(e.repoId!=r.repoId)return j();if((r.path||"")!=e.filePath){e.filePath=r.path||"",e.paths=e.filePath.split("/").filter(se=>se&&se.trim().length>0),Y();for(let se=0;se<e.paths.length-1;se++){let re=se>0?e.paths.slice(0,se).join("/"):"";e.files.some(ke=>ke.path===re)||e.getFiles(re)}}});function T(){if(e.paths[0]!="")return;let z=["readme.md","readme.txt","readme.org","readme.1st","readme"],ae={};for(let re of e.files)re.name.toLowerCase().indexOf("readme")>-1&&(ae[re.name.toLowerCase()]=re.name);let se=null;for(let re of z)if(ae[re]){se=re;break}if(!se&&Object.keys(ae).length>0&&(se=Object.keys(ae)[0]),se){let re=o.url();re[re.length-1]!="/"&&(re+="/"),o.url(re+encodePathForUrl(ae[se]))}}e.fileCounts=null,e.getFiles=function(z){let ae=e.repoId;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(z)}&v=${e.options.lastUpdateDate}`).then(function(se){if(h||ae!==e.repoId)return[];let re=z||"";return e.files=e.files.filter(ue=>ue.path!==re),e.files.push(...se.data),se.data},function(se){if(h||ae!==e.repoId)return[];e.type="error",e.content=se&&se.data&&se.data.error||"unknown_error",e.files=[]})};function N(){let z=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts`).then(function(ae){h||z!==e.repoId||(e.fileCounts=ae.data)},function(){e.fileCounts={}})}function R(){return e.files.filter(z=>z.name==e.paths[e.paths.length-1]&&z.path==e.paths.slice(0,e.paths.length-1).join("/"))[0]}var I=null;e.on("dispose",function(){I&&a.interval.cancel(I)});function C(z){if(h)return;let ae=e.repoId;t.get(`/api/repo/${e.repoId}/options`).then(se=>{if(!(h||ae!==e.repoId)){if(e.options=se.data,e.options.url){window.location=e.options.url;return}z&&z(se.data)}},se=>{if(!(h||ae!==e.repoId)){var re=se.data||{};if(re.error==="rate_limited"&&re.resetAt){let ke=function(){var he=Math.max(0,Math.ceil((e.rateLimitResetAt-Date.now())/1e3));if(he<=0)e.rateLimitCountdown="",e.rateLimitResetAt=0,I&&(a.interval.cancel(I),I=null),C(z);else{var me=Math.floor(he/60),pe=he%60;e.rateLimitCountdown=me>0?me+"m "+pe+"s":pe+"s"}};var ue=ke;e.type="rate_limited",e.rateLimitResetAt=re.resetAt,I&&a.interval.cancel(I),ke(),I=a.interval(ke,1e3)}else re.error==="re
Line truncated
|
||||
`+b.join(`
|
||||
`)],{type:"text/csv"}),N=document.createElement("a");N.href=URL.createObjectURL(T),N.download=r.username+"-repositories.csv",N.click()},e.showStatusMessage=p=>{let g=p.statusMessage||"(no message)";window.prompt(`Status message for ${p.repoId} (${p.status}):`,g)},e.fetchGithubInfo=p=>{let g=window.open("","_blank");g&&g.document.write("<pre>Loading GitHub info for "+p.repoId+"...</pre>"),t.get("/api/admin/repos/"+p.repoId+"/github").then(w=>{g&&(g.document.open(),g.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(w.data,null,2).replace(/[<>]/g,b=>b==="<"?"<":">")+"</pre>"),g.document.close())},w=>{let b=w&&w.data?JSON.stringify(w.data,null,2):String(w);g&&(g.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+b+"</pre>")})};function m(p){t.get("/api/admin/users/"+p+"/repos",{}).then(g=>{e.repositories=g.data},g=>{console.error(g)})}function h(p){t.get("/api/admin/users/"+p,{}).then(g=>{e.userInfo=g.data},g=>{console.error(g)})}h(r.username),m(r.username),e.banUser=()=>{confirm(`Ban user ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/ban`).then(()=>h(r.username),p=>console.error(p))},e.activateUser=()=>{t.post(`/api/admin/users/${r.username}/activate`).then(()=>h(r.username),p=>console.error(p))},e.promoteUser=()=>{confirm(`Promote ${r.username} to admin?`)&&t.post(`/api/admin/users/${r.username}/promote`).then(()=>h(r.username),p=>console.error(p))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/demote`).then(()=>h(r.username),p=>console.error(p))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function v(){t.get("/api/admin/tokens").then(p=>{e.tokens=p.data||[]},p=>{p.status!==401&&p.status!==403&&console.error(p)})}v(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(p=>{e.tokenForm.plaintext=p.data.token,e.tokenForm.name="",v()},p=>console.error(p))},e.revokeToken=p=>{confirm(`Revoke token "${p.name}"?`)&&t.delete("/api/admin/tokens/"+p.id).then(()=>v(),g=>console.error(g))},e.removeCache=p=>{confirm("Remove cached files for "+p.repoId+"?")&&t.delete("/api/admin/repos/"+p.repoId).then(()=>m(r.username),g=>console.error(g))},e.removeRepository=p=>{confirm("Remove repository "+p.repoId+"?")&&t.delete("/api/repo/"+p.repoId+"/").then(()=>m(r.username),g=>console.error(g))},e.updateRepository=p=>{let g=ze({title:`Refreshing ${p.repoId}...`,date:new Date,body:`The repository ${p.repoId} is going to be refreshed.`});e.toasts.push(g),t.post(`/api/repo/${p.repoId}/refresh`).then(w=>{w.data.status=="ready"?g.title=`${p.repoId} is refreshed.`:g.title=`Refreshing of ${p.repoId}.`},w=>{g.title=`Error during the refresh of ${p.repoId}.`,g.body=w.body})},e.getGitHubRepositories=p=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(g=>{e.userInfo.repositories=g.data})};let k=null;e.watch("query",()=>{n.timeout.cancel(k),k=n.timeout(()=>{m(r.username)},500)},!0)},za=function(e,t,o){let r=mt(),n=as();e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null&&o.url("/"),e.conferences=[],e.total=-1,e.totalPage=0,e.statusCounts=[];let i=w=>{if(w.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){w.preventDefault();let b=document.querySelector('.admin-filter-toolbar input[type="search"]');b&&b.focus()}};n(document,"keydown",i),e.on("dispose",()=>document.removeEventListener("keydown",i)),e.clearFilter=w=>{w==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[w]="",e.query.page=1},e.chips=[];let a=()=>{let w=[];(e.query.dateFrom||e.query.dateTo)&&w.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=w};e.statusCountFor=w=>{let b=(e.statusCounts||[]).find(T=>T._id===w);return b?b.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=w=>{e.query.sort===w?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=w,e.query.direction="desc"),e.query.page=1},e.sortIcon=w=>e.query.sort===w?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},h=loadFilterPrefs(u)||{};e.query=Object.assign({},m,h,{page:1,search:""});let v=o.search();v.search&&(e.query.search=v.search);let k="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(k)||"[]"),e.savePreset=()=>{let w=window.prompt("Preset name:");if(!w)return;let b=Object.assign({},e.query);delete b.page,e.presets=(e.presets||[]).filter(T=>T.name!==w),e.presets.push({name:w,query:b}),localStorage.setItem(k,JSON.stringify(e.presets))},e.applyPreset=w=>{Object.assign(e.query,w.query,{page:1})},e.deletePreset=w=>{e.presets=(e.presets||[]).filter(b=>b.name!==w.name),localStorage.setItem(k,JS
Line truncated
|
||||
`)],{type:"text/csv"}),N=document.createElement("a");N.href=URL.createObjectURL(T),N.download=r.username+"-repositories.csv",N.click()},e.showStatusMessage=p=>{let g=p.statusMessage||"(no message)";window.prompt(`Status message for ${p.repoId} (${p.status}):`,g)},e.fetchGithubInfo=p=>{let g=window.open("","_blank");g&&g.document.write("<pre>Loading GitHub info for "+p.repoId+"...</pre>"),t.get("/api/admin/repos/"+p.repoId+"/github").then(w=>{g&&(g.document.open(),g.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(w.data,null,2).replace(/[<>]/g,b=>b==="<"?"<":">")+"</pre>"),g.document.close())},w=>{let b=w&&w.data?JSON.stringify(w.data,null,2):String(w);g&&(g.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+b+"</pre>")})};function m(p){t.get("/api/admin/users/"+p+"/repos",{}).then(g=>{e.repositories=g.data},g=>{console.error(g)})}function h(p){t.get("/api/admin/users/"+p,{}).then(g=>{e.userInfo=g.data},g=>{console.error(g)})}h(r.username),m(r.username),e.banUser=()=>{confirm(`Ban user ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/ban`).then(()=>h(r.username),p=>console.error(p))},e.activateUser=()=>{t.post(`/api/admin/users/${r.username}/activate`).then(()=>h(r.username),p=>console.error(p))},e.promoteUser=()=>{confirm(`Promote ${r.username} to admin?`)&&t.post(`/api/admin/users/${r.username}/promote`).then(()=>h(r.username),p=>console.error(p))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/demote`).then(()=>h(r.username),p=>console.error(p))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function v(){t.get("/api/admin/tokens").then(p=>{e.tokens=p.data||[]},p=>{p.status!==401&&p.status!==403&&console.error(p)})}v(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(p=>{e.tokenForm.plaintext=p.data.token,e.tokenForm.name="",v()},p=>console.error(p))},e.revokeToken=p=>{confirm(`Revoke token "${p.name}"?`)&&t.delete("/api/admin/tokens/"+p.id).then(()=>v(),g=>console.error(g))},e.removeCache=p=>{confirm("Remove cached files for "+p.repoId+"?")&&t.delete("/api/admin/repos/"+p.repoId).then(()=>m(r.username),g=>console.error(g))},e.removeRepository=p=>{confirm("Remove repository "+p.repoId+"?")&&t.delete("/api/repo/"+p.repoId+"/").then(()=>m(r.username),g=>console.error(g))},e.updateRepository=p=>{let g=ze({title:`Refreshing ${p.repoId}...`,date:new Date,body:`The repository ${p.repoId} is going to be refreshed.`});e.toasts.push(g),t.post(`/api/repo/${p.repoId}/refresh`).then(w=>{w.data.status=="ready"?g.title=`${p.repoId} is refreshed.`:g.title=`Refreshing of ${p.repoId}.`},w=>{g.title=`Error during the refresh of ${p.repoId}.`,g.body=w.body})},e.getGitHubRepositories=p=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(g=>{e.userInfo.repositories=g.data})};let k=null;e.watch("query",()=>{n.timeout.cancel(k),k=n.timeout(()=>{m(r.username)},500)},!0)},za=function(e,t,o){let r=mt(),n=as();e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null&&o.url("/"),e.conferences=[],e.total=-1,e.totalPage=0,e.statusCounts=[];let i=w=>{if(w.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){w.preventDefault();let b=document.querySelector('.admin-filter-toolbar input[type="search"]');b&&b.focus()}};n(document,"keydown",i),e.on("dispose",()=>document.removeEventListener("keydown",i)),e.clearFilter=w=>{w==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[w]="",e.query.page=1},e.chips=[];let a=()=>{let w=[];(e.query.dateFrom||e.query.dateTo)&&w.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=w};e.statusCountFor=w=>{let b=(e.statusCounts||[]).find(T=>T._id===w);return b?b.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=w=>{e.query.sort===w?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=w,e.query.direction="desc"),e.query.page=1},e.sortIcon=w=>e.query.sort===w?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},h=loadFilterPrefs(u)||{};e.query=Object.assign({},m,h,{page:1,search:""});let v=o.search();v.search&&(e.query.search=v.search);let k="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(k)||"[]"),e.savePreset=()=>{let w=window.prompt("Preset name:");if(!w)return;let b=Object.assign({},e.query);delete b.page,e.presets=(e.presets||[]).filter(T=>T.name!==w),e.presets.push({name:w,query:b}),localStorage.setItem(k,JSON.stringify(e.presets))},e.applyPreset=w=>{Object.assign(e.query,w.query,{page:1})},e.deletePreset=w=>{e.presets=(e.presets||[]).filter(b=>b.name!==w.name),localStorage.setItem(k,JS
Line truncated
|
||||
`).map((he,me)=>me===0?he:ke+he).join(`
|
||||
`)}else typeof j=="number"||typeof j=="boolean"?ue=String(j):ue=JSON.stringify(j);Z.push(`${se}${ue}${re}`)}),Z.push("}"),Z.join(`
|
||||
`)}function h(N){let R=[],I="",C=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,A=0,P;for(;P=C.exec(N);)I+=N.slice(A,P.index),A=C.lastIndex,R.push({key:P[1],op:P[2]||"=",val:P[3]});return I+=N.slice(A),{filters:R,free:I.trim().toLowerCase()}}function v(N,R){for(let I of R.filters){let C=(P,Z,Y)=>{let j=parseFloat(P),z=parseFloat(Z);return Y==="="?String(P)===String(Z):Y==="!="?String(P)!==String(Z):Y===">="?j>=z:Y==="<="?j<=z:Y===">"?j>z:Y==="<"?j<z:!0},A;if(I.key==="code")A=N.displayMessage;else if(I.key==="module")A=N.module;else if(I.key==="status")A=N._status;else if(I.key==="url")A=N._url;else if(I.key==="repo")A=N._repoId;else if(I.key==="level")A=N.level;else continue;if(A==null||!C(A,I.val,I.op))return!1}return!(R.free&&((N.displayMessage||"")+" "+(N.module||"")+" "+(N._url||"")+" "+JSON.stringify(N.raw||[])).toLowerCase().indexOf(R.free)===-1)}function k(){let N=h(e.query.search||"");e.parsedFilterCount=N.filters.length;let R=e.query.bucket,I=e.entries.filter(A=>R&&A._bucket!==R?!1:v(A,N)),C=e.query.group;if(C){let A=Y=>C==="module"?Y.module:Y.displayMessage||Y.message||"_",P=new Map;for(let Y of I){let j=A(Y);if(P.has(j)){let z=P.get(j);z.count++,z._related.push(Y),new Date(Y.ts)>new Date(z.ts)&&(z.ts=Y.ts,z._url=Y._url,z._status=Y._status),new Date(Y.ts)<new Date(z._firstSeen)&&(z._firstSeen=Y.ts)}else{let z=Object.assign({},Y);z._key=`${C}:${j}`,z._related=[Y],z._firstSeen=Y.ts,z._lastHourCount=0,z.count=1,P.set(j,z)}}let Z=Date.now()-3600*1e3;for(let Y of P.values())Y._lastHourCount=Y._related.filter(j=>new Date(j.ts).getTime()>=Z).length;I=Array.from(P.values())}else I=I.map((A,P)=>(A._key="row:"+P+":"+A.ts,A._related=[A],A._firstSeen=A.ts,A._lastHourCount=0,A.count=1,A));e.query.sort==="count"?I.sort((A,P)=>P.count-A.count||new Date(P.ts)-new Date(A.ts)):I.sort((A,P)=>new Date(P.ts)-new Date(A.ts)),e.visible=I}function p(N){let R=N?e.entries.length:0,I=N?e.pageSize:Math.max(e.pageSize,e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:R,limit:I}}).then(C=>{let A=(C.data.entries||[]).map(u);e.entries=N?e.entries.concat(A):A,e.available=!!C.data.available,e.cap=C.data.max||e.cap,e.total=C.data.total||e.entries.length,k()},C=>console.error(C))}e.loadMore=()=>p(!0),e.canLoadMore=()=>e.entries.length<e.total;function g(){t.get("/api/admin/errors/stats").then(N=>{let R=N.data||{},I=R.prev24h?Math.round((R.last24h-R.prev24h)/R.prev24h*100):0;e.stats={last24h:R.last24h||0,prev24h:R.prev24h||0,delta:I,severity:R.severity||{error:0,warn:0,info:0},unique:R.unique||{error:0,warn:0,info:0},buckets:R.buckets||[],dropped:R.dropped||0}},N=>console.error(N))}function w(){p(),g()}e.barPx=(N,R)=>{let I=e.stats.buckets||[],C=0;for(let Y of I)C=Math.max(C,(Y.error||0)+(Y.warn||0)+(Y.info||0));if(!C)return 0;let A=(N.error||0)+(N.warn||0)+(N.info||0);if(!A)return 0;let P=Math.round(A/C*60),Z=N[R]||0;return Math.round(Z/A*P)},e.bucketTitle=N=>`${new Date(N.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${N.error||0} err \xB7 ${N.warn||0} warn \xB7 ${N.info||0} info`,e.toggle=N=>{e.expanded[N._key]=!e.expanded[N._key]},e.setBucket=N=>{e.query.bucket=N},e.refreshNow=w,e.clearAll=()=>{confirm("Clear all captured errors?")&&t.delete("/api/admin/errors").then(w,N=>console.error(N))},e.exportCsv=()=>{let N=["ts","level","module","displayMessage","_status","_url","_repoId"],R=[N.join(",")];for(let P of e.visible)R.push(N.map(Z=>{let Y=P[Z]==null?"":String(P[Z]);return/[",\n]/.test(Y)?`"${Y.replace(/"/g,'""')}"`:Y}).join(","));let I=new Blob([R.join(`
|
||||
`)],{type:"text/csv;charset=utf-8"}),C=URL.createObjectURL(I),A=document.createElement("a");A.href=C,A.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(A),A.click(),document.body.removeChild(A),URL.revokeObjectURL(C)};function b(N){e.copyHint=`${N} copied`,n.timeout(()=>{e.copyHint=""},1500)}e.copyJson=N=>{navigator.clipboard.writeText(N._detailJson).then(()=>b("JSON"))},e.copyCurl=N=>{if(!N._url)return;let I=`curl -X ${N._method||"GET"} '${window.location.origin}${N._url}'`;navigator.clipboard.writeText(I).then(()=>b("curl"))},w();let T=r(()=>{e.query.autoRefresh&&w()},15e3);e.on("dispose",()=>r.cancel(T)),e.watch("query.search",k),e.watch("query.bucket",k),e.watch("query.sort",k),e.watch("query.group",k)},Ga=function(e,t,o,r){if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null){o.url("/");return}e.data=null,e.loading=!0,e.error=null;function n(p){if(p==null)return"\u2014";for(var g=["B","KB","MB","GB","TB"],w=0,b=p;b>=1024&&w<g.length-1;)b/=1024,w++;return b.toFixed(w>0?1:0)+" "+g[w]}e.humanBytes=n;function i(p){if(!p)return"\u2014";var g=Math.floor(p/86400),w=Math.floor(p%86400/3600),b=Math.floor(p%3600/60);return g>0?g+"d "+(w<10?"0":"")+w+"h":w>0?w+"h "+(b<10?"0":"")+b+"m":b+"m"}e.humanDuration=i;function a(p){return p==null?"\u2014":p>=1e6?(p/1e6).toFixed(1)+"M":p>=1e3?(p/1e3).toFixed(1)+"K":String(p)}e.humanNum=a,e.queueTotal=function(p){return p?(p.waiting||0)+(p.active||0)+(p.delayed||0)+(p.failed||0):0},e.statusCount=function(p){if(!e.data||!e.data.repos)return 0;for(var g=e.data.repos.statusBreakdown||[],w=0;w<g.length;w++)if(g[w]._id===p)return g[w].count;return 0},e.barPct=function(p){var g=e.data&&e.data.repos?e.data.repos.total:0;if(!g)return 0;var w=[p];p==="expired"&&w.push("expiring"),p==="removed"&&w.push("removing"),p==="preparing"&&w.push("download");var b=0;return w.forEach(function(T){b+=e.statusCount(T)}),Math.max(.4,b/g*100)},e.errPct=function(p){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[p]/g*100};function u(p){var g=p||[];return g.map(function(w,b){var T=g[b-1]||{},N=Object.assign({},w);return N.dailyRepositories=b?Math.max(0,(w.nbRepositories||0)-(T.nbRepositories||0)):0,N.dailyUsers=b?Math.max(0,(w.nbUsers||0)-(T.nbUsers||0)):0,N.dailyPageViews=b?Math.max(0,(w.nbPageViews||0)-(T.nbPageViews||0)):0,N})}function m(p){var g=p&&p.length?p[p.length-1]:{};return{repositories:g.dailyRepositories||0,users:g.dailyUsers||0,pageViews:g.dailyPageViews||0}}var h={};e.historyBarH=function(p,g){return!p||!h[g]?0:Math.max(1,Math.round(p[g]/h[g]*140))},e.historyLabel=function(p){if(!p||!p.date)return"";var g=new Date(p.date);return g.getUTCMonth()+1+"/"+g.getUTCDate()};function v(){t.get("/api/admin/overview").then(function(p){p.data.history=u(p.data.history),p.data.daily={today:m(p.data.history)},e.data=p.data,e.loading=!1,e.error=null,h={},(p.data.history||[]).forEach(function(g){["dailyPageViews","dailyRepositories","dailyUsers","nbUsers"].forEach(function(w){(!h[w]||g[w]>h[w])&&(h[w]=g[w])})})},function(p){e.loading=!1,e.error=p.data&&p.data.error||"Failed to load overview"})}v();var k=r(v,3e4);e.on("dispose",function(){r.cancel(k)})};var ja=[{path:"/connections",template:"partials/connections.htm",title:"GitHub connections \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Ma(e,t.http)},{path:"/signin",template:"partials/signin.htm",title:"Sign in \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>$a(e,t.http)},{path:"/",template:"partials/home.htm",title:"Anonymous GitHub \u2013 Share the code, not the author",preserveExplorer:!1,setup:(e,t)=>Ta(e,t.http,t.location,t.window,t.timeout)},{path:"/dashboard",template:"partials/dashboard.htm",title:"Your anonymizations \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Oa(e,t.http,t.location,t.promises,t.window,t.quotaService)},{path:"/pr-dashboard",redirect:"/dashboard"},{path:"/anonymize/:repoId?",template:"partials/anonymize.htm",title:"New anonymization \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Yn(e,t.http,t.html,t.params,t.location,t.translate,t.timeout)},{path:"/pull-request-anonymize/:pullRequestId?",template:"partials/anonymize.htm",title:"Anonymize a pull request \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Yn(e,t.http,t.html,t.params,t.location,t.translate,t.timeout)},{path:"/gist-anonymize/:gistId?",template:"partials/anonymize.htm",title:"Anonymize a gist \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Yn(e,t.http,t.html,t.params,t.location,t.translate,t.timeout)},{path:"/status/:repoId",template:"partials/status.htm",title:"Repository status \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Aa(e,t.http,t.params)},{path:"/conferences",template:"partials/conferences.htm",title:"Your conferences \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Pa(e,t.http,t.location)
Line truncated
|
||||
anonymous_github`)])])])])]),f(" Limitations "),s("h4",{class:"faq-cat"},[s("i",{class:"fas fa-exclamation-triangle mr-2"}),y("Limitations ")]),s("div",{class:"panel-group",id:"faq-limitations",role:"tablist","aria-multiselectable":"true"},[s("div",{class:"panel panel-default mb-3"},[s("div",{class:"panel-heading p-3",role:"tab",id:"headingLimitation"},[s("h3",{class:"panel-title"},[s("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? ")])]),s("div",{id:"limitation",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingLimitation"},[s("div",{class:"panel-body p-3"},[s("ul",null,[s("li",null," Anonymous GitHub only anonymizes text-based files. Binary files (compiled executables, archives, etc.) are served as-is without anonymization. "),s("li",null," Files larger than 8 MB are not supported. "),s("li",null," Static site generators (such as Jekyll) used with GitHub Pages are not fully supported, although Markdown files are converted to HTML. "),s("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 "),s("h4",{class:"faq-cat"},[s("i",{class:"fas fa-shield-alt mr-2"}),y("Privacy & Security ")]),s("div",{class:"panel-group",id:"faq-privacy",role:"tablist","aria-multiselectable":"true"},[s("div",{class:"panel panel-default mb-3"},[s("div",{class:"panel-heading p-3",role:"tab",id:"headingData"},[s("h3",{class:"panel-title"},[s("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? ")])]),s("div",{id:"data",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingData"},[s("div",{class:"panel-body p-3"},[s("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. ")])])]),s("div",{class:"panel panel-default mb-3"},[s("div",{class:"panel-heading p-3",role:"tab",id:"headingPermissions"},[s("h3",{class:"panel-title"},[s("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? ")])]),s("div",{id:"permissions",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingPermissions"},[s("div",{class:"panel-body p-3"},[s("p",null," Anonymous GitHub only reads your repositories \u2014 it never pushes commits, opens issues, modifies settings, or deletes anything. From your perspective as a user, the service is read-only. "),s("p",null,[y(" However, GitHub's OAuth scopes do not offer a read-only option for private repositories: the only scope that grants access to private repos is "),s("code",null,"repo"),y(", which is documented as full read/write access. To support users who want to anonymize a private repository, Anonymous GitHub must request that scope, and GitHub then displays the broader permission text at sign-in. The application itself only ever performs read operations against the GitHub API. ")]),s("p",null,[y(" If you only anonymize public repositories, the source code is open and can be audited on the "),s("a",{href:"https://github.com/tdurieux/anonymous_github/",target:"_blank"},"GitHub repository"),y(", or you can self-host your own instance. ")])])])]),s("div",{class:"panel panel-default mb-3"},[s("div",{class:"panel-heading p-3",role:"tab",id:"headingViewer"},[s("h3",{class:"panel-title"},[s("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? ")])]),s("div",{id:"viewer",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingViewer"},[s("div",{class:"panel-body p-3"},[s("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 "),s("h4",{class:"faq-cat"},[s("i",{class:"fas fa-server mr-2"}),y("Self-Hosting ")]),s("div",{class:"panel-group",id:"faq-hosting",role:"tablist","aria-multiselectable":"true"},[s("div",{class:"panel panel-default mb-3"},[s("div",{class:"panel-heading p-3",role:"tab",id:"headingDeploy"},[s("h3",{class:"panel-title"},[s("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-ho
Line truncated
|
||||
`)],{type:"text/csv;charset=utf-8"}),C=URL.createObjectURL(I),A=document.createElement("a");A.href=C,A.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(A),A.click(),document.body.removeChild(A),URL.revokeObjectURL(C)};function b(N){e.copyHint=`${N} copied`,n.timeout(()=>{e.copyHint=""},1500)}e.copyJson=N=>{navigator.clipboard.writeText(N._detailJson).then(()=>b("JSON"))},e.copyCurl=N=>{if(!N._url)return;let I=`curl -X ${N._method||"GET"} '${window.location.origin}${N._url}'`;navigator.clipboard.writeText(I).then(()=>b("curl"))},w();let T=r(()=>{e.query.autoRefresh&&w()},15e3);e.on("dispose",()=>r.cancel(T)),e.watch("query.search",k),e.watch("query.bucket",k),e.watch("query.sort",k),e.watch("query.group",k)},Ga=function(e,t,o,r){if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null){o.url("/");return}e.data=null,e.loading=!0,e.error=null;function n(p){if(p==null)return"\u2014";for(var g=["B","KB","MB","GB","TB"],w=0,b=p;b>=1024&&w<g.length-1;)b/=1024,w++;return b.toFixed(w>0?1:0)+" "+g[w]}e.humanBytes=n;function i(p){if(!p)return"\u2014";var g=Math.floor(p/86400),w=Math.floor(p%86400/3600),b=Math.floor(p%3600/60);return g>0?g+"d "+(w<10?"0":"")+w+"h":w>0?w+"h "+(b<10?"0":"")+b+"m":b+"m"}e.humanDuration=i;function a(p){return p==null?"\u2014":p>=1e6?(p/1e6).toFixed(1)+"M":p>=1e3?(p/1e3).toFixed(1)+"K":String(p)}e.humanNum=a,e.queueTotal=function(p){return p?(p.waiting||0)+(p.active||0)+(p.delayed||0)+(p.failed||0):0},e.statusCount=function(p){if(!e.data||!e.data.repos)return 0;for(var g=e.data.repos.statusBreakdown||[],w=0;w<g.length;w++)if(g[w]._id===p)return g[w].count;return 0},e.barPct=function(p){var g=e.data&&e.data.repos?e.data.repos.total:0;if(!g)return 0;var w=[p];p==="expired"&&w.push("expiring"),p==="removed"&&w.push("removing"),p==="preparing"&&w.push("download");var b=0;return w.forEach(function(T){b+=e.statusCount(T)}),Math.max(.4,b/g*100)},e.errPct=function(p){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[p]/g*100};function u(p){var g=p||[];return g.map(function(w,b){var T=g[b-1]||{},N=Object.assign({},w);return N.dailyRepositories=b?Math.max(0,(w.nbRepositories||0)-(T.nbRepositories||0)):0,N.dailyUsers=b?Math.max(0,(w.nbUsers||0)-(T.nbUsers||0)):0,N.dailyPageViews=b?Math.max(0,(w.nbPageViews||0)-(T.nbPageViews||0)):0,N})}function m(p){var g=p&&p.length?p[p.length-1]:{};return{repositories:g.dailyRepositories||0,users:g.dailyUsers||0,pageViews:g.dailyPageViews||0}}var h={};e.historyBarH=function(p,g){return!p||!h[g]?0:Math.max(1,Math.round(p[g]/h[g]*140))},e.historyLabel=function(p){if(!p||!p.date)return"";var g=new Date(p.date);return g.getUTCMonth()+1+"/"+g.getUTCDate()};function v(){t.get("/api/admin/overview").then(function(p){p.data.history=u(p.data.history),p.data.daily={today:m(p.data.history)},e.data=p.data,e.loading=!1,e.error=null,h={},(p.data.history||[]).forEach(function(g){["dailyPageViews","dailyRepositories","dailyUsers","nbUsers"].forEach(function(w){(!h[w]||g[w]>h[w])&&(h[w]=g[w])})})},function(p){e.loading=!1,e.error=p.data&&p.data.error||"Failed to load overview"})}v();var k=r(v,3e4);e.on("dispose",function(){r.cancel(k)})};var ja=[{path:"/connections",template:"partials/connections.htm",title:"GitHub connections \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Ma(e,t.http)},{path:"/signin",template:"partials/signin.htm",title:"Sign in \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>$a(e,t.http)},{path:"/",template:"partials/home.htm",title:"Anonymous GitHub \u2013 Share the code, not the author",preserveExplorer:!1,setup:(e,t)=>Ta(e,t.http,t.location,t.window,t.timeout)},{path:"/dashboard",template:"partials/dashboard.htm",title:"Your anonymizations \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Oa(e,t.http,t.location,t.promises,t.window,t.quotaService)},{path:"/pr-dashboard",redirect:"/dashboard"},{path:"/anonymize/:repoId?",template:"partials/anonymize.htm",title:"New anonymization \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Yn(e,t.http,t.html,t.params,t.location,t.translate,t.timeout)},{path:"/pull-request-anonymize/:pullRequestId?",template:"partials/anonymize.htm",title:"Anonymize a pull request \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Yn(e,t.http,t.html,t.params,t.location,t.translate,t.timeout)},{path:"/gist-anonymize/:gistId?",template:"partials/anonymize.htm",title:"Anonymize a gist \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Yn(e,t.http,t.html,t.params,t.location,t.translate,t.timeout)},{path:"/status/:repoId",template:"partials/status.htm",title:"Repository status \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Aa(e,t.http,t.params)},{path:"/conferences",template:"partials/conferences.htm",title:"Your conferences \u2013 Anonymous GitHub",preserveExplorer:!1,setup:(e,t)=>Pa(e,t.http,t.location)
Line truncated
|
||||
anonymous_github`)])])])])]),f(" Limitations "),s("h4",{class:"faq-cat"},[s("i",{class:"fas fa-exclamation-triangle mr-2"}),y("Limitations ")]),s("div",{class:"panel-group",id:"faq-limitations",role:"tablist","aria-multiselectable":"true"},[s("div",{class:"panel panel-default mb-3"},[s("div",{class:"panel-heading p-3",role:"tab",id:"headingLimitation"},[s("h3",{class:"panel-title"},[s("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? ")])]),s("div",{id:"limitation",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingLimitation"},[s("div",{class:"panel-body p-3"},[s("ul",null,[s("li",null," Anonymous GitHub only anonymizes text-based files. Binary files (compiled executables, archives, etc.) are served as-is without anonymization. "),s("li",null," Files larger than 8 MB are not supported. "),s("li",null," Static site generators (such as Jekyll) used with GitHub Pages are not fully supported, although Markdown files are converted to HTML. "),s("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 "),s("h4",{class:"faq-cat"},[s("i",{class:"fas fa-shield-alt mr-2"}),y("Privacy & Security ")]),s("div",{class:"panel-group",id:"faq-privacy",role:"tablist","aria-multiselectable":"true"},[s("div",{class:"panel panel-default mb-3"},[s("div",{class:"panel-heading p-3",role:"tab",id:"headingData"},[s("h3",{class:"panel-title"},[s("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? ")])]),s("div",{id:"data",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingData"},[s("div",{class:"panel-body p-3"},[s("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. ")])])]),s("div",{class:"panel panel-default mb-3"},[s("div",{class:"panel-heading p-3",role:"tab",id:"headingPermissions"},[s("h3",{class:"panel-title"},[s("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? ")])]),s("div",{id:"permissions",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingPermissions"},[s("div",{class:"panel-body p-3"},[s("p",null," Anonymous GitHub only reads your repositories \u2014 it never pushes commits, opens issues, modifies settings, or deletes anything. From your perspective as a user, the service is read-only. "),s("p",null,[y(" However, GitHub's OAuth scopes do not offer a read-only option for private repositories: the only scope that grants access to private repos is "),s("code",null,"repo"),y(", which is documented as full read/write access. To support users who want to anonymize a private repository, Anonymous GitHub must request that scope, and GitHub then displays the broader permission text at sign-in. The application itself only ever performs read operations against the GitHub API. ")]),s("p",null,[y(" If you only anonymize public repositories, the source code is open and can be audited on the "),s("a",{href:"https://github.com/tdurieux/anonymous_github/",target:"_blank"},"GitHub repository"),y(", or you can self-host your own instance. ")])])])]),s("div",{class:"panel panel-default mb-3"},[s("div",{class:"panel-heading p-3",role:"tab",id:"headingViewer"},[s("h3",{class:"panel-title"},[s("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? ")])]),s("div",{id:"viewer",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingViewer"},[s("div",{class:"panel-body p-3"},[s("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 "),s("h4",{class:"faq-cat"},[s("i",{class:"fas fa-server mr-2"}),y("Self-Hosting ")]),s("div",{class:"panel-group",id:"faq-hosting",role:"tablist","aria-multiselectable":"true"},[s("div",{class:"panel panel-default mb-3"},[s("div",{class:"panel-heading p-3",role:"tab",id:"headingDeploy"},[s("h3",{class:"panel-title"},[s("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-ho
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[12]||(t[12]=s("li",{class:"nav-item d-none d-lg-block"},[s("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"},[s("i",{class:"fas fa-bug d-lg-none mr-1","aria-hidden":"true"}),y("Report a bug ")])],-1)),e.isDarkMode?f("v-if",!0):(l(),d("li",XO,[s("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]=we(o=>{e.darkMode(!0)},["prevent"]))},[...t[7]||(t[7]=[s("i",{class:"fas fa-moon","aria-hidden":"true"},null,-1)])])])),e.isDarkMode?(l(),d("li",ZO,[s("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]=we(o=>{e.darkMode(!1)},["prevent"]))},[...t[8]||(t[8]=[s("i",{class:"fas fa-sun","aria-hidden":"true"},null,-1)])])])):f("v-if",!0),e.user?f("v-if",!0):(l(),d("li",xO,[...t[9]||(t[9]=[s("a",{class:"nav-link btn-signin",target:"_self",href:"/signin","data-offset":"30"},[s("i",{class:"fab fa-github mr-1"}),y(" Sign in ")],-1)])])),e.user?(l(),d("li",eA,[s("a",tA,[e.user?.photo?(l(),d("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,sA)):f("v-if",!0),s("span",nA,c(e.user?.username),1)]),s("div",oA,[s("h6",rA,"Signed in as @"+c(e.user?.username),1),t[10]||(t[10]=ge('<a class="dropdown-item" href="/profile"><i class="fas fa-sliders-h" aria-hidden="true"></i><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"><i class="fas fa-link" aria-hidden="true"></i><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"><i class="fas fa-bug" aria-hidden="true"></i><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><div class="dropdown-divider"></div><a class="dropdown-item" href="/api/user/logout" target="_self"><i class="fas fa-sign-out-alt" aria-hidden="true"></i><span>Sign out</span></a>',8))])])):f("v-if",!0)])])],2),e.generalMessage?(l(),d("div",{key:0,class:"navbar shadow generalMessage",innerHTML:e.sanitize(e.generalMessage)},null,8,iA)):f("v-if",!0)],64)}var aA={class:"paper-landing"},lA={class:"paper-hero"},dA={class:"paper-hero-copy"},uA={class:"paper-cta-row"},cA={key:0,href:"/signin",target:"_self",class:"btn-hero"},pA={key:1,href:"/anonymize",class:"btn-hero"},fA={class:"paper-stats paper-wrap",id:"metrics","aria-label":"Usage over the last 60 days"},mA={class:"paper-stats-grid"},hA={class:"paper-stat-value"},vA={class:"paper-stat-label"},yA=["viewBox"],gA=["x","y","width","height"],bA={key:1,class:"paper-stat-delta"},wA={class:"paper-features paper-wrap","aria-label":"Product features"},kA={class:"paper-features-list",role:"tablist","aria-label":"Features","aria-orientation":"vertical"},_A=["onClick","onKeydown","id","aria-controls","aria-selected","tabindex"],EA={class:"paper-eyebrow"},CA={class:"paper-feature-title"},NA={class:"paper-feature-more"},SA={class:"paper-feature-title paper-feature-title-m","aria-hidden":"true"},DA=["href","target"],RA={class:"paper-features-stage"},TA=["id","aria-labelledby"],OA={class:"paper-frame"},AA={class:"paper-frame-bar","aria-hidden":"true"},IA={class:"url"},VA=["src","alt"],PA={class:"paper-footer"},qA={class:"paper-footer-inner"},MA={class:"paper-footer-col"},$A={key:0,href:"/dashboard"},LA={key:1,href:"/conferences"},UA={class:"paper-footer-foot"};function pl(e,t){return l(),d("div",aA,[f(" Hero: copy on the left, the product on the right "),s("section",lA,[s("div",dA,[t[2]||(t[2]=s("div",{class:"paper-eyebrow"},"For double-blind peer review",-1)),t[3]||(t[3]=s("h1",{class:"hero-title"},[y(" Share the code,"),s("br"),s("span",{class:"accent"},"not the author.")],-1)),t[4]||(t[4]=s("p",{class:"hero-subtitle"}," Anonymous GitHub makes a read-only mirror of your repository, pull request, or gist with every trace of identity removed, so you can attach a link to your submission without breaking anonymity. ",-1)),s("div",uA,[e.user?f("v-if",!0):(l(),d("a",cA,[...t[0]||(t[0]=[s("i",{class:"fab fa-github mr-2","aria-hidden":"true"},null,-1),y("Sign in with GitHub ",-1)])])),e.user?(l(),d("a",pA," Anonymize a repository \
Line truncated
|
||||
label names the service and the tooltip says who to contact. `),t[12]||(t[12]=s("li",{class:"nav-item d-none d-lg-block"},[s("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"},[s("i",{class:"fas fa-bug d-lg-none mr-1","aria-hidden":"true"}),y("Report a bug ")])],-1)),e.isDarkMode?f("v-if",!0):(l(),d("li",xO,[s("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]=we(o=>{e.darkMode(!0)},["prevent"]))},[...t[7]||(t[7]=[s("i",{class:"fas fa-moon","aria-hidden":"true"},null,-1)])])])),e.isDarkMode?(l(),d("li",eA,[s("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]=we(o=>{e.darkMode(!1)},["prevent"]))},[...t[8]||(t[8]=[s("i",{class:"fas fa-sun","aria-hidden":"true"},null,-1)])])])):f("v-if",!0),e.user?f("v-if",!0):(l(),d("li",tA,[...t[9]||(t[9]=[s("a",{class:"nav-link btn-signin",target:"_self",href:"/signin","data-offset":"30"},[s("i",{class:"fab fa-github mr-1"}),y(" Sign in ")],-1)])])),e.user?(l(),d("li",sA,[s("a",nA,[e.user?.photo?(l(),d("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,oA)):f("v-if",!0),s("span",rA,c(e.user?.username),1)]),s("div",iA,[s("h6",aA,"Signed in as @"+c(e.user?.username),1),t[10]||(t[10]=ge('<a class="dropdown-item" href="/profile"><i class="fas fa-sliders-h" aria-hidden="true"></i><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"><i class="fas fa-link" aria-hidden="true"></i><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"><i class="fas fa-bug" aria-hidden="true"></i><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><div class="dropdown-divider"></div><a class="dropdown-item" href="/api/user/logout" target="_self"><i class="fas fa-sign-out-alt" aria-hidden="true"></i><span>Sign out</span></a>',8))])])):f("v-if",!0)])])],2),e.generalMessage?(l(),d("div",{key:0,class:"navbar shadow generalMessage",innerHTML:e.sanitize(e.generalMessage)},null,8,lA)):f("v-if",!0)],64)}var dA={class:"paper-landing"},uA={class:"paper-hero"},cA={class:"paper-hero-copy"},pA={class:"paper-cta-row"},fA={key:0,href:"/signin",target:"_self",class:"btn-hero"},mA={key:1,href:"/anonymize",class:"btn-hero"},hA={class:"paper-stats paper-wrap",id:"metrics","aria-label":"Usage over the last 60 days"},vA={class:"paper-stats-grid"},yA={class:"paper-stat-value"},gA={class:"paper-stat-label"},bA=["viewBox"],wA=["x","y","width","height"],kA={key:1,class:"paper-stat-delta"},_A={class:"paper-features paper-wrap","aria-label":"Product features"},EA={class:"paper-features-list",role:"tablist","aria-label":"Features","aria-orientation":"vertical"},CA=["onClick","onKeydown","id","aria-controls","aria-selected","tabindex"],NA={class:"paper-eyebrow"},SA={class:"paper-feature-title"},DA={class:"paper-feature-more"},RA={class:"paper-feature-title paper-feature-title-m","aria-hidden":"true"},TA=["href","target"],OA={class:"paper-features-stage"},AA=["id","aria-labelledby"],IA={class:"paper-frame"},VA={class:"paper-frame-bar","aria-hidden":"true"},PA={class:"url"},qA=["src","alt"],MA={class:"paper-footer"},$A={class:"paper-footer-inner"},UA={class:"paper-footer-col"},LA={key:0,href:"/dashboard"},FA={key:1,href:"/conferences"},zA={class:"paper-footer-foot"};function pl(e,t){return l(),d("div",dA,[f(" Hero: copy on the left, the product on the right "),s("section",uA,[s("div",cA,[t[2]||(t[2]=s("div",{class:"paper-eyebrow"},"For double-blind peer review",-1)),t[3]||(t[3]=s("h1",{class:"hero-title"},[y(" Share the code,"),s("br"),s("span",{class:"accent"},"not the author.")],-1)),t[4]||(t[4]=s("p",{class:"hero-subtitle"}," Anonymous GitHub makes a read-only mirror of your repository, pull request, or gist with every trace of identity removed, so you can attach a link to your submission without breaking anonymity. ",-1)),s("div",pA,[e.user?f("v-if",!0):(l(),d("a",fA,[...t[0]||(t[0]=[s("i",{class:"fab fa-github mr-2","aria-hidden":"true"},null,-1),y("Sign in with GitHub ",-1)])])),e.user?(l(),d("a",mA," Anonymize a repository \
Line truncated
|
||||
MIT CSAIL
|
||||
jane.smith@example.org`},UP={id:"termsHelp",class:"form-text text-muted"},FP={class:"invalid-feedback"},zP={id:"settings-display",class:"paper-settings-section"},HP={class:"form-group paper-check-list"},BP={class:"form-check"},GP={class:"form-check-input",type:"checkbox",id:"link",name:"link"},jP={class:"form-check"},WP={class:"form-check-input",type:"checkbox",id:"image",name:"image"},KP={class:"form-check"},YP={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},JP={class:"form-check"},QP={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},XP={id:"settings-features",class:"paper-settings-section"},ZP={class:"form-group paper-check-list"},xP={class:"form-check"},e3={class:"form-check-input",type:"checkbox",id:"page",name:"page"},t3={class:"form-check"},s3={class:"form-check-input",type:"checkbox",id:"loc",name:"loc"},n3={class:"form-check"},o3={class:"form-check-input",type:"checkbox",id:"update",name:"update"},r3={class:"form-group"},i3={class:"form-control",id:"mode",name:"mode"},a3={class:"form-text text-muted"},l3={id:"settings-expiration",class:"paper-settings-section"},d3={class:"form-group"},u3={class:"form-control",id:"expiration",name:"expiration"},c3={class:"paper-settings-footer"},p3={key:0,class:"paper-inline-alert paper-inline-alert-error",role:"alert"},f3=["textContent"],m3={class:"paper-settings-actions"},h3=["disabled"],v3={key:0,class:"fas fa-check mr-1","aria-hidden":"true"},y3={id:"settings-account",class:"paper-settings-section"},g3={class:"paper-account-card"},b3=["src"],w3={class:"paper-account-identity"},k3={class:"paper-account-name"},_3={class:"paper-danger-zone"},E3={key:0,class:"paper-inline-alert paper-inline-alert-error",role:"alert"},C3=["textContent"],N3=["disabled"];function yl(e,t){let o=be("paper-scrollspy"),r=be("field"),n=be("form");return l(),d("div",gP,[t[48]||(t[48]=ge('<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)),s("div",bP,[E((l(),d("aside",wP,[...t[2]||(t[2]=[ge('<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)])])),[[o]]),s("div",kP,[f(" Quota: same markup as the dashboard, driven by quotaService "),s("section",_P,[t[4]||(t[4]=s("div",{class:"paper-section-eyebrow"},"Quota",-1)),t[5]||(t[5]=s("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(),d("div",EP,[(l(),d(J,null,ne([{key:"repository",label:"Repositories",kind:"count"},{key:"storage",label:"Storage",kind:"bytes"},{key:"file",label:"Files",kind:"count"}],(i,a)=>s("div",CP,[s("div",NP,[s("span",SP,c(i?.label),1),i?.kind==="count"?(l(),d("span",DP,[y(c(e.fmt?.number(e.quota[i?.key].used)),1),e.quota[i?.key].unlimited?f("v-if",!0):(l(),d("span",RP," / "+c(e.fmt?.number(e.quota[i?.key].total)),1)),e.quota[i?.key].unlimited?(l(),d("span",TP,"Unlimited")):f("v-if",!0)])):f("v-if",!0),i?.kind==="bytes"?(l(),d("span",OP,[y(c(e.fmt?.humanFileSize(e.quota[i?.key].used)),1),e.quota[i?.key].unlimited?f("v-if",!0):(l(),d("span",AP," / "+c(e.fmt?.humanFileSize(e.quota[i?.key].total)),1)),e.quota[i?.key].unlimited?(l(),d("span",IP,"Unlimited")):f("v-if",!0)])):f("v-if",!0)]),s("div",{class:O(["quota-track","quota-"+e.quota[i?.key].level]),role:"progressbar","aria-valuemin":"0","aria-label":i?.label+" quota","aria-valuenow":e.quota[i?.key].used,"aria-valuemax":e.quota[i?.key].unlimited?e.quota[i?.key].used:e.quota[i?.key].total,"aria-valuetext":e.quota[i?.key].unlimited?"unlimited":e.fmt.number(e.quota[i?.key].percent,0)+"% used"},[e.quota[i?.key].unlimited?f("v-if",!0):(l(),d("div",{key:0,class:"quota-fill",style:Pe({width:e.quota[i?.key].percent+"%"})},null,4))],10,VP)])),64))])):f("v-if",!0),e.quota?f("v-if",!0):(l(),d("div",PP,[(l(),d(J,null,ne([1,2,3],(i,a)=>s("div",qP,[...t[3]||(t[3]=[s("div",{class:"quota-header"},[s("span",{class:"skeleton skeleton-line",style:{width:"40%"}}),s("span",{class:"skeleton skeleton-line",style:{width:"25%"}})],-1),s("div",{class:"quota-track"},null,-1)])])),64))]))]),E((l(),d("form",{class:"form needs-validation",name:"defaultsForm",novalidate:"",onSubmit:t[0]||(t[0]=we(i=>e.submitForm(i,()=>{e.saveDefault(i)}),["prevent"]))},[s("section",MP,[t[11]||(t[11]=s("div",{class:"paper-section-eyebrow"},"Terms to redact",-1)),t[12]||(t[12]=s("p",{class:"paper-section-copy"},"Pre-filled in every new anonymization. You can still edit the list per anonymization.",-1)),s("div",$P,[t[10]||(t[10]=s("label",{class:"paper-field-label",for:"terms"},"Default terms",-1)),E(s("tex
Line truncated
|
||||
`);for(let k=0;k<v.length;k++){let p=v[k];if(p.startsWith("diff --git")){h(),m();continue}if(p.startsWith("--- ")){i&&i.lines.length&&h(),m().oldPath=p.replace(/^--- (a\/)?/,"").trim();continue}if(p.startsWith("+++ ")){m().newPath=p.replace(/^\+\+\+ (b\/)?/,"").trim();continue}if(!(p.startsWith("index ")||p.startsWith("similarity index")||p.startsWith("rename ")||p.startsWith("new file mode")||p.startsWith("deleted file mode")||p.startsWith("Binary files"))){if(p.startsWith("@@")){let g=p.match(/@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);g&&(a=parseInt(g[1],10),u=parseInt(g[2],10)),m().lines.push({kind:"hunk",oldNo:"",newNo:"",text:p});continue}i&&(p.startsWith("+")?(i.lines.push({kind:"add",oldNo:"",newNo:u,text:p.slice(1)}),u++):p.startsWith("-")?(i.lines.push({kind:"remove",oldNo:a,newNo:"",text:p.slice(1)}),a++):(i.lines.push({kind:"ctx",oldNo:a,newNo:u,text:p.startsWith(" ")?p.slice(1):p}),a++,u++))}}return o(n,i),n.join("")}})({trustAsHtml:e=>e});function Mq(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function $q(e){return String(e??"").toUpperCase()}function Lq(e,t,o=0){return(e||[]).slice(o,o+t)}function Uq(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function Fq(e,t){if(!t)return e||[];let o=Array.isArray(t)?t:[t];return[...e||[]].sort((r,n)=>{for(let i of o){let a=i[0]==="-"?-1:1;i=i.replace(/^[+-]/,"");let u=i.split(".").reduce((h,v)=>h?.[v],r),m=i.split(".").reduce((h,v)=>h?.[v],n);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 zq(e,t){if(!e)return"";let o=new Date(e);if(isNaN(o))return String(e);if(!t||t==="mediumDate")return o.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});let r={yyyy:o.getFullYear(),MMM:o.toLocaleDateString(void 0,{month:"short"}),MM:String(o.getMonth()+1).padStart(2,"0"),dd:String(o.getDate()).padStart(2,"0"),d:o.getDate(),HH:String(o.getHours()).padStart(2,"0"),mm:String(o.getMinutes()).padStart(2,"0"),ss:String(o.getSeconds()).padStart(2,"0")};return t.replace(/yyyy|MMM|MM|dd|HH|mm|ss|d/g,n=>r[n])}function Hq(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}var Cl={ERRORS:{repository_job_cancelled:"The repository changed or was removed while processing.",storage_delete_failed:"Unable to remove cached files. Please try again later.",unknown_error:"Unknown error, contact the admin.",unreachable:"Anonymous GitHub is unreachable, contact the admin.",request_error:"Unable to download the file, check your connection or contact the admin.",not_found:"The requested resource could not be found.",not_connected:"You must be logged in to perform this action.",not_authorized:"You do not have permission to perform this action.",unable_to_connect_user:"Unable to connect your account. Please try again later.",user_not_found:"The requested user could not be found.",user_banned:"Your account has been banned. Contact the admin for more information.",repo_access_limited:"GitHub blocked access because the repository's organization restricts third-party OAuth apps. Ask an org owner to approve Anonymous GitHub under Settings \u2192 Third-party Access \u2192 OAuth app policy, or anonymize a personal fork instead.",repo_saml_enforcement:"The repository's organization enforces SAML single sign-on. Authorize your token for that organization (GitHub \u2192 Settings \u2192 Applications, or re-run the org's SSO sign-in), then retry. Alternatively, anonymize a personal fork.",repo_not_found:"The repository was not found on GitHub. Check the URL and spelling, make sure you are signed in to the account that can see it, and confirm the repo isn't hidden under an org that restricts third-party app access.",repo_empty:"The selected branch has no commits on GitHub. Push at least one commit, or pick a different branch, then retry.",repo_not_accessible:"Anonymous GitHub cannot access this repository. Verify the repository exists and that Anonymous GitHub has been authorized for the owning organization.",repository_archived:"This repository has been archived and its files are no longer available.",repository_expired:"The repository is expired.",invalid_status:"This action cannot be performed while the resource is in its current state.",repository_not_ready:"Anonymous GitHub is still processing the repository, it can take several minutes.",repository_not_accessible:"This repository is currently not accessible.",repo_is_updating:"Anonymous GitHub is still processing the repository, it can take several minutes.",invalid_repo:"The provided repository is not valid.",invalid_source_repository:"The repository source name is invalid; expected the form 'owner/name'.",repoId_not_defined:"A repository ID must be provided.",repoUrl_not_defined:"The repository URL needs to be defined.",source_not_provided:"A repository source must be provided.",github_rate_limit_exceeded:"GitHub
Line truncated
|
||||
jane.smith@example.org`},zP={id:"termsHelp",class:"form-text text-muted"},HP={class:"invalid-feedback"},BP={id:"settings-display",class:"paper-settings-section"},GP={class:"form-group paper-check-list"},jP={class:"form-check"},WP={class:"form-check-input",type:"checkbox",id:"link",name:"link"},KP={class:"form-check"},YP={class:"form-check-input",type:"checkbox",id:"image",name:"image"},JP={class:"form-check"},QP={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},XP={class:"form-check"},ZP={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},xP={id:"settings-features",class:"paper-settings-section"},e3={class:"form-group paper-check-list"},t3={class:"form-check"},s3={class:"form-check-input",type:"checkbox",id:"page",name:"page"},n3={class:"form-check"},o3={class:"form-check-input",type:"checkbox",id:"loc",name:"loc"},r3={class:"form-check"},i3={class:"form-check-input",type:"checkbox",id:"update",name:"update"},a3={class:"form-group"},l3={class:"form-control",id:"mode",name:"mode"},d3={class:"form-text text-muted"},u3={id:"settings-expiration",class:"paper-settings-section"},c3={class:"form-group"},p3={class:"form-control",id:"expiration",name:"expiration"},f3={class:"paper-settings-footer"},m3={key:0,class:"paper-inline-alert paper-inline-alert-error",role:"alert"},h3=["textContent"],v3={class:"paper-settings-actions"},y3=["disabled"],g3={key:0,class:"fas fa-check mr-1","aria-hidden":"true"},b3={id:"settings-account",class:"paper-settings-section"},w3={class:"paper-account-card"},k3=["src"],_3={class:"paper-account-identity"},E3={class:"paper-account-name"},C3={class:"paper-danger-zone"},N3={key:0,class:"paper-inline-alert paper-inline-alert-error",role:"alert"},S3=["textContent"],D3=["disabled"];function yl(e,t){let o=be("paper-scrollspy"),r=be("field"),n=be("form");return l(),d("div",wP,[t[48]||(t[48]=ge('<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)),s("div",kP,[E((l(),d("aside",_P,[...t[2]||(t[2]=[ge('<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)])])),[[o]]),s("div",EP,[f(" Quota: same markup as the dashboard, driven by quotaService "),s("section",CP,[t[4]||(t[4]=s("div",{class:"paper-section-eyebrow"},"Quota",-1)),t[5]||(t[5]=s("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(),d("div",NP,[(l(),d(J,null,ne([{key:"repository",label:"Repositories",kind:"count"},{key:"storage",label:"Storage",kind:"bytes"},{key:"file",label:"Files",kind:"count"}],(i,a)=>s("div",SP,[s("div",DP,[s("span",RP,c(i?.label),1),i?.kind==="count"?(l(),d("span",TP,[y(c(e.fmt?.number(e.quota[i?.key].used)),1),e.quota[i?.key].unlimited?f("v-if",!0):(l(),d("span",OP," / "+c(e.fmt?.number(e.quota[i?.key].total)),1)),e.quota[i?.key].unlimited?(l(),d("span",AP,"Unlimited")):f("v-if",!0)])):f("v-if",!0),i?.kind==="bytes"?(l(),d("span",IP,[y(c(e.fmt?.humanFileSize(e.quota[i?.key].used)),1),e.quota[i?.key].unlimited?f("v-if",!0):(l(),d("span",VP," / "+c(e.fmt?.humanFileSize(e.quota[i?.key].total)),1)),e.quota[i?.key].unlimited?(l(),d("span",PP,"Unlimited")):f("v-if",!0)])):f("v-if",!0)]),s("div",{class:O(["quota-track","quota-"+e.quota[i?.key].level]),role:"progressbar","aria-valuemin":"0","aria-label":i?.label+" quota","aria-valuenow":e.quota[i?.key].used,"aria-valuemax":e.quota[i?.key].unlimited?e.quota[i?.key].used:e.quota[i?.key].total,"aria-valuetext":e.quota[i?.key].unlimited?"unlimited":e.fmt.number(e.quota[i?.key].percent,0)+"% used"},[e.quota[i?.key].unlimited?f("v-if",!0):(l(),d("div",{key:0,class:"quota-fill",style:Pe({width:e.quota[i?.key].percent+"%"})},null,4))],10,qP)])),64))])):f("v-if",!0),e.quota?f("v-if",!0):(l(),d("div",MP,[(l(),d(J,null,ne([1,2,3],(i,a)=>s("div",$P,[...t[3]||(t[3]=[s("div",{class:"quota-header"},[s("span",{class:"skeleton skeleton-line",style:{width:"40%"}}),s("span",{class:"skeleton skeleton-line",style:{width:"25%"}})],-1),s("div",{class:"quota-track"},null,-1)])])),64))]))]),E((l(),d("form",{class:"form needs-validation",name:"defaultsForm",novalidate:"",onSubmit:t[0]||(t[0]=we(i=>e.submitForm(i,()=>{e.saveDefault(i)}),["prevent"]))},[s("section",UP,[t[11]||(t[11]=s("div",{class:"paper-section-eyebrow"},"Terms to redact",-1)),t[12]||(t[12]=s("p",{class:"paper-section-copy"},"Pre-filled in every new anonymization. You can still edit the list per anonymization.",-1)),s("div",LP,[t[10]||(t[10]=s("label",{class:"paper-field-label",for:"terms"},"Default terms",-1)),E(s("tex
Line truncated
|
||||
`);for(let k=0;k<v.length;k++){let p=v[k];if(p.startsWith("diff --git")){h(),m();continue}if(p.startsWith("--- ")){i&&i.lines.length&&h(),m().oldPath=p.replace(/^--- (a\/)?/,"").trim();continue}if(p.startsWith("+++ ")){m().newPath=p.replace(/^\+\+\+ (b\/)?/,"").trim();continue}if(!(p.startsWith("index ")||p.startsWith("similarity index")||p.startsWith("rename ")||p.startsWith("new file mode")||p.startsWith("deleted file mode")||p.startsWith("Binary files"))){if(p.startsWith("@@")){let g=p.match(/@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);g&&(a=parseInt(g[1],10),u=parseInt(g[2],10)),m().lines.push({kind:"hunk",oldNo:"",newNo:"",text:p});continue}i&&(p.startsWith("+")?(i.lines.push({kind:"add",oldNo:"",newNo:u,text:p.slice(1)}),u++):p.startsWith("-")?(i.lines.push({kind:"remove",oldNo:a,newNo:"",text:p.slice(1)}),a++):(i.lines.push({kind:"ctx",oldNo:a,newNo:u,text:p.startsWith(" ")?p.slice(1):p}),a++,u++))}}return o(n,i),n.join("")}})({trustAsHtml:e=>e});function Uq(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function Lq(e){return String(e??"").toUpperCase()}function Fq(e,t,o=0){return(e||[]).slice(o,o+t)}function zq(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function Hq(e,t){if(!t)return e||[];let o=Array.isArray(t)?t:[t];return[...e||[]].sort((r,n)=>{for(let i of o){let a=i[0]==="-"?-1:1;i=i.replace(/^[+-]/,"");let u=i.split(".").reduce((h,v)=>h?.[v],r),m=i.split(".").reduce((h,v)=>h?.[v],n);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 Bq(e,t){if(!e)return"";let o=new Date(e);if(isNaN(o))return String(e);if(!t||t==="mediumDate")return o.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});let r={yyyy:o.getFullYear(),MMM:o.toLocaleDateString(void 0,{month:"short"}),MM:String(o.getMonth()+1).padStart(2,"0"),dd:String(o.getDate()).padStart(2,"0"),d:o.getDate(),HH:String(o.getHours()).padStart(2,"0"),mm:String(o.getMinutes()).padStart(2,"0"),ss:String(o.getSeconds()).padStart(2,"0")};return t.replace(/yyyy|MMM|MM|dd|HH|mm|ss|d/g,n=>r[n])}function Gq(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}var Cl={ERRORS:{repository_job_cancelled:"The repository changed or was removed while processing.",storage_delete_failed:"Unable to remove cached files. Please try again later.",unknown_error:"Unknown error, contact the admin.",unreachable:"Anonymous GitHub is unreachable, contact the admin.",request_error:"Unable to download the file, check your connection or contact the admin.",not_found:"The requested resource could not be found.",not_connected:"You must be logged in to perform this action.",not_authorized:"You do not have permission to perform this action.",unable_to_connect_user:"Unable to connect your account. Please try again later.",user_not_found:"The requested user could not be found.",user_banned:"Your account has been banned. Contact the admin for more information.",repo_access_limited:"GitHub blocked access because the repository's organization restricts third-party OAuth apps. Ask an org owner to approve Anonymous GitHub under Settings \u2192 Third-party Access \u2192 OAuth app policy, or anonymize a personal fork instead.",repo_saml_enforcement:"The repository's organization enforces SAML single sign-on. Authorize your token for that organization (GitHub \u2192 Settings \u2192 Applications, or re-run the org's SSO sign-in), then retry. Alternatively, anonymize a personal fork.",repo_not_found:"The repository was not found on GitHub. Check the URL and spelling, make sure you are signed in to the account that can see it, and confirm the repo isn't hidden under an org that restricts third-party app access.",repo_empty:"The selected branch has no commits on GitHub. Push at least one commit, or pick a different branch, then retry.",repo_not_accessible:"Anonymous GitHub cannot access this repository. Verify the repository exists and that Anonymous GitHub has been authorized for the owning organization.",repository_archived:"This repository has been archived and its files are no longer available.",repository_expired:"The repository is expired.",invalid_status:"This action cannot be performed while the resource is in its current state.",repository_not_ready:"Anonymous GitHub is still processing the repository, it can take several minutes.",repository_not_accessible:"This repository is currently not accessible.",repo_is_updating:"Anonymous GitHub is still processing the repository, it can take several minutes.",invalid_repo:"The provided repository is not valid.",invalid_source_repository:"The repository source name is invalid; expected the form 'owner/name'.",repoId_not_defined:"A repository ID must be provided.",repoUrl_not_defined:"The repository URL needs to be defined.",source_not_provided:"A repository source must be provided.",github_rate_limit_exceeded:"GitHub
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
@vue/shared/dist/shared.esm-bundler.js:
|
||||
|
||||
@@ -38,6 +38,12 @@ async function previewToken(req: express.Request) {
|
||||
const resource = await db.getRepository(req.query.anonymizedRepoId);
|
||||
isOwnerCoauthorOrAdmin(resource, user);
|
||||
if (resource.model.source.repositoryName?.toLowerCase() !== `${req.params.owner}/${req.params.repo}`.toLowerCase()) throw appError("repo_not_found", 404);
|
||||
if (req.query.reconnect === "1") {
|
||||
if (user.id !== resource.owner.id) throw appError("not_owner", 403);
|
||||
resource.assertNotArchived();
|
||||
return (await selectRepositoryAccess(user.id, resource.model.source.repositoryName,
|
||||
resource.model.githubAccess?.kind || "oauth")).token;
|
||||
}
|
||||
return getToken(resource);
|
||||
}
|
||||
return (await selectRepositoryAccess(user.id, `${req.params.owner}/${req.params.repo}`, req.query.connection)).token;
|
||||
@@ -247,8 +253,8 @@ router.get(
|
||||
owner: req.params.owner,
|
||||
repo: req.params.repo,
|
||||
accessToken: token,
|
||||
repositoryID: req.query.repositoryID as string,
|
||||
force: req.query.force == "1",
|
||||
repositoryID: req.query.reconnect === "1" ? undefined : req.query.repositoryID as string,
|
||||
force: req.query.reconnect === "1" || req.query.force == "1",
|
||||
});
|
||||
res.json(repo.toJSON());
|
||||
} catch (error) {
|
||||
@@ -266,13 +272,13 @@ router.get(
|
||||
accessToken: token,
|
||||
owner: req.params.owner,
|
||||
repo: req.params.repo,
|
||||
repositoryID: req.query.repositoryID as string,
|
||||
force: req.query.force == "1",
|
||||
repositoryID: req.query.reconnect === "1" ? undefined : req.query.repositoryID as string,
|
||||
force: req.query.reconnect === "1" || req.query.force == "1",
|
||||
});
|
||||
return res.json(
|
||||
await repository.branches({
|
||||
accessToken: token,
|
||||
force: req.query.force == "1",
|
||||
force: req.query.reconnect === "1" || req.query.force == "1",
|
||||
})
|
||||
);
|
||||
} catch (error) {
|
||||
@@ -291,8 +297,8 @@ router.get(
|
||||
owner: req.params.owner,
|
||||
repo: req.params.repo,
|
||||
accessToken: token,
|
||||
repositoryID: req.query.repositoryID as string,
|
||||
force: req.query.force == "1",
|
||||
repositoryID: req.query.reconnect === "1" ? undefined : req.query.repositoryID as string,
|
||||
force: req.query.reconnect === "1" || req.query.force == "1",
|
||||
});
|
||||
if (!repo) {
|
||||
throw new AnonymousError("repo_not_found", {
|
||||
@@ -303,7 +309,7 @@ router.get(
|
||||
return res.send(
|
||||
await repo.readme({
|
||||
accessToken: token,
|
||||
force: req.query.force == "1",
|
||||
force: req.query.reconnect === "1" || req.query.force == "1",
|
||||
branch: req.query.branch as string,
|
||||
})
|
||||
);
|
||||
@@ -482,7 +488,17 @@ router.post(
|
||||
// the fly per request. Re-running the download queue is therefore only
|
||||
// needed when the underlying snapshot moves. Other edits (e.g. turning
|
||||
// off auto-update — see #360) just persist and return.
|
||||
const sourceChanged = hasRepositorySourceChanged(repo.model, repoUpdate);
|
||||
const reconnecting = repoUpdate.reconnectRepositoryId !== undefined;
|
||||
if (reconnecting) {
|
||||
if (user.id !== repo.owner.id) throw appError("not_owner", 403);
|
||||
if (typeof repoUpdate.reconnectRepositoryId !== "string" ||
|
||||
!/^gh_[1-9][0-9]*$/.test(repoUpdate.reconnectRepositoryId) ||
|
||||
repoUpdate.fullName !== repo.model.source.repositoryName) throw appError("repo_not_found", 400);
|
||||
if (repo.status && [RepositoryStatus.PREPARING, RepositoryStatus.DOWNLOAD, RepositoryStatus.REMOVING,
|
||||
RepositoryStatus.EXPIRING, RepositoryStatus.QUEUE].includes(repo.status)) throw appError("invalid_status", 409);
|
||||
repo.assertNotArchived();
|
||||
}
|
||||
const sourceChanged = reconnecting || hasRepositorySourceChanged(repo.model, repoUpdate);
|
||||
const previousAccessRevision = repo.model.githubAccess?.revision;
|
||||
|
||||
updateRepoModel(repo.model, repoUpdate);
|
||||
@@ -501,13 +517,14 @@ router.post(
|
||||
});
|
||||
}
|
||||
if (repoUpdate.fullName !== repo.model.source.repositoryName && user.id !== repo.owner.id) throw appError("not_owner", 403);
|
||||
const sourceAccess = repo.model.githubAccess?.kind === "github-app" && repoUpdate.fullName === repo.model.source.repositoryName
|
||||
const sourceAccess = !reconnecting && repo.model.githubAccess?.kind === "github-app" && repoUpdate.fullName === repo.model.source.repositoryName
|
||||
? { token: await boundAppToken(repo.owner.id, repo.model.githubAccess, repo.model.source.repositoryName), binding: repo.model.githubAccess }
|
||||
: await selectRepositoryAccess(repo.owner.id, `${parsedRepository.owner}/${parsedRepository.name}`, repo.model.githubAccess?.kind || "oauth");
|
||||
const repository = await getRepositoryFromGitHub({
|
||||
accessToken: sourceAccess.token,
|
||||
owner: parsedRepository.owner,
|
||||
repo: parsedRepository.name,
|
||||
force: reconnecting,
|
||||
});
|
||||
if (!repository) {
|
||||
throw new AnonymousError("repo_not_found", {
|
||||
@@ -515,9 +532,18 @@ router.post(
|
||||
httpStatus: 404,
|
||||
});
|
||||
}
|
||||
await repository.getCommitInfo(repoUpdate.source.commit, {
|
||||
// Pin the owner's preview to a GitHub identity, even if the name is
|
||||
// deleted and recreated again before Save.
|
||||
if (reconnecting && (repository.id !== repoUpdate.reconnectRepositoryId ||
|
||||
(sourceAccess.binding.kind === "github-app" &&
|
||||
repository.id !== `gh_${sourceAccess.binding.repositoryId}`))) throw appError("connection_changed", 409);
|
||||
if (reconnecting && !(await repository.branches({ accessToken: sourceAccess.token, force: true }))
|
||||
.some(branch => branch.name === repoUpdate.source.branch)) throw appError("branch_not_specified", 400);
|
||||
const commit = await repository.getCommitInfo(repoUpdate.source.commit, {
|
||||
accessToken: sourceAccess.token,
|
||||
});
|
||||
if (reconnecting) repo.model.source.commitDate = commit.commit.committer?.date
|
||||
? new Date(commit.commit.committer.date) : undefined;
|
||||
repo.model.githubAccess = { ...sourceAccess.binding, revision: randomUUID() };
|
||||
repo.model.source.repositoryId = repository.model.id;
|
||||
repo.model.source.repositoryName =
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
const { expect } = require("chai");
|
||||
require("ts-node/register/transpile-only");
|
||||
const Repository = require("../src/core/Repository").default;
|
||||
const Model = require("../src/core/model/anonymizedRepositories/anonymizedRepositories.model").default;
|
||||
const utils = require("../src/server/routes/route-utils");
|
||||
const github = require("../src/core/source/GitHubRepository");
|
||||
const app = require("../src/core/github-app");
|
||||
const tokens = require("../src/core/GitHubUtils");
|
||||
const db = require("../src/server/database");
|
||||
const queue = require("../src/queue");
|
||||
const router = require("../src/server/routes/repository-private").default;
|
||||
const handler = (path, method = "get") => router.stack.find(layer =>
|
||||
layer.route?.path === path && layer.route.methods[method]).route.stack[0].handle;
|
||||
|
||||
describe("reconnecting a recreated repository", () => {
|
||||
const restores = [];
|
||||
function stub(object, key, value) {
|
||||
const original = object[key]; restores.push(() => { object[key] = original; }); object[key] = value;
|
||||
}
|
||||
let repo, user, fresh, selected, writes, removals, jobs, commitChecks;
|
||||
beforeEach(() => {
|
||||
repo = new Repository(new Model({ repoId: "recreated", status: "ready",
|
||||
owner: "507f1f77bcf86cd799439011",
|
||||
githubAccess: { kind: "github-app", publicRead: true, repositoryId: 1380842178, revision: "old" },
|
||||
source: { repositoryName: "owner/repo", repositoryId: "old-record", branch: "main", commit: "deadbeef" },
|
||||
options: { terms: ["author"], expirationMode: "never" },
|
||||
}));
|
||||
user = { id: repo.owner.id, model: { id: repo.owner.id } };
|
||||
selected = { token: "fresh-token", binding: { kind: "github-app", publicRead: true, repositoryId: 1396237353, revision: "fresh" } };
|
||||
writes = []; removals = []; jobs = []; commitChecks = [];
|
||||
fresh = { id: "gh_1396237353", model: { id: "new-record" }, fullName: "owner/repo",
|
||||
toJSON: () => ({ externalId: "gh_1396237353" }),
|
||||
branches: async () => [{ name: "main", commit: "abcdef" }],
|
||||
readme: async () => "replacement readme",
|
||||
getCommitInfo: async sha => { commitChecks.push(sha); return { commit: { committer: { date: "2026-09-29T00:00:00Z" } } }; },
|
||||
};
|
||||
stub(utils, "getRepo", async () => repo);
|
||||
stub(utils, "getUser", async () => user);
|
||||
stub(utils, "handleError", error => { throw error; });
|
||||
stub(db, "getRepository", async () => repo);
|
||||
stub(app, "selectRepositoryAccess", async (owner, name, kind) => {
|
||||
expect([owner, name, kind]).to.deep.equal([repo.owner.id, "owner/repo", "github-app"]);
|
||||
return selected;
|
||||
});
|
||||
stub(app, "boundAppToken", async () => { throw new Error("old binding is inaccessible"); });
|
||||
stub(tokens, "getToken", async () => { throw new Error("old binding is inaccessible"); });
|
||||
stub(github, "getRepositoryFromGitHub", async options => {
|
||||
expect(options.accessToken).to.equal("fresh-token");
|
||||
expect(options.force).to.equal(true);
|
||||
expect(options.repositoryID).to.equal(undefined);
|
||||
return fresh;
|
||||
});
|
||||
stub(Model, "updateOne", (filter, update) => ({ exec: async () => {
|
||||
writes.push({ filter, update }); return { matchedCount: 1 };
|
||||
} }));
|
||||
repo.remove = async options => { removals.push(options); };
|
||||
repo.updateStatus = async status => { repo.model.status = status; };
|
||||
stub(queue, "downloadQueue", { add: async (...args) => { jobs.push(args); } });
|
||||
});
|
||||
afterEach(() => { while (restores.length) restores.pop()(); });
|
||||
function preview(query = {}) {
|
||||
return { params: { owner: "owner", repo: "repo" }, query: {
|
||||
anonymizedRepoId: repo.repoId, repositoryID: "old-record", reconnect: "1", ...query,
|
||||
} };
|
||||
}
|
||||
function form(extra = {}) {
|
||||
return { body: { repoId: repo.repoId, fullName: "owner/repo", reconnectRepositoryId: "gh_1396237353",
|
||||
source: { branch: "main", commit: "abcdef" }, terms: ["author"], options: { expirationMode: "never" }, ...extra } };
|
||||
}
|
||||
async function failure(work, message) {
|
||||
let error;
|
||||
try { await work(); } catch (caught) { error = caught; }
|
||||
expect(error?.message).to.equal(message);
|
||||
expect(writes).to.have.length(0);
|
||||
expect(removals).to.have.length(0);
|
||||
expect(jobs).to.have.length(0);
|
||||
}
|
||||
|
||||
for (const path of ["/:owner/:repo/", "/:owner/:repo/branches", "/:owner/:repo/readme"]) {
|
||||
it(`previews ${path} with fresh access without changing the anonymization`, async () => {
|
||||
let result;
|
||||
await handler(path)(preview(), { json: value => { result = value; }, send: value => { result = value; } });
|
||||
expect(result).not.to.equal(undefined);
|
||||
expect(repo.model.githubAccess.repositoryId).to.equal(1380842178);
|
||||
expect(writes).to.have.length(0);
|
||||
});
|
||||
it(`keeps the bound identity for ordinary ${path} requests`, async () => {
|
||||
await failure(() => handler(path)(preview({ reconnect: undefined }), {}), "old binding is inaccessible");
|
||||
});
|
||||
it(`denies a non-owner reconnect preview at ${path}`, async () => {
|
||||
user = { id: "admin", isAdmin: true };
|
||||
await failure(() => handler(path)(preview(), {}), "not_owner");
|
||||
});
|
||||
}
|
||||
|
||||
it("rebinds the source and downloads the replacement even when the old commit no longer exists", async () => {
|
||||
await handler("/:repoId/", "post")(form(), { json: () => {} });
|
||||
expect(commitChecks).to.deep.equal(["abcdef"]);
|
||||
expect(writes).to.have.length(1);
|
||||
const saved = writes[0];
|
||||
expect(saved.filter["githubAccess.revision"]).to.equal("old");
|
||||
expect(saved.update.$set.githubAccess.repositoryId).to.equal(1396237353);
|
||||
expect(saved.update.$set.githubAccess.revision).not.to.equal("old");
|
||||
expect(saved.update.$set.source.repositoryId).to.equal("new-record");
|
||||
expect(saved.update.$set.source.commit).to.equal("abcdef");
|
||||
expect(saved.update.$set.source.commitDate).to.deep.equal(new Date("2026-09-29T00:00:00Z"));
|
||||
expect(removals).to.deep.equal([{ accessRevision: "old" }]);
|
||||
expect(jobs[0][1]).to.deep.equal({ repoId: "recreated" });
|
||||
});
|
||||
it("rebuilds when only the repository identity changed", async () => {
|
||||
await handler("/:repoId/", "post")(form({ source: { branch: "main", commit: "deadbeef" } }), { json: () => {} });
|
||||
expect(jobs).to.have.length(1);
|
||||
});
|
||||
it("does not reconnect implicitly on an ordinary edit", async () => {
|
||||
await failure(() => handler("/:repoId/", "post")(form({ reconnectRepositoryId: undefined }), {}), "old binding is inaccessible");
|
||||
});
|
||||
it("rejects a non-owner save", async () => {
|
||||
user = { id: "admin", isAdmin: true };
|
||||
await failure(() => handler("/:repoId/", "post")(form(), {}), "not_owner");
|
||||
});
|
||||
it("rejects a coauthor's reconnect preview and save", async () => {
|
||||
repo.model.coauthors = [{ username: "coauthor", githubId: "42" }];
|
||||
user = { id: "other", username: "coauthor", model: { id: "other", externalIDs: { github: "42" } } };
|
||||
await failure(() => handler("/:owner/:repo/branches")(preview(), {}), "not_owner");
|
||||
await failure(() => handler("/:repoId/", "post")(form(), {}), "not_owner");
|
||||
});
|
||||
it("does not remove files if the connection changed during validation", async () => {
|
||||
repo.remove = Repository.prototype.remove.bind(repo);
|
||||
repo.resetSate = async () => { throw new Error("must not remove files"); };
|
||||
stub(Model, "updateOne", async () => ({ matchedCount: 0 }));
|
||||
await failure(() => handler("/:repoId/", "post")(form(), {}), "connection_changed");
|
||||
});
|
||||
it("rejects replacement after the owner previewed the repository", async () => {
|
||||
fresh.id = "gh_999999";
|
||||
await failure(() => handler("/:repoId/", "post")(form(), {}), "connection_changed");
|
||||
});
|
||||
it("rejects a binding that differs from the resolved repository", async () => {
|
||||
selected.binding.repositoryId = 999999;
|
||||
await failure(() => handler("/:repoId/", "post")(form(), {}), "connection_changed");
|
||||
});
|
||||
it("preserves the snapshot when new access is denied", async () => {
|
||||
stub(app, "selectRepositoryAccess", async () => { throw new Error("github_app_access_required"); });
|
||||
await failure(() => handler("/:repoId/", "post")(form(), {}), "github_app_access_required");
|
||||
});
|
||||
it("rejects a missing replacement branch", async () => {
|
||||
fresh.branches = async () => [];
|
||||
await failure(() => handler("/:repoId/", "post")(form(), {}), "branch_not_specified");
|
||||
});
|
||||
it("preserves the snapshot when the selected commit is inaccessible", async () => {
|
||||
fresh.getCommitInfo = async () => { throw new Error("commit_not_found"); };
|
||||
await failure(() => handler("/:repoId/", "post")(form(), {}), "commit_not_found");
|
||||
});
|
||||
for (const status of ["preparing", "queue", "download", "removing", "expiring"]) {
|
||||
it(`does not reconnect during ${status}`, async () => {
|
||||
repo.model.status = status;
|
||||
await failure(() => handler("/:repoId/", "post")(form(), {}), "invalid_status");
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -298,6 +298,47 @@ describe("Vue 3 UI", function () {
|
||||
});
|
||||
}
|
||||
|
||||
it("reconnects a recreated source without saving until the owner submits", async function () {
|
||||
const oldCommit = "deadbeef";
|
||||
const newCommit = "1a212f1deb74b123804ec90d098c0f843c30da5b";
|
||||
const requireReconnect = data => request => request.url.searchParams.get("reconnect") === "1"
|
||||
? data : { __status: 404, body: { error: "repo_not_found" } };
|
||||
ui = await browser("/anonymize/test", {
|
||||
"/api/repo/test": request => request.method === "POST" ? { status: "preparing" } : {
|
||||
connection: "github-app", role: "owner",
|
||||
source: { fullName: "owner/repo", repositoryID: "old-record", branch: "main", commit: oldCommit },
|
||||
options: { terms: ["author"], update: false, expirationMode: "never" },
|
||||
},
|
||||
"/api/repo/owner/repo/": requireReconnect({ id: "new-record", externalId: "gh_1396237353", defaultBranch: "main" }),
|
||||
"/api/repo/owner/repo/branches": requireReconnect([{ name: "main", commit: newCommit }]),
|
||||
"/api/repo/owner/repo/readme": requireReconnect("replacement readme"),
|
||||
});
|
||||
const button = [...ui.window.document.querySelectorAll("button")].find(b => b.textContent === "Reconnect source repository");
|
||||
expect(button).not.to.equal(undefined);
|
||||
const before = ui.requests.length;
|
||||
ui.window.confirm = () => false;
|
||||
button.click();
|
||||
await delay(20);
|
||||
expect(ui.requests.length).to.equal(before);
|
||||
ui.window.confirm = () => true;
|
||||
button.click();
|
||||
await delay(100);
|
||||
const previews = ui.requests.filter(r => r.url.searchParams.get("reconnect") === "1");
|
||||
expect(previews.some(r => r.url.pathname.endsWith("/branches"))).to.equal(true);
|
||||
for (const request of previews) {
|
||||
expect(request.url.searchParams.get("anonymizedRepoId")).to.equal("test");
|
||||
expect(request.url.searchParams.has("repositoryID")).to.equal(false);
|
||||
}
|
||||
expect(ui.window.document.querySelector("#commit").value).to.equal(newCommit);
|
||||
expect(ui.requests.filter(r => r.method === "POST" && r.url.pathname === "/api/repo/test")).to.have.length(0);
|
||||
ui.window.document.querySelector("button[type=submit]").click();
|
||||
await delay(30);
|
||||
const save = ui.requests.find(r => r.method === "POST" && r.url.pathname === "/api/repo/test");
|
||||
expect(save?.payload.reconnectRepositoryId).to.equal("gh_1396237353");
|
||||
expect(save.payload.source.commit).to.equal(newCommit);
|
||||
expect(save.payload.terms).to.deep.equal(["author"]);
|
||||
});
|
||||
|
||||
it("still rejects a missing commit for a repository with auto-update disabled", async function () {
|
||||
ui = await browser("/anonymize/test", {
|
||||
"/api/repo/test": { source: { fullName: "owner/repo", branch: "main", commit: "abcdef123" }, options: { terms: [], update: false } },
|
||||
|
||||
Reference in new issue
Block a user