Merge pull request #154 from christianbundy/add-invite-code
Add invite code
This commit is contained in:
commit
7f55628358
|
@ -566,6 +566,11 @@ router
|
|||
.post("/meta/conn/restart", koaBody(), async ctx => {
|
||||
await meta.connRestart();
|
||||
ctx.redirect("/meta");
|
||||
})
|
||||
.post("/meta/invite/accept", koaBody(), async ctx => {
|
||||
const invite = String(ctx.request.body.invite);
|
||||
await meta.acceptInvite(invite);
|
||||
ctx.redirect("/meta");
|
||||
});
|
||||
|
||||
const { host } = config;
|
||||
|
|
|
@ -193,6 +193,10 @@ module.exports = cooler => {
|
|||
connRestart: async () => {
|
||||
await models.meta.connStop();
|
||||
await models.meta.connStart();
|
||||
},
|
||||
acceptInvite: async invite => {
|
||||
const ssb = await cooler.connect();
|
||||
return await cooler.get(ssb.invite.accept, invite);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -116,6 +116,10 @@ module.exports = {
|
|||
stopNetworking: "Stop networking",
|
||||
restartNetworking: "Restart networking",
|
||||
indexes: "Indexes",
|
||||
invites: "Invites",
|
||||
invitesDescription:
|
||||
"Redeem an invite by pasting it below. If it works, you'll follow the feed and they'll follow you back.",
|
||||
acceptInvite: "Accept invite",
|
||||
// search page
|
||||
searchLabel: "Add word(s) to look for in downloaded messages.",
|
||||
// posts and comments
|
||||
|
@ -130,8 +134,7 @@ module.exports = {
|
|||
mysteryDescription: "posted a mysterious message",
|
||||
// misc
|
||||
oasisDescription: "Friendly neighborhood scuttlebutt interface",
|
||||
submit: "Submit",
|
||||
following: "Following" // TODO: remove this - it isn't used now that the Following page is gone
|
||||
submit: "Submit"
|
||||
},
|
||||
/* spell-checker: disable */
|
||||
es: {
|
||||
|
|
|
@ -563,6 +563,13 @@ exports.metaView = ({ status, peers, theme, themeNames }) => {
|
|||
peerList.length > 0 ? ul(peerList) : i18n.noConnections,
|
||||
p(i18n.connectionActionIntro),
|
||||
connButtons,
|
||||
h3(i18n.invites),
|
||||
p(i18n.invitesDescription),
|
||||
form(
|
||||
{ action: "/meta/invite/accept", method: "post" },
|
||||
input({ name: "invite", type: "text" }),
|
||||
button({ type: "submit" }, i18n.acceptInvite)
|
||||
),
|
||||
h3(i18n.indexes),
|
||||
progressElements
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue