Skip to content

Commit

Permalink
Merge branch 'lichess-org:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Virinas-code authored Jan 27, 2022
2 parents 48af6a1 + 8cd21fb commit 60ee084
Show file tree
Hide file tree
Showing 119 changed files with 1,265 additions and 984 deletions.
3 changes: 0 additions & 3 deletions .github/FUNDING.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
with:
distribution: zulu
java-version: 14.0.1
- run: TZ=UTC git log -1 --date=iso-strict-local --pretty='format:app.version.commit = "%h"%napp.version.date = "%ad"%napp.version.message = """%s"""%n' | tee conf/version.conf
- run: TZ=UTC git log -1 --date=iso-strict-local --pretty='format:app.version.commit = "%H"%napp.version.date = "%ad"%napp.version.message = """%s"""%n' | tee conf/version.conf
- run: ./lila -Depoll=true "test;stage"
- run: cp LICENSE COPYING.md README.md target/universal/stage && git log -n 1 --pretty=oneline > target/universal/stage/commit.txt
- run: cd target/universal/stage && tar -cvpJf ../../../lila-3.0.tar.xz . && cd -
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## I want to contribute code to Lichess

- [Set up your development environment](https://github.com/ornicar/lila/wiki/Lichess-Development-Onboarding).
- [Pick a GitHub issue to work on](https://github.com/ornicar/lila/issues). The [good first issue](https://github.com/ornicar/lila/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) and [no scala](https://github.com/ornicar/lila/issues?q=is%3Aissue+is%3Aopen+label%3A%22no+scala%22) tags might be useful.
- [Set up your development environment](https://github.com/lichess-org/lila/wiki/Lichess-Development-Onboarding).
- [Pick a GitHub issue to work on](https://github.com/lichess-org/lila/issues). The [good first issue](https://github.com/ornicar/lila/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) and [no scala](https://github.com/lichess-org/lila/issues?q=is%3Aissue+is%3Aopen+label%3A%22no+scala%22) tags might be useful.
- Communicate with other devs on [Discord](https://discord.gg/lichess).

## I want to report a bug or a problem about Lichess

[**Make an issue**](https://github.com/ornicar/lila/issues/new). However, note that issues that provide little value compared to the required effort may be closed. Before creating an issue, make sure that:
[**Make an issue**](https://github.com/lichess-org/lila/issues/new). However, note that issues that provide little value compared to the required effort may be closed. Before creating an issue, make sure that:

1. You list the steps to reproduce the problem to show that other users may experience it as well, if the issue is not self-descriptive.
2. Search to make sure it isn't a duplicate. [The advanced search syntax](https://help.github.com/articles/searching-issues/) may come in handy.
Expand All @@ -18,7 +18,7 @@ Report mobile-only bugs to [Lichess mobile](https://github.com/veloce/lichobile/

## I want to suggest a feature for Lichess

Issue tickets on features that lack potential or effectiveness are not useful and may be closed. Discussions regarding whether a proposed new feature would be useful can be done on the [Lichess Feedback Forum](https://lichess.org/forum/lichess-feedback) to gauge feedback. The developers may also discuss the idea there, and if it is exemplary, a corresponding issue ticket will be made. **When you're ready, [make an issue ticket](https://github.com/ornicar/lila/issues/new)** and link relevant, constructive comments regarding it in your issue ticket (such as a detailed Reddit post; linking to an empty forum thread with only your own commentary adds no value). Make sure that the feature you propose:
Issue tickets on features that lack potential or effectiveness are not useful and may be closed. Discussions regarding whether a proposed new feature would be useful can be done on the [Lichess Feedback Forum](https://lichess.org/forum/lichess-feedback) to gauge feedback. The developers may also discuss the idea there, and if it is exemplary, a corresponding issue ticket will be made. **When you're ready, [make an issue ticket](https://github.com/lichess-org/lila/issues/new)** and link relevant, constructive comments regarding it in your issue ticket (such as a detailed Reddit post; linking to an empty forum thread with only your own commentary adds no value). Make sure that the feature you propose:

1. Is **effective in delivering a goal**. A feature that adds nothing new is purely fancy; please develop a userscript or userstyle for your personal use instead.
2. Doesn't rely on mundane assumptions. Non-technical people have the tendency to measure how difficult / easy a feature is to implement based on their unreliable instincts, and such assumptions wastes everyone's time. **Point out what needs to happen**, not what you think will happen.
Expand Down
2 changes: 1 addition & 1 deletion COPYING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Any file in this project that does not state otherwise and is not listed as an
exception below is part of lila and copyright (c) 2012-2021 the lila authors.

For a list of the authors see the commit log or
https://github.com/ornicar/lila/graphs/contributors.
https://github.com/lichess-org/lila/graphs/contributors.

Lila is free software; you can redistribute and/or modify it under the terms
of the GNU Affero General Public License as published by the Free Software
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# [lichess.org](https://lichess.org)

[![Build server](https://github.com/ornicar/lila/workflows/Build%20server/badge.svg)](https://github.com/ornicar/lila/actions?query=workflow%3A%22Build+server%22)
[![Build assets](https://github.com/ornicar/lila/workflows/Build%20assets/badge.svg)](https://github.com/ornicar/lila/actions?query=workflow%3A%22Build+assets%22)
[![Build server](https://github.com/lichess-org/lila/workflows/Build%20server/badge.svg)](https://github.com/lichess-org/lila/actions?query=workflow%3A%22Build+server%22)
[![Build assets](https://github.com/lichess-org/lila/workflows/Build%20assets/badge.svg)](https://github.com/lichess-org/lila/actions?query=workflow%3A%22Build+assets%22)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/lichess/localized.svg)](https://crowdin.com/project/lichess)
[![Twitter](https://img.shields.io/badge/Twitter-%40lichess-blue.svg)](https://twitter.com/lichess)

<img src="https://raw.githubusercontent.com/ornicar/lila/master/public/images/home-bicolor.png" alt="Lichess homepage" title="Lichess comes with light and dark theme, this screenshot shows both." />
<img src="https://raw.githubusercontent.com/lichess-org/lila/master/public/images/home-bicolor.png" alt="Lichess homepage" title="Lichess comes with light and dark theme, this screenshot shows both." />

Lila (li[chess in sca]la) is a free online chess game server focused on [realtime](https://lichess.org/games) gameplay and ease of use.

Expand All @@ -25,7 +25,7 @@ and relies on the [Play 2.8](https://www.playframework.com/) framework.
[scalatags](https://com-lihaoyi.github.io/scalatags/) is used for templating.
Pure chess logic is contained in the [scalachess](https://github.com/ornicar/scalachess) submodule.
The server is fully asynchronous, making heavy use of Scala Futures and [Akka streams](https://akka.io).
WebSocket connections are handled by a [separate server](https://github.com/ornicar/lila-ws) that communicates using [redis](https://redis.io/).
WebSocket connections are handled by a [separate server](https://github.com/lichess-org/lila-ws) that communicates using [redis](https://redis.io/).
Lichess talks to [Stockfish](https://stockfishchess.org/) deployed in an [AI cluster](https://github.com/niklasf/fishnet) of donated servers.
It uses [MongoDB](https://mongodb.org) to store more than 1.7 billion games, which are indexed by [elasticsearch](https://github.com/elastic/elasticsearch).
HTTP requests and WebSocket connections can be proxied by [nginx](https://nginx.org).
Expand All @@ -39,7 +39,7 @@ Please help us [translate Lichess with Crowdin](https://crowdin.com/project/lich
See [lichess.org/source](https://lichess.org/source) for a list of repositories.

[Join us on Discord](https://discord.gg/lichess) for more info.
Use [GitHub issues](https://github.com/ornicar/lila/issues) for bug reports and feature requests.
Use [GitHub issues](https://github.com/lichess-org/lila/issues) for bug reports and feature requests.

## Installation

Expand All @@ -48,7 +48,7 @@ Use [GitHub issues](https://github.com/ornicar/lila/issues) for bug reports and
run
```

The Wiki describes [how to setup a development environment](https://github.com/ornicar/lila/wiki/Lichess-Development-Onboarding).
The Wiki describes [how to setup a development environment](https://github.com/lichess-org/lila/wiki/Lichess-Development-Onboarding).

## HTTP API

Expand All @@ -70,11 +70,15 @@ For your own sake, please upgrade. Security and performance, think about it!
## License

Lila is licensed under the GNU Affero General Public License 3 or any later
version at your choice with an exception for Highcharts. See [copying](https://github.com/ornicar/lila/blob/master/COPYING.md) for
version at your choice with an exception for Highcharts. See [copying](https://github.com/lichess-org/lila/blob/master/COPYING.md) for
details.

## Credits

See [lichess.org/thanks](https://lichess.org/thanks) and the contributors here:

[![GitHub contributors](https://contrib.rocks/image?repo=ornicar/lila)](https://github.com/ornicar/lila/graphs/contributors)
[![GitHub contributors](https://contrib.rocks/image?repo=lichess-org/lila)](https://github.com/lichess-org/lila/graphs/contributors)

## Competence development program

Lichess would like to support its contributors in their competence development by covering costs of relevant training materials and activities. This is a small way to further empower contributors who have given their time to Lichess and to enable or improve additional contributions to Lichess in the future. For more information, including how to apply, check [Competence Development for Lichess contributors](https://lichess.org/page/competence-development).
16 changes: 9 additions & 7 deletions app/controllers/Account.scala
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,17 @@ final class Account(
AuthBody { implicit ctx => me =>
NotManaged {
implicit val req = ctx.body
env.security.forms closeAccount me flatMap { form =>
FormFuResult(form) { err =>
fuccess(html.account.close(me, err, managed = false))
} { _ =>
env.api.accountClosure.close(me, Holder(me)) inject {
Redirect(routes.User show me.username) withCookies env.lilaCookie.newSession
auth.HasherRateLimit(me.username, ctx.req) { _ =>
env.security.forms closeAccount me flatMap { form =>
FormFuResult(form) { err =>
fuccess(html.account.close(me, err, managed = false))
} { _ =>
env.api.accountClosure.close(me, Holder(me)) inject {
Redirect(routes.User show me.username) withCookies env.lilaCookie.newSession
}
}
}
}
}(rateLimitedFu)
}
}

Expand Down
3 changes: 2 additions & 1 deletion app/controllers/Challenge.scala
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ final class Challenge(
username =>
ChallengeIpRateLimit(ctx.ip) {
env.user.repo named username flatMap {
case None => Redirect(routes.Challenge.show(c.id)).fuccess
case None => Redirect(routes.Challenge.show(c.id)).fuccess
case Some(dest) if ctx.is(dest) => Redirect(routes.Challenge.show(c.id)).fuccess
case Some(dest) =>
env.challenge.granter(ctx.me, dest, c.perfType.some) flatMap {
case Some(denied) =>
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/Dev.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class Dev(env: Env) extends LilaController(env) {
env.prizeTournamentMakers,
env.pieceImageExternal,
env.evalCache.enable,
env.tournament.reloadDelaySetting
env.tournament.reloadEndpointSetting
)

def settings =
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/ForumPost.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ final class ForumPost(env: Env) extends LilaController(env) with ForumController
if (me.id == ~post.userId && !post.erased)
postApi.erasePost(post) inject Redirect(routes.ForumPost.redirect(id))
else
isGrantedMod(categSlug) flatMap { granted =>
CategGrantMod(categSlug) {
postApi.delete(categSlug, id, me) inject {
implicit val req = ctx.body
for {
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/PlayApi.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package controllers

import play.api.i18n.Lang
import play.api.mvc._
import scala.concurrent.duration._
import scala.util.chaining._
Expand Down Expand Up @@ -74,7 +73,7 @@ final class PlayApi(
// common code for bot & board APIs
private object impl {

def gameStream(me: UserModel, pov: Pov)(implicit lang: Lang) =
def gameStream(me: UserModel, pov: Pov)(implicit req: RequestHeader) =
env.game.gameRepo.withInitialFen(pov.game) map { wf =>
apiC.sourceToNdJsonOption(env.bot.gameStateStream(wf, pov.color, me))
}
Expand Down
7 changes: 5 additions & 2 deletions app/controllers/Tournament.scala
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,17 @@ final class Tournament(
partial = false,
withScores = true,
myInfo = Preload(myInfo)
)
).map(jsonView.addReloadEndpoint(_, tour, env.tournament.lilaHttp.handles))
chat <- loadChat(tour, json)
_ <- tour.teamBattle ?? { b =>
env.team.cached.preloadSet(b.teams)
}
streamers <- streamerCache get tour.id
shieldOwner <- env.tournament.shieldApi currentOwner tour
} yield Ok(html.tournament.show(tour, verdicts, json, chat, streamers, shieldOwner))
} yield {
env.tournament.lilaHttp.hit(tour)
Ok(html.tournament.show(tour, verdicts, json, chat, streamers, shieldOwner))
}
}
.monSuccess(_.tournament.apiShowPartial(partial = false, HTTPRequest clientName ctx.req)),
api = _ =>
Expand Down
4 changes: 3 additions & 1 deletion app/templating/AssetHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ trait AssetHelper { self: I18nHelper with SecurityHelper =>
val protocol = if (req.secure) "wss://" else "ws://"
s"$protocol$socketDomain"
}
val localDev = "http://127.0.0.1:3000"
ContentSecurityPolicy(
defaultSrc = List("'self'", assets),
connectSrc = "'self'" :: assets :: sockets ::: env.explorerEndpoint :: env.tablebaseEndpoint :: Nil,
connectSrc =
"'self'" :: assets :: sockets ::: env.explorerEndpoint :: env.tablebaseEndpoint :: localDev :: Nil,
styleSrc = List("'self'", "'unsafe-inline'", assets),
frameSrc = List("'self'", assets, "https://www.youtube.com", "https://player.twitch.tv"),
workerSrc = List("'self'", assets),
Expand Down
4 changes: 3 additions & 1 deletion app/views/activity.scala
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,15 @@ object activity {
else trans.activity.joinedNbSimuls.pluralSame(simuls.size),
subTag(
simuls.map { s =>
val win = s.pairingOf(u.id).flatMap(_.wins)
div(
a(href := routes.Simul.show(s.id))(
s.name,
" simul by ",
userIdLink(s.hostId.some)
),
scoreFrag(Score(s.wins, s.losses, s.draws, none))
if (isHost) scoreFrag(Score(s.wins, s.losses, s.draws, none))
else scoreFrag(Score(win.has(true) ?? 1, win.has(false) ?? 1, win.isEmpty ?? 1, none))
)
}
)
Expand Down
6 changes: 3 additions & 3 deletions app/views/chat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ object chat {
"writeable" -> writeable,
"public" -> public,
"permissions" -> Json
.obj("local" -> localMod)
.add("timeout" -> isGranted(_.ChatTimeout))
.add("shadowban" -> isGranted(_.Shadowban))
.obj("local" -> (public && localMod))
.add("timeout" -> (public && isGranted(_.ChatTimeout)))
.add("shadowban" -> (public && isGranted(_.Shadowban)))
)
.add("kobold" -> ctx.troll)
.add("blind" -> ctx.blind)
Expand Down
2 changes: 1 addition & 1 deletion app/views/mod/inquiry.scala
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ object inquiry {
title := "Cancel the inquiry, re-instore the report",
cls := "cancel"
)(
submitButton(dataIcon := "", cls := "fbt")
submitButton(dataIcon := "", cls := "fbt")(in.alreadyMarked option disabled)
)
)
)
Expand Down
2 changes: 1 addition & 1 deletion app/views/relay/show.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ object show {
name = trans.chatRoom.txt(),
timeout = c.timeout,
writeable = ctx.userId.??(rt.study.canChat),
public = false,
public = true,
resourceId = lila.chat.Chat.ResourceId(s"relay/${c.chat.id}"),
localMod = ctx.userId.??(rt.study.canContribute)
)
Expand Down
2 changes: 1 addition & 1 deletion app/views/site/contact.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object contact {
a(href := routes.ForumCateg.show("lichess-feedback"))(reportBugInForum())
),
li(
a(href := "https://github.com/ornicar/lila/issues")(reportWebsiteIssue())
a(href := "https://github.com/lichess-org/lila/issues")(reportWebsiteIssue())
),
li(
a(href := "https://github.com/veloce/lichobile/issues")(reportMobileIssue())
Expand Down
2 changes: 1 addition & 1 deletion app/views/site/dailyPuzzleSlackApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ object dailyPuzzleSlackApp {
),
h2("Privacy Policy"),
p(
"The app only collects and stores information necessary to deliver the service, which is limited to OAuth authentication information, Slack workspace/channel identifiers and app configuration settings. No personal information is processed expect for the username of users invoking slash commands. No personal information is stored."
"The app only collects and stores information necessary to deliver the service, which is limited to OAuth authentication information, Slack workspace/channel identifiers and app configuration settings. No personal information is processed except for the username of users invoking slash commands. No personal information is stored."
),
h2("Support and feedback"),
p(
Expand Down
6 changes: 3 additions & 3 deletions app/views/site/faq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object faq {
),
p(
whyIsLilaCalledLila(
a(href := "https://github.com/ornicar/lila")("lila"),
a(href := "https://github.com/lichess-org/lila")("lila"),
a(href := "https://www.scala-lang.org/")("Scala")
)
)
Expand Down Expand Up @@ -190,7 +190,7 @@ object faq {
titlesAvailableOnLichess.txt(),
p(
lichessRecognizeAllOTBtitles(
a(href := "https://github.com/ornicar/lila/wiki/Handling-title-verification-requests")(
a(href := "https://github.com/lichess-org/lila/wiki/Handling-title-verification-requests")(
asWellAsManyNMtitles()
)
)
Expand Down Expand Up @@ -223,7 +223,7 @@ object faq {
whatUsernameCanIchoose.txt(),
p(
usernamesNotOffensive(
a(href := "https://github.com/ornicar/lila/wiki/Username-policy")(guidelines())
a(href := "https://github.com/lichess-org/lila/wiki/Username-policy")(guidelines())
)
)
),
Expand Down
4 changes: 2 additions & 2 deletions app/views/site/freeJs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ object freeJs {

private lazy val agpl = a(href := "https://www.gnu.org/licenses/agpl-3.0.en.html")("AGPL-3.0+")

private def github(path: String) = a(href := s"https://github.com/ornicar/lila/tree/master/$path")(path)
private def github(path: String) = a(href := s"https://github.com/lichess-org/lila/tree/master/$path")(path)

private val uiModules = List(
"analyse",
Expand Down Expand Up @@ -43,7 +43,7 @@ object freeJs {
),
p(cls := "box__pad")(
"Here are all frontend modules from ",
a(href := "https://github.com/ornicar/lila/tree/master/ui")("ornicar/lila ui"),
a(href := "https://github.com/lichess-org/lila/tree/master/ui")("lichess-org/lila ui"),
" in ",
a(href := "https://www.gnu.org/licenses/javascript-labels.en.html")("Web Labels"),
" compatible format:"
Expand Down
Loading

0 comments on commit 60ee084

Please sign in to comment.