-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from TetrisIQ/feat/preRelease
Feat/pre release
- Loading branch information
Showing
81 changed files
with
4,161 additions
and
511 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
**/node_modules | ||
**/dist | ||
**/data.json | ||
**/data | ||
**/radata | ||
**/cypress | ||
.github | ||
.vscode | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
/node_modules/ | ||
/dist/ | ||
/.vscode/ | ||
.DS_Store | ||
/.idea/ | ||
/cypress/screenshots/ | ||
/cypress/videos/ | ||
/**/dist/ | ||
/relay/radata/ | ||
/relay/data/ | ||
/relay/data.json/ | ||
/.env.local | ||
/**/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Build Project | ||
FROM node:14-alpine as builder | ||
RUN mkdir /work | ||
WORKDIR /work | ||
#RUN apk add --no-cache alpine-sdk python3 | ||
COPY frontend ./frontend | ||
WORKDIR /work/frontend | ||
RUN echo "Build frontend" | ||
RUN mkdir -p "node_modules" | ||
RUN yarn install | ||
RUN VITE_RELAY=http://localhost:8765/gun yarn build | ||
|
||
WORKDIR /work | ||
COPY relay ./relay | ||
WORKDIR /work/relay | ||
RUN echo "Build Relay Server" | ||
RUN mkdir -p "node_modules" | ||
RUN yarn install | ||
RUN yarn build | ||
RUN ls | ||
|
||
# fresh image without dev packages | ||
FROM node:14-alpine | ||
# build-time metadata as defined at http://label-schema.org | ||
ARG BUILD_DATE | ||
ARG VCS_REF | ||
ARG VCS_URL | ||
ARG VERSION | ||
LABEL org.label-schema.build-date=$BUILD_DATE \ | ||
org.label-schema.name="Poddle - Meetings made simple!" \ | ||
org.label-schema.url="https://poddle.network" \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.vcs-url=$VCS_URL \ | ||
org.label-schema.vendor="The poddle Team" \ | ||
org.label-schema.version=$VERSION \ | ||
org.label-schema.schema-version="1.0" | ||
ARG SHA | ||
RUN mkdir /work | ||
WORKDIR /work | ||
COPY --from=builder /work/frontend/node_modules ./node_modules | ||
COPY --from=builder /work/relay/node_modules ./relay/node_modules | ||
COPY --from=builder /work/frontend/dist ./dist | ||
COPY --from=builder /work/relay/dist ./relay/dist | ||
COPY --from=builder /work/relay/package.json ./relay/package.json | ||
RUN echo "{ \"sha\": \"$SHA\" }" > version.json | ||
RUN cat version.json | ||
WORKDIR /work/relay | ||
RUN ls | ||
EXPOSE 8765 | ||
CMD ["npm","start"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"projectId": "byzw5k", | ||
"fixturesFolder": "../cypress/fixtures", | ||
"integrationFolder": "../cypress/integration", | ||
"pluginsFile": "../cypress/plugins/index.js", | ||
"screenshotsFolder": "../cypress/screenshots", | ||
"videosFolder": "../cypress/videos", | ||
"downloadsFolder": "../cypress/downloads", | ||
"supportFile": "../cypress/support/index.js" | ||
|
||
|
||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
import {uuidv4} from "../lib/util"; | ||
import type {Poll} from "../model/Poll"; | ||
import type {Dayjs} from "dayjs"; | ||
|
||
export type MyPoll = { id: string, password: string, title: string, participants: number, deadline: Dayjs, created: Dayjs, percent?: string } | ||
|
||
class LStore { | ||
|
||
setMyName(name: string) { | ||
localStorage.setItem("name", name); | ||
} | ||
|
||
getMyName(): string { | ||
const name = localStorage.getItem("name") | ||
if (name === null) { | ||
return "Anonymous" | ||
} else { | ||
return name; | ||
} | ||
} | ||
|
||
getClientID() { | ||
const clientId = localStorage.getItem("clientID") | ||
if (clientId === null) { | ||
const id = uuidv4().slice(0, 5) | ||
localStorage.setItem("clientID", id) | ||
return id | ||
} else { | ||
return clientId; | ||
} | ||
} | ||
|
||
getMyPolls(): Array<MyPoll> { | ||
const myPolls = localStorage.getItem("myPolls") | ||
if (myPolls === null) { | ||
return []; | ||
} | ||
return JSON.parse(myPolls) | ||
} | ||
|
||
addPercentToPoll(poll: MyPoll): Array<MyPoll> { | ||
if (poll.percent !== undefined) { | ||
const myPolls: Array<MyPoll> = this.getMyPolls(); | ||
const pollWithSameId: MyPoll = myPolls.find(p => p.id === poll.id); | ||
const index = myPolls.indexOf(pollWithSameId) | ||
if (index !== -1) { | ||
myPolls[index] = poll; | ||
localStorage.setItem("myPolls", JSON.stringify(myPolls)) | ||
return myPolls; | ||
} | ||
} | ||
return this.getMyPolls() | ||
} | ||
|
||
addMyPoll(poll: Poll): boolean { | ||
if (poll.id === "" && poll.password === "") { | ||
return false; | ||
} | ||
const myPolls: Array<MyPoll> = this.getMyPolls(); | ||
if (myPolls.find(value => value.id === poll.id) !== undefined) { | ||
// Update polls | ||
const pollWithSameId: MyPoll = myPolls.find(p => p.id === poll.id); | ||
const index = myPolls.indexOf(pollWithSameId) | ||
if (index !== -1) { | ||
myPolls[index] = { | ||
id: poll.id, | ||
title: poll.title, | ||
participants: poll.participants.length, | ||
password: poll.password, | ||
deadline: poll.deadline, | ||
created: poll.created | ||
} | ||
} | ||
} else { | ||
myPolls.push({ | ||
id: poll.id, | ||
title: poll.title, | ||
participants: poll.participants.length, | ||
password: poll.password, | ||
deadline: poll.deadline, | ||
created: poll.created | ||
}) | ||
} | ||
localStorage.setItem("myPolls", JSON.stringify(myPolls)) | ||
return true; | ||
} | ||
|
||
removeMyPoll(poll) { | ||
if (poll !== undefined) { | ||
const myPolls: Array<MyPoll> = this.getMyPolls(); | ||
const pollWithSameId: MyPoll = myPolls.find(p => p.id === poll.id); | ||
const index = myPolls.indexOf(pollWithSameId) | ||
if (index > -1) { | ||
myPolls.splice(index, 1); // 2nd parameter means remove one item only | ||
} | ||
localStorage.setItem("myPolls", JSON.stringify(myPolls)) | ||
return myPolls; | ||
} | ||
return this.getMyPolls(); | ||
} | ||
|
||
setUsername(name: string) { | ||
if (name === null) { | ||
localStorage.removeItem("username") | ||
} else { | ||
localStorage.setItem("username", name); | ||
} | ||
} | ||
|
||
getUsername(): string { | ||
return localStorage.getItem("username") | ||
} | ||
|
||
setPassword(password: string) { | ||
if (password === null) { | ||
localStorage.removeItem("_p") | ||
} else { | ||
localStorage.setItem("_p", btoa(password)); | ||
} | ||
} | ||
|
||
getPassword(): string { | ||
return atob(localStorage.getItem("_p")) | ||
} | ||
} | ||
|
||
|
||
export const lstore = new LStore(); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import "gun/sea" | ||
import {gun} from "./index"; | ||
import NotificationControl from "../lib/NotificationControl"; | ||
import {lstore} from "./LStore"; | ||
|
||
const user = gun.db.user(); | ||
|
||
class UserClass { | ||
|
||
login(username: string, password: string) { | ||
return user.auth(username, password, (ack) => { | ||
if (ack.err !== undefined) { | ||
NotificationControl.error("Cannot Login", ack.err) | ||
lstore.setPassword(null) // in case auto login doesn't work | ||
lstore.setUsername(null) | ||
} else { | ||
lstore.setUsername(username) | ||
lstore.setPassword(password) | ||
} | ||
}) | ||
} | ||
|
||
register(username: string, password: string) { | ||
user.create(username, password, (ack) => { | ||
if (ack.err !== undefined) { | ||
NotificationControl.error("Cannot Register", ack.err) | ||
} | ||
}) | ||
} | ||
|
||
isLoggedIn(): boolean { | ||
if (lstore.getUsername() !== null && lstore.getPassword() !== null) { | ||
// Perform auto login | ||
this.login(lstore.getUsername(), lstore.getPassword()) | ||
return true; | ||
} | ||
return user.is | ||
} | ||
|
||
logout() { | ||
lstore.setUsername(null); | ||
lstore.setPassword(null); | ||
user.leave() | ||
} | ||
|
||
delete(username: string, pass: string) { | ||
lstore.setUsername(null); | ||
lstore.setPassword(null); | ||
user.delete(username, pass, (cb => { | ||
console.log(cb) | ||
})) | ||
} | ||
} | ||
|
||
export const users = new UserClass(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.