Git Product home page Git Product logo

dice.io's Introduction

MIT license

Dice.io

A simple Node.js dice roller server.

Getting started

Install server from NPM :

$ npm install -g dice.io

Run the server (use -h for help) :

$ diceio -a 127.0.0.1 -p 8080

Then open http://127.0.0.1:8080 in your browser to display demo application.

Dice roller client library

Application server provide a Javascript client library to create your own web application.

Miro integration

Application server provide a Web Plugin for the Miro online collaborative whiteboarding platform.

Miscellaneous

About

Project main goals are to provide :

  • a simple collaborative way to roll dice formula
  • a client library to allow custom integration

If you wish another Javascript dice engine to be added to the project, create a new issue.

A live demo is available here, hosted on a small Heroku free instance. Please don't use it as main server, instead deploy your own server following this guide.

Credits

This project mainly uses the following dependencies :

Dice SVG icon originally made by Freepik from www.flaticon.com.

"Shake And Roll Dice" sound made by Mike Koenig from sounbible.com. Creative Commons.

License

The MIT License (MIT). Please see License File for more information.

dice.io's People

Contributors

dependabot[bot] avatar kslimani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dice.io's Issues

Runtime error with rpg-dice-roller

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/umd/bundle' is not defined by "exports" in /[PATH]/[TO]/dice.io/node_modules/rpg-dice-roller/package.json

SDK v 2.0 isn't supported

Hi!

Looks like Miro recently updated their SDK to version 2.0. And all new dice.io connections are not working (though it's working on my legacy SDK 1.0, but will be migrated automatically).

So, any plan to support the new version?

TODO: dice result object adapters

Currently each dice roller engine return his own roll result object representation format. It would be nice to create adapters to create result object with same structure and same string result. (would allow to create dice roll result renderer)

Access-Control-Allow-Origin errors in Miro app deploy

I deployed a clone of this repo to Heroku and set it up as a Miro app following your instructions. I was able to see the Dice.io icon in the bottom toolbar and clicking it would open the sidebar, but it wouldn't roll any dice. Looking in the inspection panel in Chrome I found an error:

Access to fetch at 'https://miro.com/api/v1/users/1234567890' from origin 'https://my-dice-io-app.herokuapp.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

The error tracked back to this line in

fetch('https://miro.com/api/v1/users/' + id)

I was not able to find any info on a valid workaround for that, and several posts on the Miro community boards said this wasn't currently possible. I'm not sure if using the apps oauth token in the fetch would make any difference. I did find reference to an experimental SDK interface which works if you change that block to this instead, but not sure you want to rely on that while it's still a beta feature.

miro.onReady(() => {
  // Attempt to get current user name (dice roller nickname)
  miro.board.getInfo().then((boardInfo) => {
    // Attempt to get team account id (dice roller channel)
    miro.account.get().then((account) => {
      startApp(boardInfo.currentUserContext.user.name, 'miro' + account.id)
    })
    .catch(e => {
      console.log('[Dice Roller] Failed to get team account id', e)
    })
  })
  .catch(e => {
    console.log('[Dice Roller] Failed to get board info', e)
  })
})

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.