/r/place开源克隆
/r/place开源克隆,/r/place 是 Reddit 下的一个活动板块。2017 年 4 月 1 日,Reddit 在该版置顶了一块 1000 × 1000 像素的空白画布,每位注册用户可以从 16 种颜色任意选择一种颜色,填充在画布的 1 颗像素上。
Java 其它杂项
共93Star
详细介绍
Pxls
Pxls is a collaborative image editor where you can place up to six pixels at a time, inspired by Reddit's r/Place experiment.
Note: A Docker image is available at aneurinprice/docker-pxls.space and on Docker Hub.
Prerequisites
Building
-
Install the above requirements either via package manager (recommended) or by building from their sources.
-
Clone the repo:
$ git clone git@github.com:pxlsspace/Pxls.git
-
Navigate to the directory:
$ cd Pxls
-
Clean the package:
$ mvn clean package
The output .jar
is in target/
.
Running
- Create a new directory.
- Copy
resources/
and the output.jar
to it. - Copy
resources/reference.conf
to the directory aspxls.conf
. - Configure
pxls.conf
. - Execute the jar with
java -jar pxls-1.0-SNAPSHOT.jar
The server will start on port 4567 by default, and will expose a rudimentary console with a few commands (listed in Commands
below). You will need to configure the database for the server to start, see the Configuring Database
section below.
The config file uses HOCON. The config will not be automatically created, you must create/copy it yourself. Any unspecified option will use the default value from resources/reference.conf
.
Pxls will automatically save a backup of the map every five minutes to $STORAGE/backups/board.<timestamp>.dat
, as well as before executing a blank operation and right before exiting (via Ctrl-C).
Configuring Database
You will need to set the database URI/credentials in pxls.conf
.
The relevant config options are database.url
, database.user
, and database.pass
. An example database section in the config could look like this:
database {
url: "jdbc:postgresql://localhost:3306/pxls"
user: "AzureDiamond"
pass: "hunter2"
}
Configuring OAuth
OAuth keys must be set in the config file (see above). Right now, five services are supported - Reddit, Google, Discord, VK, and Tumblr.
The config node oauth.callbackBase
must be set to your app's URL (including protocol and port), followed by /auth
(for example, http://pxls.space/auth
). On the OAuth setup page for the various services, you need to set the redirect URL to oauth.callbackBase
followed by the service name. Reddit, for example, would be http://pxls.space/auth/reddit
, and likewise for Google.
An example OAuth section could look like this:
oauth {
callbackBase: "http://example.com/auth"
reddit {
key: "AsPxXweEomQjUD"
secret: "tYJlz_xbH-qjxw8xvKVj0qLXRCw"
}
google {
key: "pxls-"
secret: "AIzaSzAS9wxgdXw6G3Q2lGMlyxG03F3hmXEMnce"
}
discord {
key: "112233445566778899"
secret: "yo4DkHFDy0k1euPyxMef6m243qRgX00z"
}
}
Configuring host
You must update the host
option in your pxls.conf
otherwise session cookies will not set, making auth impossible. host
should be your domain (or IP if testing locally) without port.
Configuring CAPTCHA
By default, CAPTCHAs are disabled, and need to be configured in the config to work. You will need a CAPTCHA key and secret. The type must be Invisible reCAPTCHA
.
The captcha.host
key needs to be one of the approved domains on the reCAPTCHA admin panel. For local testing, this will likely be localhost
(no port).
An example CAPTCHA section could look like this:
captcha {
key: "6LcedG4UAAAAAKA6l9BbRPvZ2vt3lTrCQwz8rfPe"
secret: "6LcedG4UAAAAAIXZcNFhnLKvTQwG1E8BzQQt_-MR"
host: "example.com"
}
Commands
Commands are entered directly into the running instance (stdin):
reload
- Reloads the main configuration, applying most changes immediately. Also reloads the user and faction cache.save
- Saves the map.role <user> <role>
- Changes the role of the user. The role can be eitherUSER
,TRIALMOD
,MODERATOR
,DEVELOPER
, orADMIN
.alert <text>
- Sends an popup-like alert to all users on the canvas.ban <user> <reason>
- Bans the user for 24 hours, with the specified reason (if any).permaban <user> <reason>
- Permanently bans the user, with the specified reason (if any).shadowban <user> <reason>
- Shadowbans the user (hiding newly-placed pixels to all but themself), with the specified reason (if any).unban <user>
- Unbans the user.nuke <x1> <y1> <x2> <y2> <color>
- Replaces all pixels from (x1
,y1
) to (x2
,y2
) with the color (by index).replace <x1> <y1> <x2> <y2> <from> <to>
- Replaces all pixels in the rectangle delimited by (x1
,y1
) to (x2
,y2
) from the colorfrom
to the colorto
cons [authed]
- Lists the total (or authed) connection count.users
- Lists all of the authed users, by username.stack <user> [set <amount>]
- Sets the user's stack count. The user must not be on cooldown before setting.cd-override list|<user> [on|off]
- Sets or lists the cooldown override status of an userbroadcast <message>
- Sends a message in chatchatban <user> <length> <purge> <reason>
- Chat bans the user forlength
in seconds, optionally purges all of their messagespermachatban <user> <purge> <reason>
- Perma chat bans the user, optionally purges all of their messagesunchatban <user>
- Unchatbans the userchatpurge <user> [amount] [reason]
- Purges up toamount
chat messages from the usercf <query>
- Runs a chat filter againstquery
reloadusers
- Reloads the user manager (laggy)flagrename <user> [0|1]
- Sets the user's Rename Requested flagsetname <user> <name>
- (alias: updateusername) Changes the user's nameidlecheck
- Runs an user timeout checksenduserdata
- Broadcasts the non-idle user count in chataddnotification <title> <expiry> <body>
- Adds a notification to the notification panel. A "+x" on theexpiry
makes the expiry now + x in seconds.bp <json packet>
broadcast a raw packet to everyone online.f <faction_id> [delete|tag|name [<new_value>]]
updates a faction. if <new_value> is omitted, then the console will print the current values.
Contributors
- xSke - Main code
- jasperandrew - Client UI/UX
- Sorunome - Loads of client improvements
- GlowingSocc - Loads of client improvements
- haykam821 - Copy link and color-switching keybinds
- FlyingSixtySix - Miscellaneous contributions
- Netux - Various QoL improvements
A full list of contributors is available here.
Licenses
- This project includes icons from Font Awesome Free 5.9.0 by fontawesome - https://fontawesome.com
- License: https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
-
57 Star
-
1031 Star
-
0 Star
-
9928 Star
-
21258 Star
-
66 Star
-
0 Star