poker-maison 正在参加 2021 年度 OSC 中国开源项目评选,请投票支持!
poker-maison 在 2021 年度 OSC 中国开源项目评选 中已获得 {{ projectVoteCount }} 票,请投票支持!
2021 年度 OSC 中国开源项目评选 正在火热进行中,快来投票支持你喜欢的开源项目!
2021 年度 OSC 中国开源项目评选 >>> 中场回顾
poker-maison 获得 2021 年度 OSC 中国开源项目评选「最佳人气项目」 !
授权协议 Readme
开发语言 Haskell
操作系统 跨平台
软件类型 开源软件
所属分类 游戏/娱乐
开源组织
地区 不详
投 递 者 首席测试
适用人群 未知
收录时间 2021-12-24

软件简介

Poker Maison

A multiplayer app crafted with Haskell and React

https://news.ycombinator.com/item?id=20653278

License: Unlicense

alt text

Get everything running with Docker

Prerequisites

In order to use Docker have the following installed.

Firstly start Docker Machine

docker-machine start

Then set the correct variables in your terminal so you can connect to Docker Machine

eval $(docker-machine env)

Now build the images. This will take a while.

docker-compose up

Now go navigate to http://192.168.99.100:3000 in your browser and the app should be running.

The above ip address is the one for your docker-machine VM if you are on the default settings. By default docker-machine doesn't serve localhost but instead uses 192.168.99.100 as the host.

You can simulate multiple players in the same game on on your machine if you navigate to the above url in a few different browser tabs. Eac time you open up a new tab just remember to log out after you have signed in as the browser will cache the access_token for the last logged in user for each new tab as URL is the same.

Common Docker Problems

Docker has the wrong TLS setting

If you get the error below then Docker Compose is not using the correct TLS version.

Building web
ERROR: SSL error: HTTPSConnectionPool(host='192.168.99.100', port=2376): Max retries exceeded with url: /v1.30/build?q=False&pull=False&t=server_web&nocache=False&forcerm=False&rm=True (Caused by SSLError(SSLError(1, u'[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:727)'),))

You can fix this by setting the following environment variable with the correct TLS version.

export COMPOSE_TLS_VERSION=TLSv1_2

Container runs out of memory

If the server docker container runs out of memory whilst building. Whis would look like this.

--  While building package Cabal-2.4.1.0 using:
      /root/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build --ghc-options ""
    Process exited with code: ExitFailure (-9) (THIS MAY INDICATE OUT OF MEMORY)

Then set increase the memory available to the VM you are using for docker-machine. Assuming your VM is named "default", run:

docker-machine stop default
VBoxManage modifyvm default --memory 4096
docker-machine start default

Slow builds

If you want to speed up builds then replace n in the command below with the number of cores your machine has and run the command. The command below assumes that "default" is the name of the VM Docker Machine is using.

docker-machine stop default
VBoxManage modifyvm default --cpus n
docker-machine start default

Building locally from scratch.

The following steps are based on an Ubuntu distribution.

Back End

Firstly make sure you have ghc and stack installed in order to compile the back end written in Haskell. If you need to install the Haskell platform then run

curl -sSL https://get.haskellstack.org/ | sh

Secondly install libpq (c bindings to postgres)

sudo apt-get install libpq-dev

Next install redis.

sudo apt-get install redis

Navigate to the server/ directory.

cd server

Compile the back end poker server.

stack build

Now we need to set some config.

Ensure postgresql 10 is installed and running.

Set the env var so that the server has the postgresql connection string. Of course you will need to change the db connection parameters below to match your local database.

export dbConnStr='host=0.0.0.0 port=5432 user=tom dbname=pokerdbtest password=tom

Set env variable with the secret key for generating auth tokens. Note that this secret must be 32 characters long or it won't work.

export secret="changeme077cf4e7441c32d2d0a86b4c"

Lastly ensure redis-server is running in the background on default port

redis-server

Now run the server locally. The default user API port is 8000 and websocket port is 5000.

stack run

Front End

Install node version 10.16.3 and then install yarn globally

npm i -g yarn@1.17.3

Install a required system dependency for node-sass .

sudo apt-get install libpng-dev

Navigate to the client/ directory with

cd client

Then just run.

yarn start

Now you are ready to play poker!

Simulating a multiplayer game locally

You may want to play against yourself when you are developing locally so just run the clients on two separate ports.

In your first terminal run

PORT=8001 yarn start

Then open another terminal and run

PORT=8002 yarn start

Now just open two tabs in your browser navigating to

localhost:8001

and

localhost:8002

Running Tests

To run the test suite on the backend which has over a hundred tests

cd server && stack test

Contributions Welcome

Have a look at the issues if you want some starting ideas on how to get involved.

Feel free to open any issues with potential enhancements or bugs you have found.

License

This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE file or unlicense.org.

展开阅读全文

代码

评论

点击引领话题📣 发布并加入讨论🔥
暂无内容
发表了博客
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
发表了问答
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
handlebars 安全漏洞
原型污染
handlebars是一款语义化的Web模板系统。 handlebars 4.7.7之前版本存在安全漏洞,该漏洞源于当选择某些编译选项来编译来自不可信源的模板时,容易受到原型污染的影响。
CVE-2021-23383 MPS-2021-6180
2022-08-08 20:30
Digital Bazaar Forge 输入验证错误漏洞
跨站重定向
Digital Bazaar Forge是美国Digital Bazaar公司的一个 Tls 在 Javascript 中的本机实现以及用于编写基于加密和网络密集型 Web 应用程序的开源工具。 Digital Bazaar Forge 中存在输入验证错误漏洞,该漏洞源于产品允许URL重定向到不受信任的站点。
CVE-2022-0122 MPS-2022-0421
2022-08-08 20:30
lodash 存在拒绝服务漏洞
拒绝服务
lodash 是一个现代 JavaScript 实用程序库,提供模块化、性能和附加功能。此软件包的受影响版本容易通过 setWith 和 set 函数受到原型污染。
MPS-2022-13842
2022-08-08 20:30
uglify-js 存在ReDoS漏洞
ReDoS
uglify-js 是一个 JavaScript 解析器、压缩器、压缩器和美化工具包。此软件包的受影响版本容易通过 string_template 和 decode_template 函数受到正则表达式拒绝服务 (ReDoS) 的攻击。
MPS-2022-14112
2022-08-08 20:30
url-parse 安全漏洞
通过用户控制密钥绕过授权机制
Url-Parse是一个跨 Node.js 和浏览器环境无缝工作的小型 Url 解析器。 url-parse 1.5.7之前版本存在安全漏洞,攻击者可利用该漏洞通过用户控制的密钥绕过授权。
CVE-2022-0639 MPS-2022-4297
2022-08-08 20:30
istanbul-reports 存在通过 window.opener 访问使用指向不受信任目标的 Web 链接漏洞
通过 window.opener 访问使用指向不受信任目标的 Web 链接
由于指向 https://istanbul 的链接中没有 rel 属性,因此该软件包的受影响版本容易受到反向 Tabnabbing 的攻击。
MPS-2022-13797
2022-08-08 20:30
node-sass 存在拒绝服务漏洞
拒绝服务
node-sass 是 libsass 的 Node.js 绑定包。此软件包的受影响版本容易受到拒绝服务 (DoS) 的攻击。
MPS-2022-13927
2022-08-08 20:30
LibSass 资源管理错误漏洞
UAF
LibSass是一个开源的使用C语言编写的Sass(CSS扩展语言)解析器。 LibSass 3.4.x版本和3.5.x版本至3.5.4版本中的sass_context.cpp文件的‘handle_error()’函数存在资源管理错误漏洞。该漏洞源于网络系统或产品对系统资源(如内存、磁盘空间、文件等)的管理不当。
CVE-2018-11499 MPS-2018-6523
2022-08-08 20:30
yeikos js.merge 安全漏洞
yeikos js.merge是美国Yeikos个人开发者的一个应用软件。提供了合并js工具。 yeikos js.merge 中存在安全漏洞。该漏洞源于所有相关分支的合并都容易受到该代码库的原型影响。以下产品及版本受到影响:yeikos js.merge
CVE-2020-28499 MPS-2021-1900
2022-08-08 20:30
lodash 命令注入漏洞
代码注入
lodash是一个提供模块化、性能和附加功能的现代 JavaScript 实用程序库。 4.17.21 之前的 Lodash 版本容易通过模板函数进行命令注入。
CVE-2021-23337 MPS-2021-2638
2022-08-08 20:30
Npm Node-tar 后置链接漏洞
node-tar是一款用于文件压缩/解压缩的软件包。 Npm Node-tar 中存在后置链接漏洞,该漏洞源于产品未对特殊字符做有效验证。攻击者可通过该漏洞在其他路径创建恶意文件。
CVE-2021-37701 MPS-2021-28486
2022-08-08 20:30
handlebars 存在拒绝服务漏洞
拒绝服务
handlebars 是 Mustache 模板语言的扩展。此软件包的受影响版本容易受到原型污染。
MPS-2022-13735
2022-08-08 20:30
http-proxy 存在拒绝服务漏洞
拒绝服务
http-proxy 是一个为大众提供 HTTP 代理的库。此软件包的受影响版本容易受到拒绝服务 (DoS) 的攻击。
MPS-2022-13767
2022-08-08 20:30
tar 存在拒绝服务漏洞
拒绝服务
tar 是用于 Node.js 的全功能 Tar。此软件包的受影响版本容易受到正则表达式拒绝服务 (ReDoS) 的攻击。
MPS-2022-14081
2022-08-08 20:30
serialize-javascript 代码问题漏洞
反序列化
Verizon serialize-javascript是美国威瑞森电信(Verizon)公司的一款支持将JavaScript序列化为 JSON超集的软件包。 serialize-javascript 3.1.0之前版本中存在代码问题漏洞。远程攻击者可借助index.js文件中的‘deleteFunctions’函数利用该漏洞注入任意代码。
CVE-2020-7660 MPS-2020-7976
2022-08-08 20:30
Npm Node-tar 后置链接漏洞
node-tar是一款用于文件压缩/解压缩的软件包。 Npm Node-tar 中存在后置链接漏洞,该漏洞源于产品未对特殊字符做有效验证。攻击者可通过该漏洞在其他路径创建恶意文件。
CVE-2021-37712 MPS-2021-28488
2022-08-08 20:30
Follow Redirects 安全漏洞
侵犯隐私
Follow Redirects是一个自动遵循 Http(s) 重定向的 Node.js 模块。 Follow Redirects 存在安全漏洞,该漏洞源于follow-redirects容易暴露私人个人信息给未经授权的参与者。
CVE-2022-0155 MPS-2022-0815
2022-08-08 20:30
node-forge 存在原型污染漏洞
原型污染
node-forge 是网络传输、密码学、密码、PKI、消息摘要和各种实用程序的 JavaScript 实现。此软件包的受影响版本容易受到通过伪造的原型污染。
MPS-2022-13920
2022-08-08 20:30
Digital Bazaar Forge 数据伪造问题漏洞
密码学签名的验证不恰当
Digital Bazaar Forge是美国Digital Bazaar公司的一个 Tls 在 Javascript 中的本机实现以及用于编写基于加密和网络密集型 Web 应用程序的开源工具。 Forge 1.3.0 版本之前 RSA PKCS 存在数据伪造问题漏洞,该漏洞源于 RSA PKCS 签名验证码对摘要算法结构的检查较为宽松。攻击者可以通过精心设计的结构窃取填充字节并在使用低公共指数时使用 PKCS#1 编码消息的未检查部分来伪造签名。
CVE-2022-24771 MPS-2022-3738
2022-08-08 20:30
decompress package 路径遍历漏洞
路径遍历
decompress package是一款解压缩软件包。 decompress package 4.2.1之前版本(Node.js)中存在路径遍历漏洞。攻击者可借助‘../’字符串利用该漏洞写入任意文件。
CVE-2020-12265 MPS-2020-6640
2022-08-08 20:30
没有更多内容
加载失败,请刷新页面
点击加载更多
加载中
下一页
0 评论
0 收藏
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部