Skip to content

Commit

Permalink
Merge pull request #17 from Cross-Lab-Project/crosslab
Browse files Browse the repository at this point in the history
Crosslab
  • Loading branch information
andre-dietrich authored Jul 6, 2023
2 parents e0e6703 + 29cadf0 commit 06f08f2
Show file tree
Hide file tree
Showing 60 changed files with 2,271 additions and 28,844 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.github
.gitignore
Dockerfile*
docker-compose.yml
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.edrys
.edrys
client/.nuxt
client/node_modules
docker-compose.yaml
16 changes: 14 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
FROM node:16 AS c-build
WORKDIR /app
COPY client .
RUN npm install
RUN npm run generate

FROM denoland/deno:latest AS s-build
WORKDIR /
COPY server server
RUN deno bundle server/app.ts /app.js

FROM denoland/deno:latest
WORKDIR /
COPY . ./
COPY --from=c-build /app/dist /dist/static
COPY --from=s-build /app.js /dist/
EXPOSE 8000/tcp
CMD ["run", "-A", "dist/app.js", "--address", "0.0.0.0:8000", "--serve-path", "dist/static"]
CMD ["run", "-A", "dist/app.js", "--address", "0.0.0.0:8000", "--serve-path", "dist/static"]
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
all: client deno

client:
cd client && npm run generate && rm -rf ../dist/static && cp -r dist ../dist/static

deno:
deno bundle server/app.ts dist/app.js

run:
deno run -A dist/app.js --address localhost:8000 --serve-path dist/static --secret 182761552627328716
1 change: 1 addition & 0 deletions client/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
1 change: 1 addition & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
1 change: 1 addition & 0 deletions client/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
35 changes: 18 additions & 17 deletions client/assets/scss/main.scss
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
@import './materialdesignicons.min.css';

@font-face {
font-family: MainFont;
src: url('../fonts/IBMPlexSans-Medium.ttf');
font-family: MainFont;
src: url('../fonts/IBMPlexSans-Medium.ttf');
}

html, body {
font-family: MainFont !important;
html,
body {
font-family: MainFont !important;
}


.handle {
cursor: move; /* fallback if grab cursor is unsupported */
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
}

/* (Optional) Apply a "closed-hand" cursor during drag operation. */
.handle:active {
cursor: grabbing;
cursor: -moz-grabbing;
cursor: -webkit-grabbing;
}
cursor: move;
/* fallback if grab cursor is unsupported */
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
}

/* (Optional) Apply a "closed-hand" cursor during drag operation. */
.handle:active {
cursor: grabbing;
cursor: -moz-grabbing;
cursor: -webkit-grabbing;
}
16 changes: 10 additions & 6 deletions client/components/Module.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
r<template>
<div style="height: 100%; width: 100%" :key="scrapedModule.url">
<template>
<div
style="height: 100%; width: 100%"
:key="scrapedModule.url"
>
<iframe
style="height: 100%; width: 100%"
:key="liveClassProxy.users[username].room"
:src="scrapedModule.url.startsWith('data:') ? null : scrapedModule.url"
:srcdoc="scrapedModule.url.startsWith('data:') ? scrapedModule.url : null"
:src="scrapedModule.srcdoc ? scrapedModule.srcdoc : (scrapedModule.url.startsWith('data:') ? null : scrapedModule.url)"
:srcdoc="!scrapedModule.srcdoc ? null : ( scrapedModule.url.startsWith('data:') ? scrapedModule.url : null )"
allow="camera; microphone; fullscreen; display-capture; accelerometer; autoplay; encrypted-media; geolocation; gyroscope; magnetometer; midi; serial; vr;"
@load="updateIframe"
ref="iframe"
Expand All @@ -14,6 +17,7 @@ r<template>
</div>
</template>


<script>
export default {
name: "Module",
Expand All @@ -37,7 +41,7 @@ export default {
event: "message",
...val,
},
this.iframeOrigin
this.scrapedModule.origin || this.iframeOrigin
);
}
},
Expand All @@ -55,7 +59,7 @@ export default {
module: this.scrapedModule,
class_id: this.$store.state.class_.id,
},
this.iframeOrigin
this.scrapedModule.origin || this.iframeOrigin
);
},
},
Expand Down
21 changes: 16 additions & 5 deletions client/components/Modules.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,22 @@ export default {
return this.roomName.startsWith("Station ") ? "station" : "chat";
},
scrapedModules() {
return this.$store.state.scrapedModules.filter(
(m) =>
(m.shownIn.includes(this.modulesType) || m.shownIn == "*") &&
(this.role != "student" || !m.shownIn.includes("teacher-only"))
);
return this.$store.state.scrapedModules.filter((m) => {
const showIn = m.showInCustom
? m.showInCustom.split(",").map((e) => e.trim())
: m.shownIn;
return (
(showIn.includes(this.modulesType) ||
showIn
.map((e) => e.toLowerCase().replace(/\*/g, ".*"))
.map((e) => new RegExp(e))
.map((e) => this.roomName.toLowerCase().match(e) !== null)
.includes(true) ||
showIn == "*") &&
(this.role != "student" || !showIn.includes("teacher-only"))
);
});
},
},
created() {
Expand Down
Loading

1 comment on commit 06f08f2

@deno-deploy
Copy link

@deno-deploy deno-deploy bot commented on 06f08f2 Jul 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to deploy:

Module not found "file:///src/dist/app.js".

Please sign in to comment.