Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,794 changes: 2,732 additions & 62 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"express-session": "^1.17.1",
"fs-extra": "^9.0.1",
"http-errors": "~1.6.3",
"ipfs-core": "^0.4.0",
"method-override": "^3.0.0",
"mongodb": "^3.6.3",
"mongoose": "^5.11.8",
Expand Down
93 changes: 93 additions & 0 deletions public/javascripts/IPFS/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
const fileElement = document.getElementById("progressfile");
const contentElement = document.getElementById("progresscontent");
const fileSend = document.getElementById("fileSend");

const reader = new window.FileReader()

fileElement.addEventListener("change", handleFiles);
fileSend.addEventListener("click", handlebuttons);

function handlebuttons(event) {
content = contentElement.value
const filebuffer = Buffer.from(reader.result);
console.log(filebuffer);

}


function handleFiles(event) {
const file = event.target.files[0];
const fileName = event.target.files[0]['name']
// reader.onloadend = () => {console.log(reader), console.log(file)}
reader.readAsArrayBuffer(file)
}




'use strict'
const traversePosts = async (cid) => {
const result = []
while (cid) {
result.push(cid)
const current = await ipfs.dag.get(cid)
const prev = current.value.prev
if (prev) {
cid = prev
} else {
return result
}
}
}

window.addEventListener("load", async () => {
if (typeof ipfs === 'undefined') {
const ipfs = await Ipfs.create({ repo: 'ipfs-' + Math.random() })
console.log(ipfs)
}else {
console.log("이미 있음")
}
})

//참고용
// const natCid = await ipfs.dag.put({ author: "Nat" })
// const samCid = await ipfs.dag.put({ author: "Sam" })

// const treePostCid = await ipfs.dag.put({
// content: "trees",
// author: samCid,
// tags: ["outdoor", "hobby"]
// })
// const computerPostCid = await ipfs.dag.put({
// content: "computers",
// author: natCid,
// tags: ["hobby"],
// prev: treePostCid
// })
// const dogPostCid = await ipfs.dag.put({
// content: "dogs",
// author: samCid,
// tags: ["funny", "hobby"],
// prev: computerPostCid
// })
// const cookPostCid = await ipfs.dag.put({
// content: "cooks",
// author: samCid,
// tags: ["funny", "hobby"],
// prev: computerPostCid
// })

// const outdoorTagCid = await ipfs.dag.put({
// tag: "outdoor",
// posts: [treePostCid]
// })
// const hobbyTagCid = await ipfs.dag.put({
// tag: "hobby",
// posts: [treePostCid, computerPostCid, dogPostCid]
// })
// const funnyTagCid = await ipfs.dag.put({
// tag: "funny",
// posts: [dogPostCid]
// })

// console.log(traversePosts(dogPostCid))
8 changes: 8 additions & 0 deletions public/javascripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ function windowOnClick(event) {
toggleModal();
}
}
// function getIndex(event) {
// console.log("test");

// }

//okButton[0].addEventListener("click", getIndex)


trigger[0].addEventListener("click", toggleModal);
trigger[1].addEventListener("click", toggleModal);
Expand All @@ -46,6 +53,7 @@ for (let i = 0; i < cancelButton.length; i++) {
closeButton[0].addEventListener("click", cancelToggle);
cancelButton[i].addEventListener("click", cancelToggle);
okButton[i].addEventListener("click", cancelToggle);
//okButton[i].addEventListener("click", getIndex);
}
// cancel.addEventListener("click", cancelToggle);
window.addEventListener("click", windowOnClick);
2 changes: 1 addition & 1 deletion views/main.pug
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ block content
br
.container
.input-group.mb-4.border.rounded-pill.p-1
//
//-
<input type="search" placeholder="What're you searching for?" aria-describedby="button-addon3"
class="form-control bg-none border-0">
input.form-control.border-0.bg-light(type='search' placeholder="What're you searching for?" aria-describedby='button-addon1')
Expand Down
2 changes: 1 addition & 1 deletion views/progress/approval/requestApproval.pug
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
//- input(type='file' name='FileName')
//- //- input#cancel(type='button' value='취소')
//- input.ok.request_close_btn(type='button' value='보내기' style="margin-top:20px")
//- input.cancel.request_close_btn(type='button' value='취소' style="margin-top:20px")
//- input.cancel.request_close_btn(type='button' value='취소' style="margin-top:20px")
1 change: 1 addition & 0 deletions views/progress/progressLayout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ block content
include approval/requestApproval.pug
include approval/acceptApproval.pug

script(src='/javascripts/IPFS/index.js')
script(type='text/javascript' src='/javascripts/popup.js')
4 changes: 2 additions & 2 deletions views/registerLayout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ html
meta(name='generator' content='Hugo 0.79.0')
title Checkout example &middot; Bootstrap v5.0
link(rel='canonical' href='https://getbootstrap.com/docs/5.0/examples/checkout/')
// Bootstrap core CSS
//- Bootstrap core CSS
link(href='https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1' crossorigin='anonymous')
link(href='admin.css' rel='stylesheet')
link(rel="stylesheet", href="/stylesheets/register.css")
Expand All @@ -29,7 +29,7 @@ html
font-size: 3.5rem;
}
}
// Custom styles for this template
//- Custom styles for this template
link(href='form-validation.css' rel='stylesheet')
link(href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css' type='text/css' rel='stylesheet')
script(src='https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js' integrity='sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW' crossorigin='anonymous')
Expand Down