Skip to content

Commit 3573de3

Browse files
authored
Merge branch 'main' into feat/publish-plugin-sample
2 parents 6aa8f88 + 1e35b93 commit 3573de3

File tree

17 files changed

+223
-76
lines changed

17 files changed

+223
-76
lines changed

.env.development

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
VITE_API_URI=http://localhost:8080
2-
VITE_SERVER_URI=http://localhost:8000

config.schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
"description": "Customisable questions to add to attestation form",
2121
"type": "object"
2222
},
23+
"domains": {
24+
"description": "Provide domains to use alternative to the defaults",
25+
"type": "object"
26+
},
2327
"privateOrganizations": {
2428
"description": "Pattern searches for listed private organizations are disabled",
2529
"type": "array"

cypress/e2e/repo.cy.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
describe('Repo', () => {
2+
beforeEach(() => {
3+
cy.visit('/admin/repo');
4+
5+
// prevent failures on 404 request and uncaught promises
6+
cy.on('uncaught:exception', () => false);
7+
});
8+
9+
describe('Code button for repo row', () => {
10+
it('Opens tooltip with correct content and can copy', () => {
11+
const cloneURL = 'http://localhost:8000/finos/test-repo.git';
12+
const tooltipQuery = 'div[role="tooltip"]';
13+
14+
cy
15+
// tooltip isn't open to start with
16+
.get(tooltipQuery)
17+
.should('not.exist');
18+
19+
cy
20+
// find the entry for finos/test-repo
21+
.get('a[href="/admin/repo/test-repo"]')
22+
// take it's parent row
23+
.closest('tr')
24+
// find the nearby span containing Code we can click to open the tooltip
25+
.find('span')
26+
.contains('Code')
27+
.should('exist')
28+
.click();
29+
30+
cy
31+
// find the newly opened tooltip
32+
.get(tooltipQuery)
33+
.should('exist')
34+
.find('span')
35+
// check it contains the url we expect
36+
.contains(cloneURL)
37+
.should('exist')
38+
.parent()
39+
// find the adjacent span that contains the svg
40+
.find('span')
41+
.next()
42+
// check it has the copy icon first and click it
43+
.get('svg.octicon-copy')
44+
.should('exist')
45+
.click()
46+
// check the icon has changed to the check icon
47+
.get('svg.octicon-copy')
48+
.should('not.exist')
49+
.get('svg.octicon-check')
50+
.should('exist');
51+
52+
// failed to successfully check the clipboard
53+
});
54+
});
55+
});

cypress/support/commands.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,16 @@
2222
//
2323
//
2424
// -- This will overwrite an existing command --
25-
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
25+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
26+
27+
// start of a login command with sessions
28+
// TODO: resolve issues with the CSRF token
29+
Cypress.Commands.add('login', (username, password) => {
30+
cy.session([username, password], () => {
31+
cy.visit('/login');
32+
cy.get('[data-test=username]').type(username);
33+
cy.get('[data-test=password]').type(password);
34+
cy.get('[data-test=login]').click();
35+
cy.url().should('contain', '/admin/profile');
36+
});
37+
});

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "@finos/git-proxy",
3-
"version": "1.4.0",
3+
"version": "1.5.1",
44
"description": "Deploy custom push protections and policies on top of Git.",
55
"scripts": {
66
"cli": "node ./packages/git-proxy-cli/index.js",
77
"client": "vite --config vite.config.js",
88
"clientinstall": "npm install --prefix client",
99
"server": "node index.js",
10-
"start": "concurrently 'npm run server' 'npm run client'",
10+
"start": "concurrently \"npm run server\" \"npm run client\"",
1111
"build": "vite build",
1212
"test": "NODE_ENV=test mocha --exit",
1313
"test-coverage": "nyc npm run test",

proxy.config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
}
9393
]
9494
},
95+
"domains": {},
9596
"privateOrganizations": [],
9697
"urlShortener": "",
9798
"contactEmail": "",

scripts/doc-schema.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ try {
2020
console.log(genDocOutput);
2121

2222
const schemaDoc = readFileSync(`${tempdir}${sep}schema.md`, 'utf-8')
23+
.replace(/\s\s\n\n<\/summary>/g, '\n</summary>')
2324
.replace(/# GitProxy configuration file/g, '# Schema Reference'); // https://github.com/finos/git-proxy/pull/327#discussion_r1377343213
2425
const docString = `---
2526
title: Schema Reference

src/config/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ let _privateOrganizations = defaultSettings.privateOrganizations;
2424
let _urlShortener = defaultSettings.urlShortener;
2525
let _contactEmail = defaultSettings.contactEmail;
2626
let _csrfProtection = defaultSettings.csrfProtection;
27+
let _domains = defaultSettings.domains;
2728

2829
// Get configured proxy URL
2930
const getProxyUrl = () => {
@@ -189,6 +190,13 @@ const getSSLCertPath = () => {
189190
return _sslCertPath;
190191
};
191192

193+
const getDomains = () => {
194+
if (_userSettings && _userSettings.domains) {
195+
_domains = _userSettings.domains;
196+
}
197+
return _domains;
198+
};
199+
192200
exports.getAPIs = getAPIs;
193201
exports.getProxyUrl = getProxyUrl;
194202
exports.getAuthorisedList = getAuthorisedList;
@@ -207,3 +215,4 @@ exports.getCSRFProtection = getCSRFProtection;
207215
exports.getPlugins = getPlugins;
208216
exports.getSSLKeyPath = getSSLKeyPath;
209217
exports.getSSLCertPath = getSSLCertPath;
218+
exports.getDomains = getDomains;

src/proxy/processors/push-action/blockForAuth.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
const Step = require('../../actions').Step;
1+
const { getServiceUIURL } = require('../../../service/urls');
22

3-
const { GIT_PROXY_UI_PORT: uiPort } = require('../../../config/env').Vars;
3+
const Step = require('../../actions').Step;
44

55
const exec = async (req, action) => {
66
const step = new Step('authBlock');
7+
const url = getServiceUIURL(req);
78

89
const message =
910
'\n\n\n' +
1011
`\x1B[32mGitProxy has received your push ✅\x1B[0m\n\n` +
1112
'🔗 Shareable Link\n\n' +
12-
`\x1B[34mhttp://localhost:${uiPort}/admin/push/${action.id}\x1B[0m` +
13+
`\x1B[34m${url}/admin/push/${action.id}\x1B[0m` +
1314
'\n\n\n';
1415
step.setAsyncBlock(message);
1516

0 commit comments

Comments
 (0)