mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-23 20:26:39 +00:00
[frontend] Restructure Frontend Sources (#634)
* 🐸restructure frontend stuff, include admin and future user panel in main repo, properly deduplicate bundles for css+js across uses
* rename bundled to dist, caught by gitignore
* re-include status.css for profile template
* default to localhost
* serve frontend panels
* add todo message for abstraction
* refactor oauth registration flow
* oauth restructure
* update footer template
* change panel routes
* remove superfluous css imports
* write bundle to disk from test server, use forked budo-express
* wrap all page content in container
for robustness with addons etc injection other elements in body
* update documentation, goreleaser, Dockerfile
* update template meta tags
* add AGPL-3.0+ license header everywhere
* only attach update listener on EventEmitter
* cleaner config for various frontend bundles
* fix bundler script paths
* Merge commit 'd191931932b9293ce1be44ed08a1e69b9fcc1e25'
* fix up dockerfile, goreleaser
* go mod tidy
* add uglifyify
* move status hide/show js to frontend bundle
* fix stylesheet color( func regressions
* update contributing docs for new build path
* update goreleaser + docker building
* resolve dependency paths properly
* update package name
* use api errorhandler
Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
This commit is contained in:
parent
f30a581268
commit
b43f9ceca9
|
@ -1,8 +1,9 @@
|
||||||
.github
|
.github
|
||||||
cmd
|
.vscode
|
||||||
|
archive
|
||||||
|
dist
|
||||||
docs
|
docs
|
||||||
example
|
example
|
||||||
internal
|
|
||||||
scripts
|
scripts
|
||||||
test
|
test
|
||||||
testrig
|
testrig
|
||||||
|
|
|
@ -3,16 +3,12 @@ project_name: gotosocial
|
||||||
before:
|
before:
|
||||||
# https://goreleaser.com/customization/hooks/
|
# https://goreleaser.com/customization/hooks/
|
||||||
hooks:
|
hooks:
|
||||||
# tidy up and lint
|
|
||||||
- go mod tidy
|
|
||||||
- go fmt ./...
|
|
||||||
# generate the swagger.yaml file using go-swagger and bundle it into the assets directory
|
# generate the swagger.yaml file using go-swagger and bundle it into the assets directory
|
||||||
- swagger generate spec -o docs/api/swagger.yaml --scan-models
|
- swagger generate spec -o web/assets/swagger.yaml --scan-models
|
||||||
- sed -i "s/REPLACE_ME/{{ incpatch .Version }}/" docs/api/swagger.yaml
|
- sed -i "s/REPLACE_ME/{{ incpatch .Version }}/" web/assets/swagger.yaml
|
||||||
- cp docs/api/swagger.yaml web/assets/swagger.yaml
|
# bundle web assets
|
||||||
# install and bundle the web assets and styling
|
- yarn install --cwd web/source
|
||||||
- yarn install --cwd web/gotosocial-styling
|
- scripts/bundle.sh
|
||||||
- node web/gotosocial-styling/index.js --build-dir="web/assets"
|
|
||||||
builds:
|
builds:
|
||||||
# https://goreleaser.com/customization/build/
|
# https://goreleaser.com/customization/build/
|
||||||
-
|
-
|
||||||
|
@ -67,6 +63,10 @@ dockers:
|
||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||||
extra_files:
|
extra_files:
|
||||||
- web
|
- web
|
||||||
|
- go.mod
|
||||||
|
- go.sum
|
||||||
|
- cmd
|
||||||
|
- internal
|
||||||
-
|
-
|
||||||
use: buildx
|
use: buildx
|
||||||
goos: linux
|
goos: linux
|
||||||
|
@ -82,6 +82,10 @@ dockers:
|
||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||||
extra_files:
|
extra_files:
|
||||||
- web
|
- web
|
||||||
|
- go.mod
|
||||||
|
- go.sum
|
||||||
|
- cmd
|
||||||
|
- internal
|
||||||
-
|
-
|
||||||
use: buildx
|
use: buildx
|
||||||
goos: linux
|
goos: linux
|
||||||
|
@ -98,6 +102,10 @@ dockers:
|
||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||||
extra_files:
|
extra_files:
|
||||||
- web
|
- web
|
||||||
|
- go.mod
|
||||||
|
- go.sum
|
||||||
|
- cmd
|
||||||
|
- internal
|
||||||
-
|
-
|
||||||
use: buildx
|
use: buildx
|
||||||
goos: linux
|
goos: linux
|
||||||
|
@ -114,6 +122,10 @@ dockers:
|
||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||||
extra_files:
|
extra_files:
|
||||||
- web
|
- web
|
||||||
|
- go.mod
|
||||||
|
- go.sum
|
||||||
|
- cmd
|
||||||
|
- internal
|
||||||
docker_manifests:
|
docker_manifests:
|
||||||
- name_template: superseriousbusiness/{{ .ProjectName }}:{{ .Version }}
|
- name_template: superseriousbusiness/{{ .ProjectName }}:{{ .Version }}
|
||||||
image_templates:
|
image_templates:
|
||||||
|
@ -136,7 +148,8 @@ archives:
|
||||||
- README.md
|
- README.md
|
||||||
- CHANGELOG*
|
- CHANGELOG*
|
||||||
# web assets
|
# web assets
|
||||||
- web
|
- web/assets
|
||||||
|
- web/template
|
||||||
# example config files
|
# example config files
|
||||||
- example/config.yaml
|
- example/config.yaml
|
||||||
- example/gotosocial.service
|
- example/gotosocial.service
|
||||||
|
|
|
@ -28,7 +28,8 @@ Check the [issues](https://github.com/superseriousbusiness/gotosocial/issues) to
|
||||||
- [Updating Swagger docs](#updating-swagger-docs)
|
- [Updating Swagger docs](#updating-swagger-docs)
|
||||||
- [CI/CD configuration](#cicd-configuration)
|
- [CI/CD configuration](#cicd-configuration)
|
||||||
- [Release Checklist](#release-checklist)
|
- [Release Checklist](#release-checklist)
|
||||||
- [Building releases and Docker containers](#building-releases-and-docker-containers)
|
- [What if something goes wrong?](#what-if-something-goes-wrong)
|
||||||
|
- [Building Docker containers](#building-docker-containers)
|
||||||
- [With GoReleaser](#with-goreleaser)
|
- [With GoReleaser](#with-goreleaser)
|
||||||
- [Manually](#manually)
|
- [Manually](#manually)
|
||||||
- [Financial Compensation](#financial-compensation)
|
- [Financial Compensation](#financial-compensation)
|
||||||
|
@ -70,19 +71,21 @@ To work with the stylesheet for templates, you need [Node.js](https://nodejs.org
|
||||||
To install Yarn dependencies:
|
To install Yarn dependencies:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn install --cwd web/gotosocial-styling
|
yarn install --cwd web/source
|
||||||
```
|
```
|
||||||
|
|
||||||
To recompile bundles:
|
To recompile bundles:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
node web/gotosocial-styling/index.js --build-dir="web/assets"
|
BUDO_BUILD=1 node web/source
|
||||||
```
|
```
|
||||||
|
|
||||||
You can do automatic live-reloads of bundles with:
|
Or you can run livereloading in development. It will start a webserver (ip/port printed in console, default localhost:8081), while also keeping the bundles
|
||||||
|
up-to-date on disk. You can access the user/admin panels at localhost:8080/user, localhost:8080/admin, or run in tandem with the GoToSocial testrig, which will also
|
||||||
|
serve the updated bundles from disk.
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
NODE_ENV=development node web/gotosocial-styling/index.js --build-dir="web/assets"
|
NODE_ENV=development node web/source
|
||||||
```
|
```
|
||||||
|
|
||||||
### Golang forking quirks
|
### Golang forking quirks
|
||||||
|
@ -185,7 +188,7 @@ Finally, to run tests against both database types one after the other, use:
|
||||||
|
|
||||||
### CLI Tests
|
### CLI Tests
|
||||||
|
|
||||||
In [./test/cliparsing.sh](./test/cliparsing.sh) there are a bunch of tests for making sure that CLI flags, config, and environment variables get parsed as expected.
|
In [./test/cliparsing.sh](./test/cliparsing.sh) and [./test/envparsing.sh](./test/envparsing.sh) there are a bunch of tests for making sure that CLI flags, config, and environment variables get parsed as expected.
|
||||||
|
|
||||||
Although these tests *are* part of the CI/CD testing process, you probably won't need to worry too much about running them yourself. That is, unless you're messing about with code inside the `main` package in `cmd/gotosocial`, or inside the `config` package in `internal/config`.
|
Although these tests *are* part of the CI/CD testing process, you probably won't need to worry too much about running them yourself. That is, unless you're messing about with code inside the `main` package in `cmd/gotosocial`, or inside the `config` package in `internal/config`.
|
||||||
|
|
||||||
|
@ -299,7 +302,9 @@ That is: Delete the tag.
|
||||||
|
|
||||||
Either way, once we've fixed the issue, we just start from the top of this list again. Version numbers are cheap. It's cheap to burn them.
|
Either way, once we've fixed the issue, we just start from the top of this list again. Version numbers are cheap. It's cheap to burn them.
|
||||||
|
|
||||||
## Building releases and Docker containers
|
## Building Docker containers
|
||||||
|
|
||||||
|
For both of the below methods, you need to have [Docker buildx](https://docs.docker.com/buildx/working-with-buildx/) installed.
|
||||||
|
|
||||||
### With GoReleaser
|
### With GoReleaser
|
||||||
|
|
||||||
|
@ -311,22 +316,30 @@ Normally, these processes are handled by Drone (see CI/CD above). However, you c
|
||||||
|
|
||||||
To do this, first [install GoReleaser](https://goreleaser.com/install/).
|
To do this, first [install GoReleaser](https://goreleaser.com/install/).
|
||||||
|
|
||||||
Then, to create snapshot builds, do:
|
Then install GoSwagger as described in [the Swagger section](#updating-swagger-docs).
|
||||||
|
|
||||||
|
Then install Node and Yarn as described in [Stylesheet / Web dev](#stylesheet--web-dev).
|
||||||
|
|
||||||
|
Finally, to create a snapshot build, do:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
goreleaser release --rm-dist --snapshot
|
goreleaser --rm-dist --snapshot
|
||||||
```
|
```
|
||||||
|
|
||||||
If all goes according to plan, you should now have a bunch of multiple-architecture binaries and tars inside the `./dist` folder, and a snapshot Docker image should be built (check your terminal output for version).
|
If all goes according to plan, you should now have a bunch of multiple-architecture binaries and tars inside the `./dist` folder, and snapshot Docker images should be built (check your terminal output for version).
|
||||||
|
|
||||||
### Manually
|
### Manually
|
||||||
|
|
||||||
If you prefer a simple approach with fewer dependencies, you can also just build a Docker container manually in the following way:
|
If you prefer a simple approach to building a Docker container, with fewer dependencies, you can also just build in the following way:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./scripts/build.sh && docker build -t superseriousbusiness/gotosocial:latest .
|
./scripts/build.sh && docker buildx build -t superseriousbusiness/gotosocial:latest .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The above command first builds the `gotosocial` binary, then invokes Docker buildx to build the container image.
|
||||||
|
|
||||||
|
You don't need to install go-swagger, Node, or Yarn to build Docker images this way.
|
||||||
|
|
||||||
## Financial Compensation
|
## Financial Compensation
|
||||||
|
|
||||||
Right now there's no structure in place for financial compensation for pull requests and code. This is simply because there's no money being made on the project apart from the very small weekly Liberapay donations.
|
Right now there's no structure in place for financial compensation for pull requests and code. This is simply because there's no money being made on the project apart from the very small weekly Liberapay donations.
|
||||||
|
|
35
Dockerfile
35
Dockerfile
|
@ -1,26 +1,31 @@
|
||||||
# syntax=docker/dockerfile:1.3
|
# syntax=docker/dockerfile:1.3
|
||||||
|
# stage 1: generate up-to-date swagger.yaml to put in the final container
|
||||||
|
FROM --platform=${BUILDPLATFORM} quay.io/goswagger/swagger:v0.29.0 AS swagger
|
||||||
|
|
||||||
# bundle the admin webapp
|
COPY go.mod /go/src/github.com/superseriousbusiness/gotosocial/go.mod
|
||||||
FROM --platform=${BUILDPLATFORM} node:17.6.0-alpine3.15 AS admin_builder
|
COPY go.sum /go/src/github.com/superseriousbusiness/gotosocial/go.sum
|
||||||
RUN apk update && apk upgrade --no-cache
|
COPY cmd /go/src/github.com/superseriousbusiness/gotosocial/cmd
|
||||||
RUN apk add git
|
COPY internal /go/src/github.com/superseriousbusiness/gotosocial/internal
|
||||||
|
WORKDIR /go/src/github.com/superseriousbusiness/gotosocial
|
||||||
|
RUN swagger generate spec -o /go/src/github.com/superseriousbusiness/gotosocial/swagger.yaml --scan-models
|
||||||
|
|
||||||
RUN git clone https://github.com/superseriousbusiness/gotosocial-admin
|
# stage 2: generate the web/assets/dist bundles
|
||||||
WORKDIR /gotosocial-admin
|
FROM --platform=${BUILDPLATFORM} node:16.15.1-alpine3.15 AS bundler
|
||||||
|
|
||||||
RUN npm install
|
COPY web web
|
||||||
RUN node index.js
|
RUN yarn install --cwd web/source && \
|
||||||
|
BUDO_BUILD=1 node web/source && \
|
||||||
|
rm -r web/source
|
||||||
|
|
||||||
FROM --platform=${TARGETPLATFORM} alpine:3.15.0 AS executor
|
# stage 3: build the executor container
|
||||||
|
FROM --platform=${TARGETPLATFORM} alpine:3.15.4 as executor
|
||||||
|
|
||||||
# copy over the binary from the first stage
|
# copy the dist binary created by goreleaser or build.sh
|
||||||
COPY --chown=1000:1000 gotosocial /gotosocial/gotosocial
|
COPY --chown=1000:1000 gotosocial /gotosocial/gotosocial
|
||||||
|
|
||||||
# copy over the web directory with templates etc
|
# copy over the web directories with templates, assets etc
|
||||||
COPY --chown=1000:1000 web /gotosocial/web
|
COPY --chown=1000:1000 --from=bundler web /gotosocial/web
|
||||||
|
COPY --chown=1000:1000 --from=swagger /go/src/github.com/superseriousbusiness/gotosocial/swagger.yaml web/assets/swagger.yaml
|
||||||
# copy over the admin directory
|
|
||||||
COPY --chown=1000:1000 --from=admin_builder /gotosocial-admin/public /gotosocial/web/assets/admin
|
|
||||||
|
|
||||||
WORKDIR "/gotosocial"
|
WORKDIR "/gotosocial"
|
||||||
ENTRYPOINT [ "/gotosocial/gotosocial", "server", "start" ]
|
ENTRYPOINT [ "/gotosocial/gotosocial", "server", "start" ]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Admin Control Panel
|
# Admin Control Panel
|
||||||
|
|
||||||
[gotosocial-admin](https://github.com/superseriousbusiness/gotosocial-admin) is a simple webclient that uses the [admin api routes](https://docs.gotosocial.org/en/latest/api/swagger/#operations-tag-admin) to manage your instance. It uses the same OAUTH mechanism as normal clients (with scope: admin), and as such can be hosted anywhere, separately from your instance, or run locally. A public installation is available here: [https://gts.superseriousbusiness.org/admin](https://gts.superseriousbusiness.org/admin).
|
The GoToSocial admin panel is a simple webclient that uses the [admin api routes](https://docs.gotosocial.org/en/latest/api/swagger/#operations-tag-admin) to manage your instance. It uses the same OAUTH mechanism as normal clients (with scope: admin), and as such can be hosted anywhere, separately from your instance, or run locally. A public installation is available here: [https://gts.superseriousbusiness.org/admin](https://gts.superseriousbusiness.org/admin).
|
||||||
|
|
||||||
## Using the panel
|
## Using the panel
|
||||||
To use the Admin API your account has to be promoted as such:
|
To use the Admin API your account has to be promoted as such:
|
||||||
|
@ -16,11 +16,11 @@ any other client.
|
||||||
|
|
||||||
You can change the instance's settings like the title and descriptions, and add/remove/change domain blocks including a bulk import/export.
|
You can change the instance's settings like the title and descriptions, and add/remove/change domain blocks including a bulk import/export.
|
||||||
|
|
||||||
## Installing the panel
|
## Building the panel
|
||||||
Build requirements: some version of [Node.js](https://nodejs.org) and yarn.
|
Build requirements: some version of [Node.js](https://nodejs.org) and yarn.
|
||||||
```
|
```
|
||||||
git clone https://github.com/superseriousbusiness/gotosocial-admin.git && cd gotosocial-admin
|
yarn install --cwd web/source
|
||||||
yarn install
|
BUDO_BUILD=1 node web/source
|
||||||
node index.js
|
|
||||||
```
|
```
|
||||||
This will compile a static bundle in `public/`, which can be copied to any webhost, or put into your GoToSocial installation in the `web/admin` directory.
|
|
||||||
|
See also: [Contributing.md Stylesheet / Web dev](https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#stylesheet--web-dev)
|
2
go.sum
2
go.sum
|
@ -663,8 +663,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
|
||||||
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA=
|
|
||||||
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
|
||||||
golang.org/x/net v0.0.0-20220524220425-1d687d428aca h1:xTaFYiPROfpPhqrfTIDXj0ri1SpfueYT951s4bAuDO8=
|
golang.org/x/net v0.0.0-20220524220425-1d687d428aca h1:xTaFYiPROfpPhqrfTIDXj0ri1SpfueYT951s4bAuDO8=
|
||||||
golang.org/x/net v0.0.0-20220524220425-1d687d428aca/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
golang.org/x/net v0.0.0-20220524220425-1d687d428aca/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/api"
|
"github.com/superseriousbusiness/gotosocial/internal/api"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/config"
|
"github.com/superseriousbusiness/gotosocial/internal/config"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||||
|
@ -104,14 +103,10 @@ func New(processor processing.Processor) (api.ClientModule, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Module) baseHandler(c *gin.Context) {
|
func (m *Module) baseHandler(c *gin.Context) {
|
||||||
l := logrus.WithField("func", "BaseGETHandler")
|
|
||||||
l.Trace("serving index html")
|
|
||||||
|
|
||||||
host := config.GetHost()
|
host := config.GetHost()
|
||||||
instance, err := m.processor.InstanceGet(c.Request.Context(), host)
|
instance, err := m.processor.InstanceGet(c.Request.Context(), host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Debugf("error getting instance from processor: %s", err)
|
api.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "internal server error"})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,16 +115,66 @@ func (m *Module) baseHandler(c *gin.Context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: abstract the {admin, user}panel handlers in some way
|
||||||
|
func (m *Module) AdminPanelHandler(c *gin.Context) {
|
||||||
|
host := config.GetHost()
|
||||||
|
instance, err := m.processor.InstanceGet(c.Request.Context(), host)
|
||||||
|
if err != nil {
|
||||||
|
api.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.HTML(http.StatusOK, "frontend.tmpl", gin.H{
|
||||||
|
"instance": instance,
|
||||||
|
"stylesheets": []string{
|
||||||
|
"/assets/Fork-Awesome/css/fork-awesome.min.css",
|
||||||
|
"/assets/dist/panels-admin-style.css",
|
||||||
|
},
|
||||||
|
"javascript": []string{
|
||||||
|
"/assets/dist/bundle.js",
|
||||||
|
"/assets/dist/admin-panel.js",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Module) UserPanelHandler(c *gin.Context) {
|
||||||
|
host := config.GetHost()
|
||||||
|
instance, err := m.processor.InstanceGet(c.Request.Context(), host)
|
||||||
|
if err != nil {
|
||||||
|
api.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.HTML(http.StatusOK, "frontend.tmpl", gin.H{
|
||||||
|
"instance": instance,
|
||||||
|
"stylesheets": []string{
|
||||||
|
"/assets/Fork-Awesome/css/fork-awesome.min.css",
|
||||||
|
"/assets/dist/_colors.css",
|
||||||
|
"/assets/dist/base.css",
|
||||||
|
"/assets/dist/panels-user-style.css",
|
||||||
|
},
|
||||||
|
"javascript": []string{
|
||||||
|
"/assets/dist/bundle.js",
|
||||||
|
"/assets/dist/user-panel.js",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Route satisfies the RESTAPIModule interface
|
// Route satisfies the RESTAPIModule interface
|
||||||
func (m *Module) Route(s router.Router) error {
|
func (m *Module) Route(s router.Router) error {
|
||||||
// serve static files from assets dir at /assets
|
// serve static files from assets dir at /assets
|
||||||
s.AttachStaticFS("/assets", fileSystem{http.Dir(m.assetsPath)})
|
s.AttachStaticFS("/assets", fileSystem{http.Dir(m.assetsPath)})
|
||||||
|
|
||||||
// serve admin panel from within assets dir at /admin/
|
s.AttachHandler(http.MethodGet, "/admin", m.AdminPanelHandler)
|
||||||
// and redirect /admin to /admin/
|
// redirect /admin/ to /admin
|
||||||
s.AttachStaticFS("/admin/", fileSystem{http.Dir(m.adminPath)})
|
s.AttachHandler(http.MethodGet, "/admin/", func(c *gin.Context) {
|
||||||
s.AttachHandler(http.MethodGet, "/admin", func(c *gin.Context) {
|
c.Redirect(http.StatusMovedPermanently, "/admin")
|
||||||
c.Redirect(http.StatusMovedPermanently, "/admin/")
|
})
|
||||||
|
|
||||||
|
s.AttachHandler(http.MethodGet, "/user", m.UserPanelHandler)
|
||||||
|
// redirect /settings/ to /settings
|
||||||
|
s.AttachHandler(http.MethodGet, "/user/", func(c *gin.Context) {
|
||||||
|
c.Redirect(http.StatusMovedPermanently, "/user")
|
||||||
})
|
})
|
||||||
|
|
||||||
// serve front-page
|
// serve front-page
|
||||||
|
|
|
@ -108,8 +108,11 @@ func (m *Module) profileGETHandler(c *gin.Context) {
|
||||||
"statuses": statusResp.Items,
|
"statuses": statusResp.Items,
|
||||||
"stylesheets": []string{
|
"stylesheets": []string{
|
||||||
"/assets/Fork-Awesome/css/fork-awesome.min.css",
|
"/assets/Fork-Awesome/css/fork-awesome.min.css",
|
||||||
"/assets/status.css",
|
"/assets/dist/status.css",
|
||||||
"/assets/profile.css",
|
"/assets/dist/profile.css",
|
||||||
|
},
|
||||||
|
"javascript": []string{
|
||||||
|
"/assets/dist/frontend.js",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,13 @@ func (m *Module) threadGETHandler(c *gin.Context) {
|
||||||
"instance": instance,
|
"instance": instance,
|
||||||
"status": status,
|
"status": status,
|
||||||
"context": context,
|
"context": context,
|
||||||
"stylesheets": []string{"/assets/Fork-Awesome/css/fork-awesome.min.css", "/assets/status.css"},
|
"stylesheets": []string{
|
||||||
|
"/assets/Fork-Awesome/css/fork-awesome.min.css",
|
||||||
|
"/assets/dist/status.css",
|
||||||
|
},
|
||||||
|
"javascript": []string{
|
||||||
|
"/assets/dist/frontend.js",
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
scripts/bundle.sh
Executable file
8
scripts/bundle.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# this script is really just here because GoReleaser doesn't let
|
||||||
|
# you set env vars in your 'before' commands in the free version
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
BUDO_BUILD=1 node web/source
|
|
@ -1,230 +0,0 @@
|
||||||
html, body {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
background: rgb(70, 79, 88);
|
|
||||||
color: #fafaff;
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
display: grid;
|
|
||||||
|
|
||||||
grid-template-rows: auto 1fr auto;
|
|
||||||
min-height: 100vh;
|
|
||||||
line-height: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
main {
|
|
||||||
background: #525c66;
|
|
||||||
display: grid;
|
|
||||||
padding-top: 2rem;
|
|
||||||
padding-bottom: 2rem;
|
|
||||||
grid-template-columns: 1fr 50% 1fr;
|
|
||||||
grid-template-columns: auto min(92%, 90ch) auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
main .left {
|
|
||||||
grid-column: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
main .right {
|
|
||||||
grid-column: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
main.lightgray {
|
|
||||||
background: #525c66;
|
|
||||||
}
|
|
||||||
|
|
||||||
main > * {
|
|
||||||
align-self: start;
|
|
||||||
grid-column: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
header {
|
|
||||||
background: rgb(70, 79, 88);
|
|
||||||
padding: 2rem 0;
|
|
||||||
padding-bottom: 0;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
header img {
|
|
||||||
height: 4rem;
|
|
||||||
padding-left: 2rem;
|
|
||||||
padding-bottom: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
header div {
|
|
||||||
height: 100%;
|
|
||||||
margin: 0 2rem;
|
|
||||||
margin-top: -2rem;
|
|
||||||
flex-grow: 1;
|
|
||||||
align-self: center;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
header div h1 {
|
|
||||||
align-self: center;
|
|
||||||
color: #fafaff;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
/* color: $acc1; */
|
|
||||||
margin: 0;
|
|
||||||
line-height: 2.4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: #de8957;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button, button {
|
|
||||||
border-radius: 0.2rem;
|
|
||||||
background: #de8957;
|
|
||||||
color: #fafaff;
|
|
||||||
text-decoration: none;
|
|
||||||
font-size: 1.2rem;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 0.5rem;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:hover, button:hover {
|
|
||||||
background: #c76d33;
|
|
||||||
}
|
|
||||||
|
|
||||||
.count {
|
|
||||||
background: rgb(70, 79, 88);
|
|
||||||
border-radius: 0.3rem;
|
|
||||||
padding: 0.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nounderline {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.accent {
|
|
||||||
color: #de8957;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
justify-self: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo img {
|
|
||||||
height: 30vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.apps {
|
|
||||||
align-self: start;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.apps .applist {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
grid-gap: 0.5rem;
|
|
||||||
align-content: start;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.apps .applist .entry {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 30% 1fr;
|
|
||||||
gap: 0.5rem;
|
|
||||||
padding: 0.5rem;
|
|
||||||
background: rgb(70, 79, 88);
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.apps .applist .entry .logo {
|
|
||||||
align-self: center;
|
|
||||||
width: 100%;
|
|
||||||
object-fit: contain;
|
|
||||||
flex: 1 1 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.apps .applist .entry .logo.redraw {
|
|
||||||
fill: #fafaff;
|
|
||||||
stroke: #fafaff;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.apps .applist .entry div {
|
|
||||||
padding: 1rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.apps .applist .entry div h3 {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.login form {
|
|
||||||
display: inline-grid;
|
|
||||||
grid-template-columns: auto 100%;
|
|
||||||
grid-gap: 0.7rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.login form button {
|
|
||||||
place-self: center;
|
|
||||||
grid-column: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.error {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.error span {
|
|
||||||
font-size: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.error pre {
|
|
||||||
border: 1px solid #ff000080;
|
|
||||||
margin-left: 1em;
|
|
||||||
padding: 0 0.7em;
|
|
||||||
border-radius: 0.5em;
|
|
||||||
background-color: #ff000010;
|
|
||||||
font-size: 1.3em;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
input, select, textarea {
|
|
||||||
border: 1px solid #fafaff;
|
|
||||||
color: #fafaff;
|
|
||||||
background: #525c66;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
|
||||||
align-self: end;
|
|
||||||
|
|
||||||
padding: 2rem;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer a {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (orientation: portrait) {
|
|
||||||
main {
|
|
||||||
grid-template-columns: 1fr 92% 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
header {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
|
||||||
margin-top: 2rem;
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer div {
|
|
||||||
margin: 0.3rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
section.apps .applist {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -1,110 +0,0 @@
|
||||||
main {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.headerimage img {
|
|
||||||
width: 100%;
|
|
||||||
height: 15em;
|
|
||||||
object-fit: cover;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile {
|
|
||||||
position: relative;
|
|
||||||
background: rgb(75, 84, 93);
|
|
||||||
padding: 2rem;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: space-around;
|
|
||||||
gap: 0.5rem;
|
|
||||||
margin-bottom: 0.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile .basic {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
flex: 1 1 25em;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile .basic a {
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile .basic .avatar-container {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 25em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile .basic .avatar-container .avatar {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile .basic .avatar-container .avatar img {
|
|
||||||
object-fit: cover;
|
|
||||||
border-radius: 10px;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile .basic .avatar-container:before {
|
|
||||||
content: "";
|
|
||||||
float: left;
|
|
||||||
padding-top: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile .basic .displayname {
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.6rem;
|
|
||||||
align-self: start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile .detailed {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
flex: 1 1 25em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile .detailed h2 {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile .detailed .bio {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile .detailed .bio a {
|
|
||||||
color: #de8957;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.accountstats {
|
|
||||||
position: relative;
|
|
||||||
background: rgb(75, 84, 93);
|
|
||||||
padding: 0.5rem;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: space-evenly;
|
|
||||||
gap: 0.5rem;
|
|
||||||
margin-bottom: 0.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.accountstats .entry {
|
|
||||||
background: rgb(89, 99, 110);
|
|
||||||
padding: 0.5rem;
|
|
||||||
flex-grow: 1;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer + div {
|
|
||||||
/* something weird from the devstack.. */
|
|
||||||
display: none;
|
|
||||||
}
|
|
|
@ -1,230 +0,0 @@
|
||||||
main {
|
|
||||||
background: transparent;
|
|
||||||
grid-auto-rows: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.thread {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot {
|
|
||||||
position: relative;
|
|
||||||
background: rgb(75, 84, 93);
|
|
||||||
padding: 2rem;
|
|
||||||
/* padding-bottom: 0; */
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 3.2rem auto 1fr;
|
|
||||||
column-gap: 0.5rem;
|
|
||||||
margin-bottom: 0.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot a {
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .avatar {
|
|
||||||
grid-row: span 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .avatar img {
|
|
||||||
height: 3.2rem;
|
|
||||||
width: 3.2rem;
|
|
||||||
object-fit: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .displayname {
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.2rem;
|
|
||||||
align-self: start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .username {
|
|
||||||
color: #b0b0b5;
|
|
||||||
justify-self: start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot input.spoiler:checked ~ .content {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .spoiler label {
|
|
||||||
background: #de8957;
|
|
||||||
border-radius: 0.3rem;
|
|
||||||
padding: 0.3rem;
|
|
||||||
margin-left: 0.4rem;
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .text {
|
|
||||||
margin: 0;
|
|
||||||
grid-column: span 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .text a {
|
|
||||||
color: #de8957;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .media {
|
|
||||||
margin-top: 0.6rem;
|
|
||||||
border-radius: 0.2rem;
|
|
||||||
grid-column: span 3;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 50% 50%;
|
|
||||||
grid-auto-rows: 10rem;
|
|
||||||
overflow: hidden;
|
|
||||||
gap: 0.3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .media a {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .media .no-image-desc {
|
|
||||||
display: flex;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0.1rem;
|
|
||||||
right: 0.4rem;
|
|
||||||
color: white;
|
|
||||||
background: #5897df;
|
|
||||||
padding: 0.2rem 0.4rem;
|
|
||||||
border-radius: 100%;
|
|
||||||
z-index: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .media .no-image-desc i.fa {
|
|
||||||
display: block;
|
|
||||||
line-height: 1.3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .media .no-image-desc span {
|
|
||||||
margin-left: 0.3rem;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .media .no-image-desc:hover span {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .media .no-image-desc:hover {
|
|
||||||
border-radius: 0.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .media img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .media.single a {
|
|
||||||
grid-column: span 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .media.odd a:first-child, .toot .media.double a {
|
|
||||||
grid-row: span 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .info {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .info div {
|
|
||||||
position: relative;
|
|
||||||
padding-right: 1.3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .info .stats {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .info {
|
|
||||||
|
|
||||||
color: #b0b0b5;
|
|
||||||
grid-column: span 3;
|
|
||||||
margin-top: 0.5rem;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .info div.stats::after {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .info div::after {
|
|
||||||
display: block;
|
|
||||||
background: #b0b0b5;
|
|
||||||
height: 0.25rem;
|
|
||||||
width: 0.25rem;
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
top: calc((1.5rem - 0.25rem) / 2);
|
|
||||||
right: 0.55rem;
|
|
||||||
border-radius: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .info div:last-child::after {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .info div:last-child {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot .toot-link {
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
text-indent: 100%;
|
|
||||||
white-space: nowrap;
|
|
||||||
|
|
||||||
position: absolute;
|
|
||||||
z-index: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot {}
|
|
||||||
|
|
||||||
.toot:first-child {
|
|
||||||
/* top left, top right */
|
|
||||||
border-radius: 0.3rem 0.3rem 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot:last-child {
|
|
||||||
/* bottom left, bottom right */
|
|
||||||
border-radius: 0 0 0.3rem 0.3rem;
|
|
||||||
padding-bottom: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot.expanded {
|
|
||||||
background: #525c66;
|
|
||||||
padding-bottom: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot.expanded .displayname {
|
|
||||||
grid-column: span 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot.expanded .text {
|
|
||||||
grid-column: span 3;
|
|
||||||
grid-row: span 1;
|
|
||||||
margin-top: 0.3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot.expanded .info {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot.expanded .media {
|
|
||||||
grid-auto-rows: 1fr;
|
|
||||||
max-height: 120rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer + div { /* something weird from the devstack.. */
|
|
||||||
display: none;
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
"extends": "@f0x52/eslint-config"
|
|
||||||
};
|
|
3
web/gotosocial-styling/.gitignore
vendored
3
web/gotosocial-styling/.gitignore
vendored
|
@ -1,3 +0,0 @@
|
||||||
node_modules
|
|
||||||
yarn-error.log
|
|
||||||
build/*
|
|
|
@ -1,661 +0,0 @@
|
||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 19 November 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works, specifically designed to ensure
|
|
||||||
cooperation with the community in the case of network server software.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
Developers that use our General Public Licenses protect your rights
|
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
|
||||||
you this License which gives you legal permission to copy, distribute
|
|
||||||
and/or modify the software.
|
|
||||||
|
|
||||||
A secondary benefit of defending all users' freedom is that
|
|
||||||
improvements made in alternate versions of the program, if they
|
|
||||||
receive widespread use, become available for other developers to
|
|
||||||
incorporate. Many developers of free software are heartened and
|
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
|
||||||
software used on network servers, this result may fail to come about.
|
|
||||||
The GNU General Public License permits making a modified version and
|
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
|
||||||
|
|
||||||
The GNU Affero General Public License is designed specifically to
|
|
||||||
ensure that, in such cases, the modified source code becomes available
|
|
||||||
to the community. It requires the operator of a network server to
|
|
||||||
provide the source code of the modified version running there to the
|
|
||||||
users of that server. Therefore, public use of a modified version, on
|
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
|
||||||
this license.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the work with which it is combined will remain governed by version
|
|
||||||
3 of the GNU General Public License.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU Affero General Public License from time to time. Such new versions
|
|
||||||
will be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU Affero General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU Affero General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU Affero General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
|
||||||
network, you should also make sure that it provides a way for users to
|
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
|
||||||
of the code. There are many ways you could offer source, and different
|
|
||||||
solutions will be better for different programs; see section 13 for the
|
|
||||||
specific requirements.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
|
@ -1,18 +0,0 @@
|
||||||
# GoToSocial Styling
|
|
||||||
|
|
||||||
Common package for the PostCSS styling of GoToSocial (related) pages.
|
|
||||||
|
|
||||||
## Bundle
|
|
||||||
Source in `src/style.css` is bundled by running `node index.js`. Output appears in `build/bundle.css`, and can be required from other packages with `require("gotosocial-styling/build/bundle.css")`.
|
|
||||||
|
|
||||||
## Development
|
|
||||||
You can run `NODE_ENV=development node index.js` to start a livereloading setup that automatically re-bundles on file changes in `src/`.
|
|
||||||
|
|
||||||
## License, donations
|
|
||||||
[AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html). If you want to support my work, you can:
|
|
||||||
<a href="https://liberapay.com/f0x/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>
|
|
||||||
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
### v0.0.1 (August 29th, 2021)
|
|
||||||
initial release
|
|
|
@ -1,9 +0,0 @@
|
||||||
$bg: #525c66;
|
|
||||||
$fg: #fafaff;
|
|
||||||
$fg_dark: #b0b0b5;
|
|
||||||
|
|
||||||
$bg_accent: color($bg lightness(-5%));
|
|
||||||
|
|
||||||
$acc1: #de8957; // sloth light orange
|
|
||||||
$acc2: #c76d33; // sloth dark orange
|
|
||||||
$blue: #5897df;
|
|
|
@ -1,85 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const Promise = require("bluebird");
|
|
||||||
const fs = require("fs").promises;
|
|
||||||
const postcss = require('postcss');
|
|
||||||
const {parse} = require("postcss-scss");
|
|
||||||
const argv = require('minimist')(process.argv.slice(2));
|
|
||||||
|
|
||||||
/*
|
|
||||||
Bundle all postCSS files under the `templates/` directory separately, each prepended with the (variable) contents of ./colors.css
|
|
||||||
Outputs in plain CSS are in `build/`, split by template
|
|
||||||
*/
|
|
||||||
|
|
||||||
const postcssPlugins = ["postcss-strip-inline-comments", "postcss-nested", "postcss-simple-vars", "postcss-color-function"].map((plugin) => require(plugin)());
|
|
||||||
|
|
||||||
function getTemplates() {
|
|
||||||
return fs.readdir(`${__dirname}/templates`).then((templates) => {
|
|
||||||
return templates.map((a) => {
|
|
||||||
return [a, `${__dirname}/templates/${a}`];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getTemplates();
|
|
||||||
|
|
||||||
function bundle([template, path]) {
|
|
||||||
return Promise.try(() => {
|
|
||||||
return Promise.all([
|
|
||||||
fs.readFile(`${__dirname}/colors.css`, "utf-8"),
|
|
||||||
fs.readFile(path, "utf-8")
|
|
||||||
]);
|
|
||||||
}).then(([colors, style]) => {
|
|
||||||
return parse(colors + "\n" + style);
|
|
||||||
}).then((ast) => {
|
|
||||||
return postcss(postcssPlugins).process(ast, {
|
|
||||||
from: template,
|
|
||||||
to: template
|
|
||||||
});
|
|
||||||
}).then((bundle) => {
|
|
||||||
return fs.writeFile(`${buildDir}/${template}`, bundle.css);
|
|
||||||
}).then(() => {
|
|
||||||
console.log(`Finished writing CSS to ${buildDir}/${template}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let buildDir
|
|
||||||
|
|
||||||
// try reading from arguments first
|
|
||||||
if (argv["build-dir"] != undefined) {
|
|
||||||
buildDir = argv["build-dir"]
|
|
||||||
}
|
|
||||||
|
|
||||||
// then try reading from environment variable
|
|
||||||
if (buildDir == undefined) {
|
|
||||||
buildDir = process.env.BUILD_DIR;
|
|
||||||
}
|
|
||||||
|
|
||||||
// then take default
|
|
||||||
if (buildDir == undefined) {
|
|
||||||
buildDir = `${__dirname}/build`;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("bundling to", buildDir);
|
|
||||||
|
|
||||||
function bundleAll() {
|
|
||||||
return getTemplates().then((templates) => {
|
|
||||||
return Promise.map(templates, bundle);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV != "development") {
|
|
||||||
bundleAll();
|
|
||||||
} else {
|
|
||||||
const chokidar = require("chokidar");
|
|
||||||
console.log("Watching for changes");
|
|
||||||
chokidar.watch(`${__dirname}/templates`).on("all", (_, path) => {
|
|
||||||
if (path.endsWith(".css")) {
|
|
||||||
bundle([path.split("/").slice(-1)[0], path]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
chokidar.watch(`${__dirname}/colors.css`).on("all", () => {
|
|
||||||
console.log("colors.css updated, rebuilding all templates");
|
|
||||||
bundleAll();
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"name": "gotosocial-styling",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"description": "PostCSS source for the https://github.com/superseriousbusiness/gotosocial common styling",
|
|
||||||
"repository": "https://github.com/superseriousbusiness/gotosocial-styling",
|
|
||||||
"author": "f0x",
|
|
||||||
"license": "AGPL-3.0",
|
|
||||||
"dependencies": {
|
|
||||||
"bluebird": "^3.7.2",
|
|
||||||
"minimist": "^1.2.5",
|
|
||||||
"postcss": "^8.3.5",
|
|
||||||
"postcss-color-function": "^4.1.0",
|
|
||||||
"postcss-nested": "^4.2.1",
|
|
||||||
"postcss-scss": "^4.0.0",
|
|
||||||
"postcss-simple-vars": "^5.0.2",
|
|
||||||
"postcss-strip-inline-comments": "^0.1.5"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"chokidar": "^3.5.2"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,409 +0,0 @@
|
||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
# yarn lockfile v1
|
|
||||||
|
|
||||||
|
|
||||||
ansi-regex@^2.0.0:
|
|
||||||
version "2.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
|
|
||||||
integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8=
|
|
||||||
|
|
||||||
ansi-styles@^2.2.1:
|
|
||||||
version "2.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
|
|
||||||
integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=
|
|
||||||
|
|
||||||
ansi-styles@^3.2.1:
|
|
||||||
version "3.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
|
|
||||||
integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
|
|
||||||
dependencies:
|
|
||||||
color-convert "^1.9.0"
|
|
||||||
|
|
||||||
anymatch@~3.1.2:
|
|
||||||
version "3.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716"
|
|
||||||
integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==
|
|
||||||
dependencies:
|
|
||||||
normalize-path "^3.0.0"
|
|
||||||
picomatch "^2.0.4"
|
|
||||||
|
|
||||||
balanced-match@0.1.0:
|
|
||||||
version "0.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.1.0.tgz#b504bd05869b39259dd0c5efc35d843176dccc4a"
|
|
||||||
integrity sha1-tQS9BYabOSWd0MXvw12EMXbczEo=
|
|
||||||
|
|
||||||
binary-extensions@^2.0.0:
|
|
||||||
version "2.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d"
|
|
||||||
integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==
|
|
||||||
|
|
||||||
bluebird@^3.7.2:
|
|
||||||
version "3.7.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
|
|
||||||
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
|
|
||||||
|
|
||||||
braces@~3.0.2:
|
|
||||||
version "3.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
|
|
||||||
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
|
|
||||||
dependencies:
|
|
||||||
fill-range "^7.0.1"
|
|
||||||
|
|
||||||
chalk@^1.1.3:
|
|
||||||
version "1.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
|
|
||||||
integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=
|
|
||||||
dependencies:
|
|
||||||
ansi-styles "^2.2.1"
|
|
||||||
escape-string-regexp "^1.0.2"
|
|
||||||
has-ansi "^2.0.0"
|
|
||||||
strip-ansi "^3.0.0"
|
|
||||||
supports-color "^2.0.0"
|
|
||||||
|
|
||||||
chalk@^2.4.1, chalk@^2.4.2:
|
|
||||||
version "2.4.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
|
|
||||||
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
|
|
||||||
dependencies:
|
|
||||||
ansi-styles "^3.2.1"
|
|
||||||
escape-string-regexp "^1.0.5"
|
|
||||||
supports-color "^5.3.0"
|
|
||||||
|
|
||||||
chokidar@^3.5.2:
|
|
||||||
version "3.5.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75"
|
|
||||||
integrity sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==
|
|
||||||
dependencies:
|
|
||||||
anymatch "~3.1.2"
|
|
||||||
braces "~3.0.2"
|
|
||||||
glob-parent "~5.1.2"
|
|
||||||
is-binary-path "~2.1.0"
|
|
||||||
is-glob "~4.0.1"
|
|
||||||
normalize-path "~3.0.0"
|
|
||||||
readdirp "~3.6.0"
|
|
||||||
optionalDependencies:
|
|
||||||
fsevents "~2.3.2"
|
|
||||||
|
|
||||||
clone@^1.0.2:
|
|
||||||
version "1.0.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e"
|
|
||||||
integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4=
|
|
||||||
|
|
||||||
color-convert@^1.3.0, color-convert@^1.9.0:
|
|
||||||
version "1.9.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
|
|
||||||
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
|
|
||||||
dependencies:
|
|
||||||
color-name "1.1.3"
|
|
||||||
|
|
||||||
color-name@1.1.3:
|
|
||||||
version "1.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
|
||||||
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
|
|
||||||
|
|
||||||
color-name@^1.0.0:
|
|
||||||
version "1.1.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
|
||||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
|
||||||
|
|
||||||
color-string@^0.3.0:
|
|
||||||
version "0.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/color-string/-/color-string-0.3.0.tgz#27d46fb67025c5c2fa25993bfbf579e47841b991"
|
|
||||||
integrity sha1-J9RvtnAlxcL6JZk7+/V55HhBuZE=
|
|
||||||
dependencies:
|
|
||||||
color-name "^1.0.0"
|
|
||||||
|
|
||||||
color@^0.11.0:
|
|
||||||
version "0.11.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/color/-/color-0.11.4.tgz#6d7b5c74fb65e841cd48792ad1ed5e07b904d764"
|
|
||||||
integrity sha1-bXtcdPtl6EHNSHkq0e1eB7kE12Q=
|
|
||||||
dependencies:
|
|
||||||
clone "^1.0.2"
|
|
||||||
color-convert "^1.3.0"
|
|
||||||
color-string "^0.3.0"
|
|
||||||
|
|
||||||
colorette@^1.2.2:
|
|
||||||
version "1.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.4.0.tgz#5190fbb87276259a86ad700bff2c6d6faa3fca40"
|
|
||||||
integrity sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==
|
|
||||||
|
|
||||||
css-color-function@~1.3.3:
|
|
||||||
version "1.3.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/css-color-function/-/css-color-function-1.3.3.tgz#8ed24c2c0205073339fafa004bc8c141fccb282e"
|
|
||||||
integrity sha1-jtJMLAIFBzM5+voAS8jBQfzLKC4=
|
|
||||||
dependencies:
|
|
||||||
balanced-match "0.1.0"
|
|
||||||
color "^0.11.0"
|
|
||||||
debug "^3.1.0"
|
|
||||||
rgb "~0.1.0"
|
|
||||||
|
|
||||||
cssesc@^3.0.0:
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee"
|
|
||||||
integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==
|
|
||||||
|
|
||||||
debug@^3.1.0:
|
|
||||||
version "3.2.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a"
|
|
||||||
integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==
|
|
||||||
dependencies:
|
|
||||||
ms "^2.1.1"
|
|
||||||
|
|
||||||
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
|
|
||||||
version "1.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
|
||||||
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
|
|
||||||
|
|
||||||
fill-range@^7.0.1:
|
|
||||||
version "7.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
|
|
||||||
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
|
|
||||||
dependencies:
|
|
||||||
to-regex-range "^5.0.1"
|
|
||||||
|
|
||||||
fsevents@~2.3.2:
|
|
||||||
version "2.3.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
|
|
||||||
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
|
|
||||||
|
|
||||||
glob-parent@~5.1.2:
|
|
||||||
version "5.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
|
||||||
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
|
|
||||||
dependencies:
|
|
||||||
is-glob "^4.0.1"
|
|
||||||
|
|
||||||
has-ansi@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
|
|
||||||
integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=
|
|
||||||
dependencies:
|
|
||||||
ansi-regex "^2.0.0"
|
|
||||||
|
|
||||||
has-flag@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa"
|
|
||||||
integrity sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=
|
|
||||||
|
|
||||||
has-flag@^3.0.0:
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
|
|
||||||
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
|
|
||||||
|
|
||||||
is-binary-path@~2.1.0:
|
|
||||||
version "2.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09"
|
|
||||||
integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==
|
|
||||||
dependencies:
|
|
||||||
binary-extensions "^2.0.0"
|
|
||||||
|
|
||||||
is-extglob@^2.1.1:
|
|
||||||
version "2.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
|
|
||||||
integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=
|
|
||||||
|
|
||||||
is-glob@^4.0.1, is-glob@~4.0.1:
|
|
||||||
version "4.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc"
|
|
||||||
integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==
|
|
||||||
dependencies:
|
|
||||||
is-extglob "^2.1.1"
|
|
||||||
|
|
||||||
is-number@^7.0.0:
|
|
||||||
version "7.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
|
|
||||||
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
|
|
||||||
|
|
||||||
js-base64@^2.1.9:
|
|
||||||
version "2.6.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4"
|
|
||||||
integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==
|
|
||||||
|
|
||||||
minimist@^1.2.5:
|
|
||||||
version "1.2.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
|
|
||||||
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
|
|
||||||
|
|
||||||
ms@^2.1.1:
|
|
||||||
version "2.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
|
|
||||||
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
|
|
||||||
|
|
||||||
nanoid@^3.1.23:
|
|
||||||
version "3.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.2.0.tgz#62667522da6673971cca916a6d3eff3f415ff80c"
|
|
||||||
integrity sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==
|
|
||||||
|
|
||||||
normalize-path@^3.0.0, normalize-path@~3.0.0:
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
|
|
||||||
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
|
|
||||||
|
|
||||||
picomatch@^2.0.4, picomatch@^2.2.1:
|
|
||||||
version "2.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972"
|
|
||||||
integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==
|
|
||||||
|
|
||||||
postcss-color-function@^4.1.0:
|
|
||||||
version "4.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss-color-function/-/postcss-color-function-4.1.0.tgz#b6f9355e07b12fcc5c34dab957834769b03d8f57"
|
|
||||||
integrity sha512-2/fuv6mP5Lt03XbRpVfMdGC8lRP1sykme+H1bR4ARyOmSMB8LPSjcL6EAI1iX6dqUF+jNEvKIVVXhan1w/oFDQ==
|
|
||||||
dependencies:
|
|
||||||
css-color-function "~1.3.3"
|
|
||||||
postcss "^6.0.23"
|
|
||||||
postcss-message-helpers "^2.0.0"
|
|
||||||
postcss-value-parser "^3.3.1"
|
|
||||||
|
|
||||||
postcss-message-helpers@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss-message-helpers/-/postcss-message-helpers-2.0.0.tgz#a4f2f4fab6e4fe002f0aed000478cdf52f9ba60e"
|
|
||||||
integrity sha1-pPL0+rbk/gAvCu0ABHjN9S+bpg4=
|
|
||||||
|
|
||||||
postcss-nested@^4.2.1:
|
|
||||||
version "4.2.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-4.2.3.tgz#c6f255b0a720549776d220d00c4b70cd244136f6"
|
|
||||||
integrity sha512-rOv0W1HquRCamWy2kFl3QazJMMe1ku6rCFoAAH+9AcxdbpDeBr6k968MLWuLjvjMcGEip01ak09hKOEgpK9hvw==
|
|
||||||
dependencies:
|
|
||||||
postcss "^7.0.32"
|
|
||||||
postcss-selector-parser "^6.0.2"
|
|
||||||
|
|
||||||
postcss-scss@^4.0.0:
|
|
||||||
version "4.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss-scss/-/postcss-scss-4.0.0.tgz#6cfe09040f01e3345c9c226894c5913ac5fa9381"
|
|
||||||
integrity sha512-xakgIr5ukOEyXFcsnADKjQtrk8nQyqn5VIEAA+PmPP4kBOpknmjpJMxBNqCR1/x20AS0aSfZkWsSdbMx2Ozm5A==
|
|
||||||
|
|
||||||
postcss-selector-parser@^6.0.2:
|
|
||||||
version "6.0.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz#2c5bba8174ac2f6981ab631a42ab0ee54af332ea"
|
|
||||||
integrity sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg==
|
|
||||||
dependencies:
|
|
||||||
cssesc "^3.0.0"
|
|
||||||
util-deprecate "^1.0.2"
|
|
||||||
|
|
||||||
postcss-simple-vars@^5.0.2:
|
|
||||||
version "5.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss-simple-vars/-/postcss-simple-vars-5.0.2.tgz#e2f81b3d0847ddd4169816b6d141b91d51e6e22e"
|
|
||||||
integrity sha512-xWIufxBoINJv6JiLb7jl5oElgp+6puJwvT5zZHliUSydoLz4DADRB3NDDsYgfKVwojn4TDLiseoC65MuS8oGGg==
|
|
||||||
dependencies:
|
|
||||||
postcss "^7.0.14"
|
|
||||||
|
|
||||||
postcss-strip-inline-comments@^0.1.5:
|
|
||||||
version "0.1.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss-strip-inline-comments/-/postcss-strip-inline-comments-0.1.5.tgz#7ff6bcdc14e633ed4cdfa020bae3eddad4f84b90"
|
|
||||||
integrity sha1-f/a83BTmM+1M36AguuPt2tT4S5A=
|
|
||||||
dependencies:
|
|
||||||
postcss "^5.0.18"
|
|
||||||
|
|
||||||
postcss-value-parser@^3.3.1:
|
|
||||||
version "3.3.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281"
|
|
||||||
integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==
|
|
||||||
|
|
||||||
postcss@^5.0.18:
|
|
||||||
version "5.2.18"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.18.tgz#badfa1497d46244f6390f58b319830d9107853c5"
|
|
||||||
integrity sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg==
|
|
||||||
dependencies:
|
|
||||||
chalk "^1.1.3"
|
|
||||||
js-base64 "^2.1.9"
|
|
||||||
source-map "^0.5.6"
|
|
||||||
supports-color "^3.2.3"
|
|
||||||
|
|
||||||
postcss@^6.0.23:
|
|
||||||
version "6.0.23"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.23.tgz#61c82cc328ac60e677645f979054eb98bc0e3324"
|
|
||||||
integrity sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==
|
|
||||||
dependencies:
|
|
||||||
chalk "^2.4.1"
|
|
||||||
source-map "^0.6.1"
|
|
||||||
supports-color "^5.4.0"
|
|
||||||
|
|
||||||
postcss@^7.0.14, postcss@^7.0.32:
|
|
||||||
version "7.0.36"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.36.tgz#056f8cffa939662a8f5905950c07d5285644dfcb"
|
|
||||||
integrity sha512-BebJSIUMwJHRH0HAQoxN4u1CN86glsrwsW0q7T+/m44eXOUAxSNdHRkNZPYz5vVUbg17hFgOQDE7fZk7li3pZw==
|
|
||||||
dependencies:
|
|
||||||
chalk "^2.4.2"
|
|
||||||
source-map "^0.6.1"
|
|
||||||
supports-color "^6.1.0"
|
|
||||||
|
|
||||||
postcss@^8.3.5:
|
|
||||||
version "8.3.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.3.6.tgz#2730dd76a97969f37f53b9a6096197be311cc4ea"
|
|
||||||
integrity sha512-wG1cc/JhRgdqB6WHEuyLTedf3KIRuD0hG6ldkFEZNCjRxiC+3i6kkWUUbiJQayP28iwG35cEmAbe98585BYV0A==
|
|
||||||
dependencies:
|
|
||||||
colorette "^1.2.2"
|
|
||||||
nanoid "^3.1.23"
|
|
||||||
source-map-js "^0.6.2"
|
|
||||||
|
|
||||||
readdirp@~3.6.0:
|
|
||||||
version "3.6.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7"
|
|
||||||
integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==
|
|
||||||
dependencies:
|
|
||||||
picomatch "^2.2.1"
|
|
||||||
|
|
||||||
rgb@~0.1.0:
|
|
||||||
version "0.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/rgb/-/rgb-0.1.0.tgz#be27b291e8feffeac1bd99729721bfa40fc037b5"
|
|
||||||
integrity sha1-vieykej+/+rBvZlylyG/pA/AN7U=
|
|
||||||
|
|
||||||
source-map-js@^0.6.2:
|
|
||||||
version "0.6.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-0.6.2.tgz#0bb5de631b41cfbda6cfba8bd05a80efdfd2385e"
|
|
||||||
integrity sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==
|
|
||||||
|
|
||||||
source-map@^0.5.6:
|
|
||||||
version "0.5.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
|
|
||||||
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
|
|
||||||
|
|
||||||
source-map@^0.6.1:
|
|
||||||
version "0.6.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
|
||||||
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
|
||||||
|
|
||||||
strip-ansi@^3.0.0:
|
|
||||||
version "3.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
|
|
||||||
integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=
|
|
||||||
dependencies:
|
|
||||||
ansi-regex "^2.0.0"
|
|
||||||
|
|
||||||
supports-color@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
|
|
||||||
integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=
|
|
||||||
|
|
||||||
supports-color@^3.2.3:
|
|
||||||
version "3.2.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6"
|
|
||||||
integrity sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=
|
|
||||||
dependencies:
|
|
||||||
has-flag "^1.0.0"
|
|
||||||
|
|
||||||
supports-color@^5.3.0, supports-color@^5.4.0:
|
|
||||||
version "5.5.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
|
|
||||||
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
|
|
||||||
dependencies:
|
|
||||||
has-flag "^3.0.0"
|
|
||||||
|
|
||||||
supports-color@^6.1.0:
|
|
||||||
version "6.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3"
|
|
||||||
integrity sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==
|
|
||||||
dependencies:
|
|
||||||
has-flag "^3.0.0"
|
|
||||||
|
|
||||||
to-regex-range@^5.0.1:
|
|
||||||
version "5.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
|
|
||||||
integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
|
|
||||||
dependencies:
|
|
||||||
is-number "^7.0.0"
|
|
||||||
|
|
||||||
util-deprecate@^1.0.2:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
|
||||||
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
|
|
3
web/source/.eslintrc.js
Normal file
3
web/source/.eslintrc.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = {
|
||||||
|
"extends": ["@f0x52/eslint-config-react"]
|
||||||
|
};
|
2
web/source/.gitignore
vendored
Normal file
2
web/source/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
node_modules
|
||||||
|
public/bundle.*
|
35
web/source/css/_colors.css
Normal file
35
web/source/css/_colors.css
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
This stylesheets defines (color) variables to be used by other stylesheets on the page
|
||||||
|
postcss-custom-prop-vars will transpile these to css --variables
|
||||||
|
*/
|
||||||
|
|
||||||
|
$bg: #525c66;
|
||||||
|
$fg: #fafaff;
|
||||||
|
$fg_dark: #b0b0b5;
|
||||||
|
|
||||||
|
$bg_darker3: color-mod($bg lightness(-3%));
|
||||||
|
$bg_darker5: color-mod($bg lightness(-5%));
|
||||||
|
|
||||||
|
$bg_lighter3: color-mod($bg lightness(+3%));
|
||||||
|
|
||||||
|
$acc1: #de8957; // sloth light orange
|
||||||
|
$acc2: #c76d33; // sloth dark orange
|
||||||
|
$blue: #5897df;
|
|
@ -1,17 +1,42 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background: $bg_accent;
|
background: $bg_darker5;
|
||||||
color: $fg;
|
color: $fg;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
line-height: 1.5em;
|
||||||
|
min-height: 100vh;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page {
|
||||||
|
position: absolute;
|
||||||
display: grid;
|
display: grid;
|
||||||
|
min-height: 100%;
|
||||||
|
min-width: 100%;
|
||||||
|
|
||||||
grid-template-rows: auto 1fr auto;
|
grid-template-rows: auto 1fr auto;
|
||||||
min-height: 100vh;
|
|
||||||
line-height: 1.5em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
@ -41,7 +66,7 @@ main {
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
background: $bg_accent;
|
background: $bg_darker5;
|
||||||
padding: 2rem 0;
|
padding: 2rem 0;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -95,7 +120,7 @@ a {
|
||||||
}
|
}
|
||||||
|
|
||||||
.count {
|
.count {
|
||||||
background: $bg_accent;
|
background: $bg_darker5;
|
||||||
border-radius: 0.3rem;
|
border-radius: 0.3rem;
|
||||||
padding: 0.2rem;
|
padding: 0.2rem;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +154,7 @@ section.apps {
|
||||||
grid-template-columns: 30% 1fr;
|
grid-template-columns: 30% 1fr;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
background: $bg_accent;
|
background: $bg_darker5;
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
|
|
||||||
.logo {
|
.logo {
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
main {
|
main {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +31,7 @@ main {
|
||||||
|
|
||||||
.profile {
|
.profile {
|
||||||
position: relative;
|
position: relative;
|
||||||
background: color($bg lightness(-3%));
|
background: $bg_darker3;
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
@ -91,7 +109,7 @@ main {
|
||||||
|
|
||||||
.accountstats {
|
.accountstats {
|
||||||
position: relative;
|
position: relative;
|
||||||
background: color($bg lightness(-3%));
|
background: $bg_darker3;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
@ -100,7 +118,7 @@ main {
|
||||||
margin-bottom: 0.2rem;
|
margin-bottom: 0.2rem;
|
||||||
|
|
||||||
.entry {
|
.entry {
|
||||||
background: color($bg lightness(+3%));
|
background: $bg_lighter3;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
text-align: center;
|
text-align: center;
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
main {
|
main {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
grid-auto-rows: auto;
|
grid-auto-rows: auto;
|
||||||
|
@ -10,7 +28,7 @@ main {
|
||||||
|
|
||||||
.toot {
|
.toot {
|
||||||
position: relative;
|
position: relative;
|
||||||
background: color($bg lightness(-3%));
|
background: $bg_darker3;
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
/* padding-bottom: 0; */
|
/* padding-bottom: 0; */
|
||||||
display: grid;
|
display: grid;
|
73
web/source/dev-server.js
Normal file
73
web/source/dev-server.js
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const express = require("express");
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
function html(title, css, js) {
|
||||||
|
return `
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
${["_colors.css", "base.css", ...css].map((file) => {
|
||||||
|
return `<link rel="stylesheet" href="/${file}"></link>`;
|
||||||
|
}).join("\n")}
|
||||||
|
<title>GoToSocial ${title} Panel</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<img src="/assets/logo.png" alt="Instance Logo">
|
||||||
|
<div>
|
||||||
|
<h1>
|
||||||
|
GoToSocial ${title} Panel
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<main class="lightgray">
|
||||||
|
<div id="root"></div>
|
||||||
|
</main>
|
||||||
|
${["bundle.js", ...js].map((file) => {
|
||||||
|
return `<script src="/${file}"></script>`;
|
||||||
|
}).join("\n")}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
app.get("/admin", (req, res) => {
|
||||||
|
res.send(html("Admin", ["panels-admin-style.css"], ["admin-panel.js"]));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/user", (req, res) => {
|
||||||
|
res.send(html("Settings", ["panels-user-style.css"], ["user-panel.js"]));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.use("/assets", express.static("../assets/"));
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV != "development") {
|
||||||
|
console.log("adding static asset route");
|
||||||
|
app.use(express.static("../assets/dist"));
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = app;
|
41
web/source/frontend/index.js
Normal file
41
web/source/frontend/index.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
|
||||||
|
// WARNING: currently dependencies get deduplicated with factor-bundle, but
|
||||||
|
// our frontend templates don't load the common bundle.js since it contains React etc
|
||||||
|
// so we can't use any dependencies that would deduplicate with the other files
|
||||||
|
|
||||||
|
Array.from(document.getElementsByClassName("spoiler-label")).forEach((label) => {
|
||||||
|
let checkbox = document.getElementById(label.htmlFor);
|
||||||
|
console.log(label, checkbox);
|
||||||
|
if (checkbox != undefined) {
|
||||||
|
function update() {
|
||||||
|
if(checkbox.checked) {
|
||||||
|
label.innerHTML = "Show more";
|
||||||
|
} else {
|
||||||
|
label.innerHTML = "Show less";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
|
||||||
|
label.addEventListener("click", () => {setTimeout(update, 1);});
|
||||||
|
}
|
||||||
|
});
|
108
web/source/index.js
Normal file
108
web/source/index.js
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Bundle the frontend panels for admin and user settings
|
||||||
|
*/
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const budoExpress = require('@f0x52/budo-express');
|
||||||
|
const babelify = require('babelify');
|
||||||
|
const fs = require("fs");
|
||||||
|
const EventEmitter = require('events');
|
||||||
|
|
||||||
|
function out(name = "") {
|
||||||
|
return path.join(__dirname, "../assets/dist/", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {out};
|
||||||
|
|
||||||
|
const splitCSS = require("./lib/split-css.js");
|
||||||
|
|
||||||
|
const bundles = {
|
||||||
|
"./frontend/index.js": "frontend.js",
|
||||||
|
"./panels/admin/index.js": "admin-panel.js",
|
||||||
|
"./panels/user/index.js": "user-panel.js",
|
||||||
|
};
|
||||||
|
|
||||||
|
const postcssPlugins = [
|
||||||
|
"postcss-import",
|
||||||
|
"postcss-strip-inline-comments",
|
||||||
|
"postcss-nested",
|
||||||
|
"autoprefixer",
|
||||||
|
"postcss-custom-prop-vars",
|
||||||
|
"postcss-color-mod-function"
|
||||||
|
].map((plugin) => require(plugin)());
|
||||||
|
|
||||||
|
const browserifyConfig = {
|
||||||
|
transform: [
|
||||||
|
babelify.configure({
|
||||||
|
presets: [
|
||||||
|
require.resolve("@babel/preset-env"),
|
||||||
|
require.resolve("@babel/preset-react")
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
[require("uglifyify"), {
|
||||||
|
global: true,
|
||||||
|
exts: ".js"
|
||||||
|
}]
|
||||||
|
],
|
||||||
|
plugin: [
|
||||||
|
[require("icssify"), {
|
||||||
|
parser: require('postcss-scss'),
|
||||||
|
before: postcssPlugins,
|
||||||
|
mode: 'global'
|
||||||
|
}],
|
||||||
|
[require("css-extract"), { out: splitCSS }],
|
||||||
|
[require("factor-bundle"), {
|
||||||
|
outputs: Object.values(bundles).map((file) => {
|
||||||
|
return out(file);
|
||||||
|
})
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const entryFiles = Object.keys(bundles);
|
||||||
|
|
||||||
|
fs.readdirSync(path.join(__dirname, "./css")).forEach((file) => {
|
||||||
|
entryFiles.push(path.join(__dirname, "./css", file));
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!fs.existsSync(out())){
|
||||||
|
fs.mkdirSync(out(), { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
const server = budoExpress({
|
||||||
|
port: 8081,
|
||||||
|
host: "localhost",
|
||||||
|
entryFiles: entryFiles,
|
||||||
|
basePath: __dirname,
|
||||||
|
bundlePath: "bundle.js",
|
||||||
|
staticPath: out(),
|
||||||
|
expressApp: require("./dev-server.js"),
|
||||||
|
browserify: browserifyConfig,
|
||||||
|
livereloadPattern: "**/*.{html,js,svg}"
|
||||||
|
});
|
||||||
|
|
||||||
|
if (server instanceof EventEmitter) {
|
||||||
|
server.on("update", (contents) => {
|
||||||
|
fs.writeFileSync(out("bundle.js"), contents);
|
||||||
|
});
|
||||||
|
}
|
220
web/source/lib/oauth.js
Normal file
220
web/source/lib/oauth.js
Normal file
|
@ -0,0 +1,220 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const Promise = require("bluebird");
|
||||||
|
|
||||||
|
function getCurrentUrl() {
|
||||||
|
return window.location.origin + window.location.pathname; // strips ?query=string and #hash
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = function oauthClient(config, initState) {
|
||||||
|
/* config:
|
||||||
|
instance: instance domain (https://testingtesting123.xyz)
|
||||||
|
client_name: "GoToSocial Admin Panel"
|
||||||
|
scope: []
|
||||||
|
website:
|
||||||
|
*/
|
||||||
|
|
||||||
|
let state = initState;
|
||||||
|
if (initState == undefined) {
|
||||||
|
state = localStorage.getItem("oauth");
|
||||||
|
if (state == undefined) {
|
||||||
|
state = {
|
||||||
|
config
|
||||||
|
};
|
||||||
|
storeState();
|
||||||
|
} else {
|
||||||
|
state = JSON.parse(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function storeState() {
|
||||||
|
localStorage.setItem("oauth", JSON.stringify(state));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* register app
|
||||||
|
/api/v1/apps
|
||||||
|
*/
|
||||||
|
function register() {
|
||||||
|
if (state.client_id != undefined) {
|
||||||
|
return true; // we already have a registration
|
||||||
|
}
|
||||||
|
let url = new URL(config.instance);
|
||||||
|
url.pathname = "/api/v1/apps";
|
||||||
|
|
||||||
|
return fetch(url.href, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
client_name: config.client_name,
|
||||||
|
redirect_uris: getCurrentUrl(),
|
||||||
|
scopes: config.scope.join(" "),
|
||||||
|
website: getCurrentUrl()
|
||||||
|
})
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.status != 200) {
|
||||||
|
throw res;
|
||||||
|
}
|
||||||
|
return res.json();
|
||||||
|
}).then((json) => {
|
||||||
|
state.client_id = json.client_id;
|
||||||
|
state.client_secret = json.client_secret;
|
||||||
|
storeState();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* authorize:
|
||||||
|
/oauth/authorize
|
||||||
|
?client_id=CLIENT_ID
|
||||||
|
&redirect_uri=window.location.href
|
||||||
|
&response_type=code
|
||||||
|
&scope=admin
|
||||||
|
*/
|
||||||
|
function authorize() {
|
||||||
|
let url = new URL(config.instance);
|
||||||
|
url.pathname = "/oauth/authorize";
|
||||||
|
url.searchParams.set("client_id", state.client_id);
|
||||||
|
url.searchParams.set("redirect_uri", getCurrentUrl());
|
||||||
|
url.searchParams.set("response_type", "code");
|
||||||
|
url.searchParams.set("scope", config.scope.join(" "));
|
||||||
|
|
||||||
|
window.location.assign(url.href);
|
||||||
|
}
|
||||||
|
|
||||||
|
function callback() {
|
||||||
|
if (state.access_token != undefined) {
|
||||||
|
return; // we're already done :)
|
||||||
|
}
|
||||||
|
let params = (new URL(window.location)).searchParams;
|
||||||
|
|
||||||
|
let token = params.get("code");
|
||||||
|
if (token != null) {
|
||||||
|
console.log("got token callback:", token);
|
||||||
|
}
|
||||||
|
|
||||||
|
return authorizeToken(token)
|
||||||
|
.catch((e) => {
|
||||||
|
console.log("Error processing oauth callback:", e);
|
||||||
|
logout(); // just to be sure
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function authorizeToken(token) {
|
||||||
|
let url = new URL(config.instance);
|
||||||
|
url.pathname = "/oauth/token";
|
||||||
|
return fetch(url.href, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
client_id: state.client_id,
|
||||||
|
client_secret: state.client_secret,
|
||||||
|
redirect_uri: getCurrentUrl(),
|
||||||
|
grant_type: "authorization_code",
|
||||||
|
code: token
|
||||||
|
})
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.status != 200) {
|
||||||
|
throw res;
|
||||||
|
}
|
||||||
|
return res.json();
|
||||||
|
}).then((json) => {
|
||||||
|
state.access_token = json.access_token;
|
||||||
|
storeState();
|
||||||
|
window.location = getCurrentUrl(); // clear ?token=
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function isAuthorized() {
|
||||||
|
return (state.access_token != undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
function apiRequest(path, method, data, type="json") {
|
||||||
|
if (!isAuthorized()) {
|
||||||
|
throw new Error("Not Authenticated");
|
||||||
|
}
|
||||||
|
let url = new URL(config.instance);
|
||||||
|
let [p, s] = path.split("?");
|
||||||
|
url.pathname = p;
|
||||||
|
if (s != undefined) {
|
||||||
|
url.search = s;
|
||||||
|
}
|
||||||
|
let headers = {
|
||||||
|
"Authorization": `Bearer ${state.access_token}`
|
||||||
|
};
|
||||||
|
let body = data;
|
||||||
|
if (type == "json" && body != undefined) {
|
||||||
|
headers["Content-Type"] = "application/json";
|
||||||
|
body = JSON.stringify(data);
|
||||||
|
}
|
||||||
|
return fetch(url.href, {
|
||||||
|
method,
|
||||||
|
headers,
|
||||||
|
body
|
||||||
|
}).then((res) => {
|
||||||
|
return Promise.all([res.json(), res]);
|
||||||
|
}).then(([json, res]) => {
|
||||||
|
if (res.status != 200) {
|
||||||
|
if (json.error) {
|
||||||
|
throw new Error(json.error);
|
||||||
|
} else {
|
||||||
|
throw new Error(`${res.status}: ${res.statusText}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function logout() {
|
||||||
|
let url = new URL(config.instance);
|
||||||
|
url.pathname = "/oauth/revoke";
|
||||||
|
return fetch(url.href, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
client_id: state.client_id,
|
||||||
|
client_secret: state.client_secret,
|
||||||
|
token: state.access_token,
|
||||||
|
})
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.status != 200) {
|
||||||
|
// GoToSocial doesn't actually implement this route yet,
|
||||||
|
// so error is to be expected
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return res.json();
|
||||||
|
}).catch(() => {
|
||||||
|
// see above
|
||||||
|
}).then(() => {
|
||||||
|
localStorage.removeItem("oauth");
|
||||||
|
window.location = getCurrentUrl();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
register, authorize, callback, isAuthorized, apiRequest, logout
|
||||||
|
};
|
||||||
|
};
|
76
web/source/lib/split-css.js
Normal file
76
web/source/lib/split-css.js
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
const {Writable} = require("stream");
|
||||||
|
const {out} = require("../index.js");
|
||||||
|
|
||||||
|
const fromRegex = /\/\* from (.+?) \*\//;
|
||||||
|
module.exports = function splitCSS() {
|
||||||
|
let chunks = [];
|
||||||
|
return new Writable({
|
||||||
|
write: function(chunk, encoding, next) {
|
||||||
|
chunks.push(chunk);
|
||||||
|
next();
|
||||||
|
},
|
||||||
|
final: function() {
|
||||||
|
let stream = chunks.join("");
|
||||||
|
let input;
|
||||||
|
let content = [];
|
||||||
|
|
||||||
|
function write() {
|
||||||
|
if (content.length != 0) {
|
||||||
|
if (input == undefined) {
|
||||||
|
throw new Error("Got CSS content without filename, can't output: ", content);
|
||||||
|
} else {
|
||||||
|
console.log("writing to", out(input));
|
||||||
|
fs.writeFileSync(out(input), content.join("\n"));
|
||||||
|
}
|
||||||
|
content = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const cssDir = path.join(__dirname, "../css");
|
||||||
|
|
||||||
|
stream.split("\n").forEach((line) => {
|
||||||
|
if (line.startsWith("/* from")) {
|
||||||
|
let found = fromRegex.exec(line);
|
||||||
|
if (found != null) {
|
||||||
|
write();
|
||||||
|
|
||||||
|
let parts = path.parse(found[1]);
|
||||||
|
if (path.relative(cssDir, path.join(process.cwd(), parts.dir)) == "") {
|
||||||
|
input = parts.base;
|
||||||
|
} else {
|
||||||
|
// prefix filename with path
|
||||||
|
let relative = path.relative(path.join(__dirname, "../"), path.join(process.cwd(), found[1]));
|
||||||
|
input = relative.replace(/\//g, "-");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
content.push(line);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
write();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
47
web/source/package.json
Normal file
47
web/source/package.json
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
"name": "gotosocial-frontend",
|
||||||
|
"version": "0.3.4",
|
||||||
|
"description": "GoToSocial frontend sources",
|
||||||
|
"main": "index.js",
|
||||||
|
"author": "f0x",
|
||||||
|
"license": "AGPL-3.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/core": "^7.12.13",
|
||||||
|
"@babel/preset-env": "^7.12.13",
|
||||||
|
"@babel/preset-react": "^7.12.13",
|
||||||
|
"@f0x52/budo-express": "^1.1.0",
|
||||||
|
"autoprefixer": "^9.8.0",
|
||||||
|
"babelify": "^10.0.0",
|
||||||
|
"bluebird": "^3.7.2",
|
||||||
|
"browserify": "^17.0.0",
|
||||||
|
"browserlist": "^1.0.1",
|
||||||
|
"css-extract": "^2.0.0",
|
||||||
|
"eslint-plugin-react": "^7.24.0",
|
||||||
|
"express": "^4.18.1",
|
||||||
|
"factor-bundle": "^2.5.0",
|
||||||
|
"from2-string": "^1.1.0",
|
||||||
|
"icssify": "^1.2.1",
|
||||||
|
"js-file-download": "^0.4.12",
|
||||||
|
"postcss": "^8.3.5",
|
||||||
|
"postcss-color-function": "^4.1.0",
|
||||||
|
"postcss-color-mod-function": "3.0.0",
|
||||||
|
"postcss-comment": "^2.0.0",
|
||||||
|
"postcss-custom-prop-vars": "0.0.3",
|
||||||
|
"postcss-import": "12",
|
||||||
|
"postcss-mixins": "^6.2.3",
|
||||||
|
"postcss-nested": "^4.2.1",
|
||||||
|
"postcss-scss": "^4.0.0",
|
||||||
|
"postcss-simple-vars": "^5.0.2",
|
||||||
|
"postcss-strip-inline-comments": "^0.1.5",
|
||||||
|
"pretty-bytes": "^5.6.0",
|
||||||
|
"react": "^17.0.1",
|
||||||
|
"react-dom": "^17.0.1",
|
||||||
|
"reactify": "^1.1.1",
|
||||||
|
"uglifyify": "^5.0.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@f0x52/eslint-config-react": "^1.1.0",
|
||||||
|
"eslint": "^7.30.0",
|
||||||
|
"eslint-plugin-react-hooks": "^4.2.0"
|
||||||
|
}
|
||||||
|
}
|
21
web/source/panels/admin/README.md
Normal file
21
web/source/panels/admin/README.md
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# GoToSocial Admin Panel
|
||||||
|
|
||||||
|
Standalone web admin panel for [GoToSocial](https://github.com/superseriousbusiness/gotosocial).
|
||||||
|
|
||||||
|
A public hosted instance is also available at https://gts.superseriousbusiness.org/admin/, so you can fill your own instance URL in there.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
Build requirements: some version of Node.js with npm,
|
||||||
|
```
|
||||||
|
git clone https://github.com/superseriousbusiness/gotosocial-admin.git && cd gotosocial-admin
|
||||||
|
npm install
|
||||||
|
node index.js
|
||||||
|
```
|
||||||
|
All processed build output will now be in `public/`, which you can copy over to a folder in your GoToSocial installation like `web/assets/admin`, or serve elsewhere.
|
||||||
|
No further configuration is required, authentication happens through normal OAUTH flow.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
Follow the installation steps, but run `NODE_ENV=development node index.js` to start the livereloading dev server instead.
|
||||||
|
|
||||||
|
## License, donations
|
||||||
|
[AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html). If you want to support my work, you can: <a href="https://liberapay.com/f0x/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>
|
96
web/source/panels/admin/auth.js
Normal file
96
web/source/panels/admin/auth.js
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const Promise = require("bluebird");
|
||||||
|
const React = require("react");
|
||||||
|
const oauthLib = require("../../lib/oauth");
|
||||||
|
|
||||||
|
module.exports = function Auth({setOauth}) {
|
||||||
|
const [ instance, setInstance ] = React.useState("");
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
let isStillMounted = true;
|
||||||
|
// check if current domain runs an instance
|
||||||
|
let thisUrl = new URL(window.location.origin);
|
||||||
|
thisUrl.pathname = "/api/v1/instance";
|
||||||
|
Promise.try(() => {
|
||||||
|
return fetch(thisUrl.href);
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.status == 200) {
|
||||||
|
return res.json();
|
||||||
|
}
|
||||||
|
}).then((json) => {
|
||||||
|
if (json && json.uri && isStillMounted) {
|
||||||
|
setInstance(json.uri);
|
||||||
|
}
|
||||||
|
}).catch((e) => {
|
||||||
|
console.log("error checking instance response:", e);
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
// cleanup function
|
||||||
|
isStillMounted = false;
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
function doAuth() {
|
||||||
|
return Promise.try(() => {
|
||||||
|
return new URL(instance);
|
||||||
|
}).catch(TypeError, () => {
|
||||||
|
return new URL(`https://${instance}`);
|
||||||
|
}).then((parsedURL) => {
|
||||||
|
let url = parsedURL.toString();
|
||||||
|
let oauth = oauthLib({
|
||||||
|
instance: url,
|
||||||
|
client_name: "GoToSocial Admin Panel",
|
||||||
|
scope: ["admin"],
|
||||||
|
website: window.location.href
|
||||||
|
});
|
||||||
|
setOauth(oauth);
|
||||||
|
setInstance(url);
|
||||||
|
return oauth.register().then(() => {
|
||||||
|
return oauth;
|
||||||
|
});
|
||||||
|
}).then((oauth) => {
|
||||||
|
return oauth.authorize();
|
||||||
|
}).catch((e) => {
|
||||||
|
console.log("error authenticating:", e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateInstance(e) {
|
||||||
|
if (e.key == "Enter") {
|
||||||
|
doAuth();
|
||||||
|
} else {
|
||||||
|
setInstance(e.target.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="login">
|
||||||
|
<h1>OAUTH Login:</h1>
|
||||||
|
<form onSubmit={(e) => e.preventDefault()}>
|
||||||
|
<label htmlFor="instance">Instance: </label>
|
||||||
|
<input value={instance} onChange={updateInstance} id="instance"/>
|
||||||
|
<button onClick={doAuth}>Authenticate</button>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
};
|
318
web/source/panels/admin/blocks.js
Normal file
318
web/source/panels/admin/blocks.js
Normal file
|
@ -0,0 +1,318 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const Promise = require("bluebird");
|
||||||
|
const React = require("react");
|
||||||
|
const fileDownload = require("js-file-download");
|
||||||
|
|
||||||
|
function sortBlocks(blocks) {
|
||||||
|
return blocks.sort((a, b) => { // alphabetical sort
|
||||||
|
return a.domain.localeCompare(b.domain);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function deduplicateBlocks(blocks) {
|
||||||
|
let a = new Map();
|
||||||
|
blocks.forEach((block) => {
|
||||||
|
a.set(block.id, block);
|
||||||
|
});
|
||||||
|
return Array.from(a.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = function Blocks({oauth}) {
|
||||||
|
const [blocks, setBlocks] = React.useState([]);
|
||||||
|
const [info, setInfo] = React.useState("Fetching blocks");
|
||||||
|
const [errorMsg, setError] = React.useState("");
|
||||||
|
const [checked, setChecked] = React.useState(new Set());
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
Promise.try(() => {
|
||||||
|
return oauth.apiRequest("/api/v1/admin/domain_blocks", undefined, undefined, "GET");
|
||||||
|
}).then((json) => {
|
||||||
|
setInfo("");
|
||||||
|
setError("");
|
||||||
|
setBlocks(sortBlocks(json));
|
||||||
|
}).catch((e) => {
|
||||||
|
setError(e.message);
|
||||||
|
setInfo("");
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
let blockList = blocks.map((block) => {
|
||||||
|
function update(e) {
|
||||||
|
let newChecked = new Set(checked.values());
|
||||||
|
if (e.target.checked) {
|
||||||
|
newChecked.add(block.id);
|
||||||
|
} else {
|
||||||
|
newChecked.delete(block.id);
|
||||||
|
}
|
||||||
|
setChecked(newChecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<React.Fragment key={block.id}>
|
||||||
|
<div><input type="checkbox" onChange={update} checked={checked.has(block.id)}></input></div>
|
||||||
|
<div>{block.domain}</div>
|
||||||
|
<div>{(new Date(block.created_at)).toLocaleString()}</div>
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
function clearChecked() {
|
||||||
|
setChecked(new Set());
|
||||||
|
}
|
||||||
|
|
||||||
|
function undoChecked() {
|
||||||
|
let amount = checked.size;
|
||||||
|
if(confirm(`Are you sure you want to remove ${amount} block(s)?`)) {
|
||||||
|
setInfo("");
|
||||||
|
Promise.map(Array.from(checked.values()), (block) => {
|
||||||
|
console.log("deleting", block);
|
||||||
|
return oauth.apiRequest(`/api/v1/admin/domain_blocks/${block}`, "DELETE");
|
||||||
|
}).then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
setInfo(`Deleted ${amount} blocks: ${res.map((a) => a.domain).join(", ")}`);
|
||||||
|
}).catch((e) => {
|
||||||
|
setError(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
let newBlocks = blocks.filter((block) => {
|
||||||
|
if (checked.size > 0 && checked.has(block.id)) {
|
||||||
|
checked.delete(block.id);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setBlocks(newBlocks);
|
||||||
|
clearChecked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="blocks">
|
||||||
|
<h1>Blocks</h1>
|
||||||
|
<div className="error accent">{errorMsg}</div>
|
||||||
|
<div>{info}</div>
|
||||||
|
<AddBlock oauth={oauth} blocks={blocks} setBlocks={setBlocks} />
|
||||||
|
<h3>Blocks:</h3>
|
||||||
|
<div style={{display: "grid", gridTemplateColumns: "1fr auto"}}>
|
||||||
|
<span onClick={clearChecked} className="accent" style={{alignSelf: "end"}}>uncheck all</span>
|
||||||
|
<button onClick={undoChecked}>Unblock selected</button>
|
||||||
|
</div>
|
||||||
|
<div className="blocklist overflow">
|
||||||
|
{blockList}
|
||||||
|
</div>
|
||||||
|
<BulkBlocking oauth={oauth} blocks={blocks} setBlocks={setBlocks}/>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
function BulkBlocking({oauth, blocks, setBlocks}) {
|
||||||
|
const [bulk, setBulk] = React.useState("");
|
||||||
|
const [blockMap, setBlockMap] = React.useState(new Map());
|
||||||
|
const [output, setOutput] = React.useState();
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
let newBlockMap = new Map();
|
||||||
|
blocks.forEach((block) => {
|
||||||
|
newBlockMap.set(block.domain, block);
|
||||||
|
});
|
||||||
|
setBlockMap(newBlockMap);
|
||||||
|
}, [blocks]);
|
||||||
|
|
||||||
|
const fileRef = React.useRef();
|
||||||
|
|
||||||
|
function error(e) {
|
||||||
|
setOutput(<div className="error accent">{e}</div>);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fileUpload() {
|
||||||
|
let reader = new FileReader();
|
||||||
|
reader.addEventListener("load", (e) => {
|
||||||
|
try {
|
||||||
|
// TODO: use validatem?
|
||||||
|
let json = JSON.parse(e.target.result);
|
||||||
|
json.forEach((block) => {
|
||||||
|
console.log("block:", block);
|
||||||
|
});
|
||||||
|
} catch(e) {
|
||||||
|
error(e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
reader.readAsText(fileRef.current.files[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (fileRef && fileRef.current) {
|
||||||
|
fileRef.current.addEventListener("change", fileUpload);
|
||||||
|
}
|
||||||
|
return function cleanup() {
|
||||||
|
fileRef.current.removeEventListener("change", fileUpload);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
function textImport() {
|
||||||
|
Promise.try(() => {
|
||||||
|
if (bulk[0] == "[") {
|
||||||
|
// assume it's json
|
||||||
|
return JSON.parse(bulk);
|
||||||
|
} else {
|
||||||
|
return bulk.split("\n").map((val) => {
|
||||||
|
return {
|
||||||
|
domain: val.trim()
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).then((domains) => {
|
||||||
|
console.log(domains);
|
||||||
|
let before = domains.length;
|
||||||
|
setOutput(`Importing ${before} domain(s)`);
|
||||||
|
domains = domains.filter(({domain}) => {
|
||||||
|
return (domain != "" && !blockMap.has(domain));
|
||||||
|
});
|
||||||
|
setOutput(<span>{output}<br/>{`Deduplicated ${before - domains.length}/${before} with existing blocks, adding ${domains.length} block(s)`}</span>);
|
||||||
|
if (domains.length > 0) {
|
||||||
|
let data = new FormData();
|
||||||
|
data.append("domains", new Blob([JSON.stringify(domains)], {type: "application/json"}), "import.json");
|
||||||
|
return oauth.apiRequest("/api/v1/admin/domain_blocks?import=true", "POST", data, "form");
|
||||||
|
}
|
||||||
|
}).then((json) => {
|
||||||
|
console.log("bulk import result:", json);
|
||||||
|
setBlocks(sortBlocks(deduplicateBlocks([...json, ...blocks])));
|
||||||
|
}).catch((e) => {
|
||||||
|
error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function textExport() {
|
||||||
|
setBulk(blocks.reduce((str, val) => {
|
||||||
|
if (typeof str == "object") {
|
||||||
|
return str.domain;
|
||||||
|
} else {
|
||||||
|
return str + "\n" + val.domain;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function jsonExport() {
|
||||||
|
Promise.try(() => {
|
||||||
|
return oauth.apiRequest("/api/v1/admin/domain_blocks?export=true", "GET");
|
||||||
|
}).then((json) => {
|
||||||
|
fileDownload(JSON.stringify(json), "block-export.json");
|
||||||
|
}).catch((e) => {
|
||||||
|
error(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function textAreaUpdate(e) {
|
||||||
|
setBulk(e.target.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<React.Fragment>
|
||||||
|
<h3>Bulk import/export</h3>
|
||||||
|
<label htmlFor="bulk">Domains, one per line:</label>
|
||||||
|
<textarea value={bulk} rows={20} onChange={textAreaUpdate}></textarea>
|
||||||
|
<div className="controls">
|
||||||
|
<button onClick={textImport}>Import All From Field</button>
|
||||||
|
<button onClick={textExport}>Export To Field</button>
|
||||||
|
<label className="button" htmlFor="upload">Upload .json</label>
|
||||||
|
<button onClick={jsonExport}>Download .json</button>
|
||||||
|
</div>
|
||||||
|
{output}
|
||||||
|
<input type="file" id="upload" className="hidden" ref={fileRef}></input>
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddBlock({oauth, blocks, setBlocks}) {
|
||||||
|
const [domain, setDomain] = React.useState("");
|
||||||
|
const [type, setType] = React.useState("suspend");
|
||||||
|
const [obfuscated, setObfuscated] = React.useState(false);
|
||||||
|
const [privateDescription, setPrivateDescription] = React.useState("");
|
||||||
|
const [publicDescription, setPublicDescription] = React.useState("");
|
||||||
|
|
||||||
|
function addBlock() {
|
||||||
|
console.log(`${type}ing`, domain);
|
||||||
|
Promise.try(() => {
|
||||||
|
return oauth.apiRequest("/api/v1/admin/domain_blocks", "POST", {
|
||||||
|
domain: domain,
|
||||||
|
obfuscate: obfuscated,
|
||||||
|
private_comment: privateDescription,
|
||||||
|
public_comment: publicDescription
|
||||||
|
}, "json");
|
||||||
|
}).then((json) => {
|
||||||
|
setDomain("");
|
||||||
|
setPrivateDescription("");
|
||||||
|
setPublicDescription("");
|
||||||
|
setBlocks([json, ...blocks]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDomainChange(e) {
|
||||||
|
setDomain(e.target.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTypeChange(e) {
|
||||||
|
setType(e.target.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onKeyDown(e) {
|
||||||
|
if (e.key == "Enter") {
|
||||||
|
addBlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<React.Fragment>
|
||||||
|
<h3>Add Block:</h3>
|
||||||
|
<div className="addblock">
|
||||||
|
<input id="domain" placeholder="instance" onChange={onDomainChange} value={domain} onKeyDown={onKeyDown} />
|
||||||
|
<select value={type} onChange={onTypeChange}>
|
||||||
|
<option id="suspend">Suspend</option>
|
||||||
|
<option id="silence">Silence</option>
|
||||||
|
</select>
|
||||||
|
<button onClick={addBlock}>Add</button>
|
||||||
|
<div>
|
||||||
|
<label htmlFor="private">Private description:</label><br/>
|
||||||
|
<textarea id="private" value={privateDescription} onChange={(e) => setPrivateDescription(e.target.value)}></textarea>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label htmlFor="public">Public description:</label><br/>
|
||||||
|
<textarea id="public" value={publicDescription} onChange={(e) => setPublicDescription(e.target.value)}></textarea>
|
||||||
|
</div>
|
||||||
|
<div className="single">
|
||||||
|
<label htmlFor="obfuscate">Obfuscate:</label>
|
||||||
|
<input id="obfuscate" type="checkbox" value={obfuscated} onChange={(e) => setObfuscated(e.target.checked)}/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// function Blocklist() {
|
||||||
|
// return (
|
||||||
|
// <section className="blocklists">
|
||||||
|
// <h1>Blocklists</h1>
|
||||||
|
// </section>
|
||||||
|
// );
|
||||||
|
// }
|
95
web/source/panels/admin/index.js
Normal file
95
web/source/panels/admin/index.js
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const Promise = require("bluebird");
|
||||||
|
const React = require("react");
|
||||||
|
const ReactDom = require("react-dom");
|
||||||
|
|
||||||
|
const oauthLib = require("../../lib/oauth.js");
|
||||||
|
const Auth = require("./auth");
|
||||||
|
const Settings = require("./settings");
|
||||||
|
const Blocks = require("./blocks");
|
||||||
|
|
||||||
|
require("./style.css");
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
const [oauth, setOauth] = React.useState();
|
||||||
|
const [hasAuth, setAuth] = React.useState(false);
|
||||||
|
const [oauthState, setOauthState] = React.useState(localStorage.getItem("oauth"));
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
let state = localStorage.getItem("oauth");
|
||||||
|
if (state != undefined) {
|
||||||
|
state = JSON.parse(state);
|
||||||
|
let restoredOauth = oauthLib(state.config, state);
|
||||||
|
Promise.try(() => {
|
||||||
|
return restoredOauth.callback();
|
||||||
|
}).then(() => {
|
||||||
|
setAuth(true);
|
||||||
|
});
|
||||||
|
setOauth(restoredOauth);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (!hasAuth && oauth && oauth.isAuthorized()) {
|
||||||
|
setAuth(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oauth && oauth.isAuthorized()) {
|
||||||
|
return <AdminPanel oauth={oauth} />;
|
||||||
|
} else if (oauthState != undefined) {
|
||||||
|
return "processing oauth...";
|
||||||
|
} else {
|
||||||
|
return <Auth setOauth={setOauth} />;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function AdminPanel({oauth}) {
|
||||||
|
/*
|
||||||
|
Features: (issue #78)
|
||||||
|
- [ ] Instance information updating
|
||||||
|
GET /api/v1/instance PATCH /api/v1/instance
|
||||||
|
- [ ] Domain block creation, viewing, and deletion
|
||||||
|
GET /api/v1/admin/domain_blocks
|
||||||
|
POST /api/v1/admin/domain_blocks
|
||||||
|
GET /api/v1/admin/domain_blocks/DOMAIN_BLOCK_ID, DELETE /api/v1/admin/domain_blocks/DOMAIN_BLOCK_ID
|
||||||
|
- [ ] Blocklist import/export
|
||||||
|
GET /api/v1/admin/domain_blocks?export=true
|
||||||
|
POST json file as form field domains to /api/v1/admin/domain_blocks
|
||||||
|
*/
|
||||||
|
|
||||||
|
return (
|
||||||
|
<React.Fragment>
|
||||||
|
<Logout oauth={oauth}/>
|
||||||
|
<Settings oauth={oauth} />
|
||||||
|
<Blocks oauth={oauth}/>
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Logout({oauth}) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<button onClick={oauth.logout}>Logout</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReactDom.render(<App/>, document.getElementById("root"));
|
175
web/source/panels/admin/settings.js
Normal file
175
web/source/panels/admin/settings.js
Normal file
|
@ -0,0 +1,175 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const Promise = require("bluebird");
|
||||||
|
const React = require("react");
|
||||||
|
|
||||||
|
module.exports = function Settings({oauth}) {
|
||||||
|
const [info, setInfo] = React.useState({});
|
||||||
|
const [errorMsg, setError] = React.useState("");
|
||||||
|
const [statusMsg, setStatus] = React.useState("Fetching instance info");
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
Promise.try(() => {
|
||||||
|
return oauth.apiRequest("/api/v1/instance", "GET");
|
||||||
|
}).then((json) => {
|
||||||
|
setInfo(json);
|
||||||
|
}).catch((e) => {
|
||||||
|
setError(e.message);
|
||||||
|
setStatus("");
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
function submit() {
|
||||||
|
setStatus("PATCHing");
|
||||||
|
setError("");
|
||||||
|
return Promise.try(() => {
|
||||||
|
let formDataInfo = new FormData();
|
||||||
|
Object.entries(info).forEach(([key, val]) => {
|
||||||
|
if (key == "contact_account") {
|
||||||
|
key = "contact_username";
|
||||||
|
val = val.username;
|
||||||
|
}
|
||||||
|
if (key == "email") {
|
||||||
|
key = "contact_email";
|
||||||
|
}
|
||||||
|
if (typeof val != "object") {
|
||||||
|
formDataInfo.append(key, val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return oauth.apiRequest("/api/v1/instance", "PATCH", formDataInfo, "form");
|
||||||
|
}).then((json) => {
|
||||||
|
setStatus("Config saved");
|
||||||
|
console.log(json);
|
||||||
|
}).catch((e) => {
|
||||||
|
setError(e.message);
|
||||||
|
setStatus("");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="info login">
|
||||||
|
<h1>Instance Information <button onClick={submit}>Save</button></h1>
|
||||||
|
<div className="error accent">
|
||||||
|
{errorMsg}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{statusMsg}
|
||||||
|
</div>
|
||||||
|
<form onSubmit={(e) => e.preventDefault()}>
|
||||||
|
{editableObject(info)}
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
function editableObject(obj, path=[]) {
|
||||||
|
const readOnlyKeys = ["uri", "version", "urls_streaming_api", "stats"];
|
||||||
|
const hiddenKeys = ["contact_account_", "urls"];
|
||||||
|
const explicitShownKeys = ["contact_account_username"];
|
||||||
|
const implementedKeys = "title, contact_account_username, email, short_description, description, terms, avatar, header".split(", ");
|
||||||
|
|
||||||
|
let listing = Object.entries(obj).map(([key, val]) => {
|
||||||
|
let fullkey = [...path, key].join("_");
|
||||||
|
|
||||||
|
if (
|
||||||
|
hiddenKeys.includes(fullkey) ||
|
||||||
|
hiddenKeys.includes(path.join("_")+"_") // also match just parent path
|
||||||
|
) {
|
||||||
|
if (!explicitShownKeys.includes(fullkey)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(val)) {
|
||||||
|
// FIXME: handle this
|
||||||
|
} else if (typeof val == "object") {
|
||||||
|
return (<React.Fragment key={fullkey}>
|
||||||
|
{editableObject(val, [...path, key])}
|
||||||
|
</React.Fragment>);
|
||||||
|
}
|
||||||
|
|
||||||
|
let isImplemented = "";
|
||||||
|
if (!implementedKeys.includes(fullkey)) {
|
||||||
|
isImplemented = " notImplemented";
|
||||||
|
}
|
||||||
|
|
||||||
|
let isReadOnly = (
|
||||||
|
readOnlyKeys.includes(fullkey) ||
|
||||||
|
readOnlyKeys.includes(path.join("_")) ||
|
||||||
|
isImplemented != ""
|
||||||
|
);
|
||||||
|
|
||||||
|
let label = key.replace(/_/g, " ");
|
||||||
|
if (path.length > 0) {
|
||||||
|
label = `\u00A0`.repeat(4 * path.length) + label;
|
||||||
|
}
|
||||||
|
|
||||||
|
let inputProps;
|
||||||
|
let changeFunc;
|
||||||
|
if (val === true || val === false) {
|
||||||
|
inputProps = {
|
||||||
|
type: "checkbox",
|
||||||
|
defaultChecked: val,
|
||||||
|
disabled: isReadOnly
|
||||||
|
};
|
||||||
|
changeFunc = (e) => e.target.checked;
|
||||||
|
} else if (val.length != 0 && !isNaN(val)) {
|
||||||
|
inputProps = {
|
||||||
|
type: "number",
|
||||||
|
defaultValue: val,
|
||||||
|
readOnly: isReadOnly
|
||||||
|
};
|
||||||
|
changeFunc = (e) => e.target.value;
|
||||||
|
} else {
|
||||||
|
inputProps = {
|
||||||
|
type: "text",
|
||||||
|
defaultValue: val,
|
||||||
|
readOnly: isReadOnly
|
||||||
|
};
|
||||||
|
changeFunc = (e) => e.target.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setRef(element) {
|
||||||
|
if (element != null) {
|
||||||
|
element.addEventListener("change", (e) => {
|
||||||
|
obj[key] = changeFunc(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<React.Fragment key={fullkey}>
|
||||||
|
<label htmlFor={key} className="capitalize">{label}</label>
|
||||||
|
<div className={isImplemented}>
|
||||||
|
<input className={isImplemented} ref={setRef} {...inputProps} />
|
||||||
|
</div>
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return (
|
||||||
|
<React.Fragment>
|
||||||
|
{path != "" &&
|
||||||
|
<><b>{path}:</b> <span id="filler"></span></>
|
||||||
|
}
|
||||||
|
{listing}
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
}
|
141
web/source/panels/admin/style.css
Normal file
141
web/source/panels/admin/style.css
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
body {
|
||||||
|
grid-template-rows: auto 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.capitalize {
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
|
||||||
|
section {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, select, textarea {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
section.info {
|
||||||
|
form {
|
||||||
|
grid-template-columns: auto 1fr;
|
||||||
|
width: calc(100% - 0.35rem);
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 100%;
|
||||||
|
line-height: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
label, input {
|
||||||
|
padding: 0.2rem 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=checkbox] {
|
||||||
|
justify-self: start;
|
||||||
|
width: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:read-only {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:invalid {
|
||||||
|
border-color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
width: 100%;
|
||||||
|
height: 8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
section.blocks {
|
||||||
|
.overflow {
|
||||||
|
max-height: 80vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blocklist {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto 1fr auto;
|
||||||
|
grid-gap: 0.35rem 0;
|
||||||
|
|
||||||
|
div {
|
||||||
|
background: rgb(70, 79, 88);
|
||||||
|
padding: 0.2rem 0.4rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.addblock {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr auto auto;
|
||||||
|
grid-gap: 0.35rem;
|
||||||
|
|
||||||
|
input, select {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, select, textarea {
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
div {
|
||||||
|
grid-column: 1/4;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.single input {
|
||||||
|
width: initial;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notImplemented {
|
||||||
|
border: 2px solid rgb(70, 79, 88);
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
-45deg,
|
||||||
|
#525c66,
|
||||||
|
#525c66 10px,
|
||||||
|
rgb(70, 79, 88) 10px,
|
||||||
|
rgb(70, 79, 88) 20px
|
||||||
|
) !important;
|
||||||
|
}
|
31
web/source/panels/user/index.js
Normal file
31
web/source/panels/user/index.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
GoToSocial
|
||||||
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const Promise = require("bluebird");
|
||||||
|
const React = require("react");
|
||||||
|
const ReactDom = require("react-dom");
|
||||||
|
|
||||||
|
// require("./style.css");
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
return "hello world - user panel";
|
||||||
|
}
|
||||||
|
|
||||||
|
ReactDom.render(<App/>, document.getElementById("root"));
|
6307
web/source/yarn.lock
Normal file
6307
web/source/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
|
@ -15,5 +15,11 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
</div>
|
||||||
|
{{ if .javascript }}
|
||||||
|
{{ range .javascript }}
|
||||||
|
<script src="{{.}}"></script>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
5
web/template/frontend.tmpl
Normal file
5
web/template/frontend.tmpl
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{{ template "header.tmpl" .}}
|
||||||
|
<main class="lightgray">
|
||||||
|
<div id="root"></div>
|
||||||
|
</main>
|
||||||
|
{{ template "footer.tmpl" .}}
|
|
@ -1,21 +1,23 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<!-- Header tmpl -->
|
<!-- header.tmpl -->
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="og:title" content="GoToSocial Testing Instance">
|
<meta name="og:title" content="{{.instance.Title}} - GoToSocial">
|
||||||
<meta name="og:description" content="">
|
<meta name="og:description" content="{{.instance.ShortDescription}}">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="/assets/base.css">
|
<link rel="stylesheet" href="/assets/dist/_colors.css">
|
||||||
|
<link rel="stylesheet" href="/assets/dist/base.css">
|
||||||
{{range .stylesheets}}<link rel="stylesheet" href="{{.}}">
|
{{range .stylesheets}}<link rel="stylesheet" href="{{.}}">
|
||||||
{{end}}
|
{{end}}
|
||||||
<link rel="shortcut icon" href="/assets/logo.png" type="image/png">
|
<link rel="shortcut icon" href="/assets/logo.png" type="image/png">
|
||||||
<title>{{.instance.Title}} - GoToSocial</title>
|
<title>{{.instance.Title}} - GoToSocial</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div class="page">
|
||||||
<a href="/" class="nounderline">
|
<a href="/" class="nounderline">
|
||||||
<header>
|
<header>
|
||||||
<img src="/assets/logo.png" alt="Instance Logo"/>
|
<img src="/assets/logo.png" alt="Instance Logo"/>
|
||||||
|
|
|
@ -31,19 +31,4 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
<script>
|
|
||||||
Array.from(document.getElementsByClassName("spoiler-label")).forEach((label) => {
|
|
||||||
let checkbox = document.getElementById(label.htmlFor);
|
|
||||||
function update() {
|
|
||||||
if(checkbox.checked) {
|
|
||||||
label.innerHTML = "Show more";
|
|
||||||
} else {
|
|
||||||
label.innerHTML = "Show less";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
update();
|
|
||||||
|
|
||||||
label.addEventListener("click", () => {setTimeout(update, 1)});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{{ template "footer.tmpl" .}}
|
{{ template "footer.tmpl" .}}
|
||||||
|
|
|
@ -16,19 +16,4 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
<script>
|
|
||||||
Array.from(document.getElementsByClassName("spoiler-label")).forEach((label) => {
|
|
||||||
let checkbox = document.getElementById(label.htmlFor);
|
|
||||||
function update() {
|
|
||||||
if(checkbox.checked) {
|
|
||||||
label.innerHTML = "Show more";
|
|
||||||
} else {
|
|
||||||
label.innerHTML = "Show less";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
update();
|
|
||||||
|
|
||||||
label.addEventListener("click", () => {setTimeout(update, 1)});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{{ template "footer.tmpl" .}}
|
{{ template "footer.tmpl" .}}
|
Loading…
Reference in a new issue