« get me outta code hell

Author/remix info - scratchrlol - Simple HTML-based Scratch client
summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-11-14 22:05:02 -0400
committerFlorrie <towerofnix@gmail.com>2018-11-14 22:05:02 -0400
commit9c77f7caeb3098152b98e5e3b8a958c2e92fe920 (patch)
tree914689aeadc5457fdab21fe62278afc9efa2a35e
parentde8be5074f1d7d105b505ad30436ff881c48f918 (diff)
Author/remix info
-rwxr-xr-xindex.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/index.js b/index.js
index 7a2d009..1ad3e1f 100755
--- a/index.js
+++ b/index.js
@@ -366,8 +366,19 @@ const handleRequest = async (request, response) => {
       return
     }
 
+    let parentProjectText = ''
+    if (project.remix.parent) {
+      const parentProject = await getProject(project.remix.parent, cookie.token)
+      if (parentProject.code === 'NotFound') {
+        parentProjectText = ` Based on an unshared project.`
+      } else {
+        parentProjectText = ` Based on ${templates.project(parentProject.title, parentProject.id)} by ${templates.user(parentProject.author.username)}.`
+      }
+    }
+
     await page(request, response, fixWS`
       <h1>${project.title}</h1>
+      <p>Created by ${templates.user(project.author.username)}.${parentProjectText}</p>
       <p><img src="${project.image}" alt="The thumbnail for this project"></p>
       ${project.instructions ? fixWS`
         <h2>Instructions</h2>