Giter Site home page Giter Site logo

thogiti / town-square Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bitfalls/town-square

0.0 2.0 0.0 6.86 MB

a fully decentralized discussion platform built with Ethereum and IPFS

License: MIT License

JavaScript 54.41% HTML 0.28% Vue 45.32%

town-square's Introduction

โ›ฒ Town Square

npm GitHub

A fully decentralized discussion platform built with Ethereum and IPFS

The aim of the project is to provide an embeddable discussion platform that's owned by everybody.

  • An Ethereum smart contract is used to keep track of the comments and verify identities.

  • IPFS is used to store the content of the comments.

Town Square is a project for the community. There is no token. The only costs are gas fees to the Ethereum network.

Town Square exists amorphously. It doesn't have a central homepage. It is built to be embedded. Each Town Square has all of the necessary tools to make more Town Squares.

Live Demos

Start a new Thread

Click on "๐ŸŒณ Start a new thread" in the footer of any Town Square to make your own thread.

Once you click "submit" you'll get a unique thread id. Use the following snippet to embed Town Square on your site.

<!-- the container div -->
<div id="town-square"></div>
<!-- include the css file somewhere in your source code -->
<link href="https://gitcdn.xyz/repo/WillWhiteneck/Town-Square/master/dist/town-square.css" rel="stylesheet">
<!-- include the script file, this needs to be below the div -->
<script
  src="https://gitcdn.xyz/repo/WillWhiteneck/Town-Square/master/dist/town-square.js"
  data-thread-id="<YOUR_THREAD_ID>">
</script>

If you'd rather not use a cdn, you can install Town Square with npm:

npm install town-square

Then reference the sources in node_modules

<div id="town-square"></div>
<link href="./node_modules/town-square/dist/town-square.css" rel="stylesheet">
<script
  src="./node_modules/town-square/dist/town-square.js"
  data-thread-id="<YOUR_THREAD_ID>">
</script>

Advanced Usage

Customize Town Square to suit your needs.

<script
  src="https://gitcdn.xyz/repo/WillWhiteneck/Town-Square/master/dist/town-square.js"* data-container-id="town-square"
  data-depth-limit="Infinity"
  data-editor-placeholder-reply="What are your thoughts?"
  data-editor-placeholder-top="What are your thoughts?"
  data-ethereum-url="https://mainnet.infura.io/v3/17a0bf02d6fb4fa9a97be85940caac51"
  data-ipfs-hash="QmVzUTPWBgkesyvqi7SaTLUgbHyZi1RgXLz5PGfT6Qv5pm"
  data-ipfs-url="https://ipfs.infura.io:5001"
  data-max-text-bytes="100000"
  data-thread-id="2"></script>
  • data-container-id - references the id of the town-square container. If you want to use multiple embedded threads you will need to use a new script tag for each thread. (default: 'town-square')
  • data-depth-limit - How deep comments can recurse before a new page is started. This should usually be 'Infinity' since the address bar will be modified otherwise. (default for embedded script: 'Infinity', default for standalone: 1)
  • data-editor-placeholder-reply - The placeholder text in the comment reply editor. (default: 'What are your thoughts?')
  • data-editor-placeholder-top - The placeholder text in the thread reply editor. (default: 'What are your thoughts?')
  • data-ethereum-url - The default ethereum node URL. This gets overriden if the user has MetaMask. (default: https://mainnet.infura.io/v3/17a0bf02d6fb4fa9a97be85940caac51)
  • data-ipfs-hash - The IPFS hash for the standalone Town Square reader. (default: <most_recent_release>)
  • data-ipfs-url - The default ipfs gateway URL. the gateway must have no CORS restrictions and ideally will be nice enough to pin the incoming content. (default: https://ipfs.infura.io:5001)
  • data-max-text-bytes - The maximum file size (in bytes) that Town Square will pull from IPFS. Somebody chould potentially cause problems if they upload a massive file as the comment content. Make sure this field is set small enough to prevent problems like that. (default: 100000 /* 100 kB */) x
  • data-thread-id - The id of your thread. Make sure you set this if you are embedding Town Square on your website. (default: 0)

Development

Clone the repo

git clone https://github.com/WillWhiteneck/Town-Square.git
cd town-square

Run in development mode:

npm run dev

After you've made changes compile to the dist folder:

npm run build

TODO

  • Display a person's comment history
  • Configurable css themes
  • Use an Ethereum identity service to optionally show names instead of addresses.

town-square's People

Contributors

willh0lt avatar

Watchers

James Cloos avatar Nagu Thogiti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.