Skip to content

Commit

Permalink
fix: fixed navbar icon when logged in, attempt to fix env var for Git…
Browse files Browse the repository at this point in the history
…Hub CI, cleanup apiURL and webURL in tests
  • Loading branch information
titanism committed Aug 27, 2024
1 parent aa3a84b commit 91e3dfb
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
5 changes: 3 additions & 2 deletions app/views/_nav.pug
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,14 @@ nav.navbar(class=navbarClasses.join(" "))
= t("Signup")
.no-js.is-bot.d-inline-block.mr-3
if !isBot(ctx.get('User-Agent'))
button.navbar-toggler.d-lg-none.no-js.text-dark.text-themed(
button.navbar-toggler.d-lg-none.no-js(
type="button",
data-toggle="collapse",
data-target="#navbar-header",
aria-controls="navbar-header",
aria-expanded="false",
aria-label=t("Toggle navigation")
aria-label=t("Toggle navigation"),
class=isAuthenticated() ? "text-white" : "text-dark text-themed"
)
i.fas.fa-bars
//- once we have responsive border utilities added to bootstrap
Expand Down
4 changes: 3 additions & 1 deletion config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const manifestRev = require('manifest-rev');
const ms = require('ms');
const nodemailer = require('nodemailer');
const tlds = require('tlds');
const splitLines = require('split-lines');
const { Iconv } = require('iconv');
const { boolean } = require('boolean');

Expand Down Expand Up @@ -226,7 +227,8 @@ const config = {
privateKey: isSANB(env.DKIM_PRIVATE_KEY_PATH)
? fs.readFileSync(env.DKIM_PRIVATE_KEY_PATH, 'utf8')
: isSANB(env.DKIM_PRIVATE_KEY_VALUE)
? env.DKIM_PRIVATE_KEY_VALUE
? // GitHub CI may convert \n to \\n in env var rendering
splitLines(env.DKIM_PRIVATE_KEY_VALUE.replace(/\\n/g, '\n')).join('\n')
: undefined,
algorithm: 'rsa-sha256',
canonicalization: 'relaxed/relaxed'
Expand Down
8 changes: 4 additions & 4 deletions test/api/v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ test('creates alias with global catch-all', async (t) => {
t.is(res.headers['x-item-count'], '1');
t.is(
res.headers.link,
`<${t.context.apiURL}v1/domains/${domain.name}/aliases?page=1)>; rel="last", <${t.context.apiURL}v1/domains/${domain.name}/aliases?page=1)>; rel="first"`
`<${t.context.apiURL}/v1/domains/${domain.name}/aliases?page=1)>; rel="last", <${t.context.apiURL}/v1/domains/${domain.name}/aliases?page=1)>; rel="first"`
);
}
});
Expand Down Expand Up @@ -1261,7 +1261,7 @@ test('create domain without catchall', async (t) => {
t.is(res.headers['x-item-count'], '0');
t.is(
res.headers.link,
`<${t.context.apiURL}v1/domains/testdomain1.com/aliases?page=1)>; rel="last", <${t.context.apiURL}v1/domains/testdomain1.com/aliases?page=1)>; rel="first"`
`<${t.context.apiURL}/v1/domains/testdomain1.com/aliases?page=1)>; rel="last", <${t.context.apiURL}/v1/domains/testdomain1.com/aliases?page=1)>; rel="first"`
);
}

Expand Down Expand Up @@ -1328,7 +1328,7 @@ test('create domain without catchall', async (t) => {
t.is(res.headers['x-item-count'], '1');
t.is(
res.headers.link,
`<${t.context.apiURL}v1/domains?page=1)>; rel="last", <${t.context.apiURL}v1/domains?page=1)>; rel="first"`
`<${t.context.apiURL}/v1/domains?page=1)>; rel="last", <${t.context.apiURL}/v1/domains?page=1)>; rel="first"`
);
}

Expand Down Expand Up @@ -1514,7 +1514,7 @@ test('lists emails', async (t) => {
t.is(res.headers['x-item-count'], '1');
t.is(
res.headers.link,
`<${t.context.apiURL}v1/emails?page=1)>; rel="last", <${t.context.apiURL}v1/emails?page=1)>; rel="first"`
`<${t.context.apiURL}/v1/emails?page=1)>; rel="last", <${t.context.apiURL}/v1/emails?page=1)>; rel="first"`
);

t.is(res.body[0].id, id);
Expand Down
8 changes: 5 additions & 3 deletions test/mx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const mxConnect = require('mx-connect');
const nodemailer = require('nodemailer');
const pify = require('pify');
const test = require('ava');
const { listen } = require('async-listen');

const utils = require('../utils');
const MX = require('../../mx-server');
Expand Down Expand Up @@ -52,14 +53,15 @@ test.beforeEach(async (t) => {
Users
);
const port = await getPort();
t.context.apiPort = port;
await api.listen(port);
// remove trailing slash from API URL
t.context.apiURL = await listen(api.server, { host: '127.0.0.1', port });
t.context.apiURL = t.context.apiURL.toString().slice(0, -1);
});

test('connects', async (t) => {
const smtp = new MX({
client: t.context.client,
apiEndpoint: `http://localhost:${t.context.apiPort}`
apiEndpoint: t.context.apiURL
});
const { resolver } = smtp;
const port = await getPort();
Expand Down
4 changes: 4 additions & 0 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ exports.setupWebServer = async (t) => {
t.context._web = web;
if (!getPort) await pWaitFor(() => Boolean(getPort), { timeout: ms('15s') });
const port = await getPort();
// remove trailing slash from web URL
t.context.webURL = await listen(web.server, { host: '127.0.0.1', port });
t.context.webURL = t.context.webURL.toString().slice(0, -1);
t.context.web = request.agent(web.server);
};

Expand All @@ -85,7 +87,9 @@ exports.setupApiServer = async (t) => {
);
if (!getPort) await pWaitFor(() => Boolean(getPort), { timeout: ms('15s') });
const port = await getPort();
// remove trailing slash from API URL
t.context.apiURL = await listen(api.server, { host: '127.0.0.1', port });
t.context.apiURL = t.context.apiURL.toString().slice(0, -1);
t.context.api = request.agent(api.server);
};

Expand Down
2 changes: 1 addition & 1 deletion test/web/sitemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ for (const key of keys) {
const status = key === '/tti' ? 408 : 200;
test(`GET /${route} should return 200`, async (t) => {
t.timeout(ms('5m')); // FAQ takes 30s+ to render (the pug view is ~4000 LOC right now)
const res = await undici.fetch(`${t.context.webURL}${route}`, {
const res = await undici.fetch(`${t.context.webURL}/${route}`, {
method: 'HEAD'
});
t.is(res.status, status);
Expand Down

0 comments on commit 91e3dfb

Please sign in to comment.