16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/client-participation/css/polis/layout/_grid.scss:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | // GRID
4 |
--------------------------------------------------------------------------------
/client-participation/js/templates/footer.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
--------------------------------------------------------------------------------
/client-participation/js/templates/results-view.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: Please write a concise description of the problem here
5 | labels: feature-request
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Problem**:
11 | Please write a more complete description of your problem, if necessary.
12 |
13 | **Suggested solution**:
14 | If you have a particular solution in mind, please share here.
15 |
16 | **Alternative suggestions**:
17 | * If there are other ways this could be solved
18 | * Please enumerate here.
19 |
20 | **Additional context**:
21 | Please add any other context or screenshots about the feature request here.
22 |
--------------------------------------------------------------------------------
/client-admin/src/components/landers/knowledgeBase.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import { Box, Link } from 'theme-ui'
4 | import emoji from 'react-easy-emoji'
5 |
6 | const KnowledgeBase = ({ e, url, txt }) => {
7 | return (
8 |
9 |
10 | {emoji(e)}
11 | {txt}
12 |
13 |
14 | )
15 | }
16 |
17 | KnowledgeBase.propTypes = {
18 | e: PropTypes.string.isRequired,
19 | url: PropTypes.string.isRequired,
20 | txt: PropTypes.string.isRequired
21 | }
22 |
23 | export default KnowledgeBase
24 |
--------------------------------------------------------------------------------
/client-participation/js/templates/header.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Something doesn't seem to be working correctly
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Expected behavior**:
11 | Please describe the expected behavior here.
12 |
13 | **Actual behavior**:
14 | Please describe the actual behavior here.
15 |
16 | **To Reproduce**:
17 | Please list detailed steps to reproduce here.
18 |
19 | **Screenshots**:
20 | If applicable, add screenshots to help explain your problem.
21 |
22 | **Device information**:
23 | Please list any device details here.
24 |
25 | **Additional context**:
26 | Add any other context about the problem here which might be helpful.
27 |
--------------------------------------------------------------------------------
/client-participation/css/pca_vis.scss:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | /* moved to css/polis/modules/_visualization.scss */
4 |
--------------------------------------------------------------------------------
/e2e/cypress/support/e2e.js:
--------------------------------------------------------------------------------
1 | // ***********************************************************
2 | // This example support/e2e.js is processed and
3 | // loaded automatically before your test files.
4 | //
5 | // This is a great place to put global configuration and
6 | // behavior that modifies Cypress.
7 | //
8 | // You can change the location of this file or turn off
9 | // automatically serving support files with the
10 | // 'supportFile' configuration option.
11 | //
12 | // You can read more here:
13 | // https://on.cypress.io/configuration
14 | // ***********************************************************
15 |
16 | import './commands'
17 | require('cypress-terminal-report/src/installLogsCollector')()
18 |
--------------------------------------------------------------------------------
/client-admin/src/components/landers/lander-layout.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import Header from './lander-header'
4 | import Footer from './lander-footer'
5 | import { Box } from 'theme-ui'
6 |
7 | const Layout = ({ children }) => {
8 | const globalWidth = '45em'
9 | return (
10 |
16 |
17 | {children}
18 |
19 |
20 | )
21 | }
22 |
23 | Layout.propTypes = {
24 | children: PropTypes.element
25 | }
26 |
27 | export default Layout
28 |
--------------------------------------------------------------------------------
/client-participation/js/model.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Backbone = require("backbone");
4 |
5 | module.exports = Backbone.Model.extend({});
6 |
--------------------------------------------------------------------------------
/client-participation/js/collection.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Backbone = require("backbone");
4 |
5 | module.exports = Backbone.Collection.extend({});
6 |
--------------------------------------------------------------------------------
/client-participation/vis2/components/header.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import _ from "lodash";
3 | import Logo from "./hexLogo";
4 | import Gear from "./gear";
5 |
6 | class Header extends React.Component {
7 | render() {
8 | return (
9 |
21 | )
22 | }
23 | }
24 |
25 | export default Header;
26 |
--------------------------------------------------------------------------------
/math/bin/util-server:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
3 |
4 | while [ 1 ]
5 | do
6 | lein with-profile production trampoline run -m polismath.server
7 | done
8 |
--------------------------------------------------------------------------------
/server/postgres/migrations/archived/db_000002.sql:
--------------------------------------------------------------------------------
1 | -- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | alter table site_domain_whitelist add column domain_whitelist_override_key VARCHAR(999);
--------------------------------------------------------------------------------
/server/postgres/migrations/archived/db_000006.sql:
--------------------------------------------------------------------------------
1 | -- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | alter table participants_extended add column show_translation_activated BOOLEAN;
4 |
--------------------------------------------------------------------------------
/client-report/.eslintrc.yml:
--------------------------------------------------------------------------------
1 | env:
2 | browser: true
3 | es2021: true
4 | jquery: true
5 | extends:
6 | - eslint:recommended
7 | - plugin:react/recommended
8 | globals:
9 | _: readonly
10 | d3: readonly
11 | process: readonly
12 | ignorePatterns:
13 | - build
14 | - devel
15 | - dist
16 | overrides:
17 | - files:
18 | - webpack.config.js
19 | - webpack.common.js
20 | - webpack.dev.js
21 | - writeHeadersJsonTask.js
22 | env:
23 | browser: false
24 | node: true
25 | parser: "@babel/eslint-parser"
26 | parserOptions:
27 | ecmaVersion: latest
28 | sourceType: module
29 | plugins:
30 | - react
31 | rules:
32 | react/prop-types: warn
33 | settings:
34 | react:
35 | version: 'detect'
36 |
--------------------------------------------------------------------------------
/client-participation/css/polis/modules/_intercom.scss:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | // #IModalOverlay {
4 | // background-color: rgba(0, 0, 0, 0.35) !important;
5 | // }
6 |
--------------------------------------------------------------------------------
/client-participation/js/layout-view.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Handlebones = require("handlebones");
4 |
5 | module.exports = Handlebones.LayoutView.extend({});
6 |
--------------------------------------------------------------------------------
/client-participation/js/collection-view.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Handlebones = require("handlebones");
4 |
5 | module.exports = Handlebones.CollectionView.extend({});
6 |
--------------------------------------------------------------------------------
/client-admin/src/util/url.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | const urlPrefix = `${document.location.protocol}//${document.location.host}/`
4 |
5 | export default {
6 | urlPrefix,
7 | }
8 |
--------------------------------------------------------------------------------
/client-participation/js/util/url.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | const urlPrefix = `${document.location.protocol}//${document.location.host}/`;
4 |
5 | module.exports = {
6 | urlPrefix,
7 | };
8 |
--------------------------------------------------------------------------------
/server/example.env:
--------------------------------------------------------------------------------
1 | # These variables will be overriden by those set in the environment.
2 | # docker compose will use the root level .env file and ignore this one.
3 | # This file is intended to be used for local development.
4 | # It can optionally be included when running the server in a docker
5 | # container, for example `docker run --env-file .env`.
6 |
7 | API_DEV_HOSTNAME=localhost:5000
8 | API_SERVER_PORT=5000
9 | DATABASE_URL=postgres://postgres:oiPorg3Nrz0yqDLE@localhost:5432/polis-dev
10 | DEV_MODE=true
11 | DOMAIN_OVERRIDE=
12 | EMAIL_TRANSPORT_TYPES=maildev
13 | MATH_ENV=prod
14 | POLIS_FROM_ADDRESS="Example "
15 | SERVER_LOG_LEVEL=info
16 | STATIC_FILES_ADMIN_PORT=8080
17 | STATIC_FILES_PARTICIPATION_PORT=8080
18 | STATIC_FILES_HOST=localhost
19 |
--------------------------------------------------------------------------------
/client-participation/js/models/twitterUser.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Model = require("../model");
4 |
5 | module.exports = Model.extend({
6 | name: "twitterUser",
7 | urlRoot: "twitter_users",
8 | });
9 |
--------------------------------------------------------------------------------
/bin/activate-xid-whitelist.clj:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env -S bb --classpath bin
2 |
3 | (require '[lib.db :as db]
4 | '[clojure.java.io :as io]
5 | '[clojure.string :as str]
6 | '[honey.sql.helpers :as sqlh])
7 |
8 | (defn resolve-zid [{:as opts-map :strs [--zid --zinvite]}]
9 | (if --zid
10 | (Integer/parseInt --zid)
11 | (db/get-zinvite-zid --zinvite)))
12 |
13 | (defn -main [& {:as opts-map :strs [--zid --zinvite]}]
14 | (let [zid (resolve-zid opts-map)]
15 | (db/execute!
16 | (-> (sqlh/update :conversations)
17 | (sqlh/set {:use_xid_whitelist true})
18 | (sqlh/where [:= :zid zid])))
19 | (println "Done")))
20 |
21 |
22 | (when (= *file* (System/getProperty "babashka.file"))
23 | (apply -main *command-line-args*))
24 |
25 |
26 |
--------------------------------------------------------------------------------
/client-admin/Dockerfile:
--------------------------------------------------------------------------------
1 | # NOTE: This Dockerfile is not actually used by the docker-compose.yml.
2 | # Instead, the file-server Dockerfile builds and serves these assets.
3 | # But this file is still useful for development or deployments that do not use
4 | # the docker compose configuration.
5 |
6 | FROM docker.io/node:18-alpine
7 |
8 | ARG ENABLE_TWITTER_WIDGETS
9 | ARG FB_APP_ID
10 | ENV ENABLE_TWITTER_WIDGETS ${ENABLE_TWITTER_WIDGETS}
11 | ENV FB_APP_ID ${FB_APP_ID}
12 |
13 | # Set default NODE_ENV to production unless overridden at build time with --build-arg NODE_ENV=development
14 | ARG NODE_ENV
15 | ENV NODE_ENV ${NODE_ENV:-production}
16 |
17 | WORKDIR /app
18 |
19 | COPY package*.json ./
20 |
21 | RUN npm ci --production=false
22 |
23 | COPY . .
24 |
25 | CMD npm run build:prod
26 |
--------------------------------------------------------------------------------
/client-participation/js/templates/link-AddPolis-partial.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 | {{{addPolisToYourSite}}}
6 |
7 |
8 |
--------------------------------------------------------------------------------
/client-report/src/STATELESS_TEMPLATE.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import React from "react";
4 |
5 | const ComponentName = () => {
6 | return (
7 |
8 | );
9 | };
10 |
11 | export default ComponentName;
12 |
--------------------------------------------------------------------------------
/math/src/polismath/components/random.clj:
--------------------------------------------------------------------------------
1 | ;; Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | (ns polismath.components.random
4 | "This will eventually house a random number generator component which assists in the tracking of seed state")
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/test.env:
--------------------------------------------------------------------------------
1 | TAG=test
2 | COMPOSE_PROJECT_NAME=polis-${TAG}
3 | GIT_HASH=test
4 | DEV_MODE=true
5 | EMAIL_TRANSPORT_TYPES=maildev
6 | NODE_ENV=production
7 | SERVER_ENV_FILE=test.env
8 | SERVER_LOG_LEVEL=debug
9 |
10 | DOMAIN_OVERRIDE=localhost
11 | EMBED_SERVICE_HOSTNAME=localhost
12 | STATIC_FILES_HOST=file-server
13 |
14 | POSTGRES_DOCKER=true
15 | POSTGRES_DB=polis-test
16 | POSTGRES_HOST=postgres:5432
17 | POSTGRES_PASSWORD=PdwPNS2mDN73Vfbc
18 | POSTGRES_PORT=5432
19 | POSTGRES_USER=postgres
20 | DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}/${POSTGRES_DB}
21 |
22 | MATH_ENV=prod
23 | WEBSERVER_PASS=ws-pass
24 | WEBSERVER_USERNAME=ws-user
25 |
26 | # Set to true and provide valid GOOGLE_APPLICATION_CREDENTIALS to test translation
27 | SHOULD_USE_TRANSLATION_API=false
28 |
--------------------------------------------------------------------------------
/server/postgres/migrations/archived/db_000008.sql:
--------------------------------------------------------------------------------
1 | -- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | ALTER TABLE math_main ADD COLUMN caching_tick BIGINT NOT NULL DEFAULT 0;
4 |
5 | ALTER TABLE conversations ALTER COLUMN vis_type SET DEFAULT 0; -- default to vis off
--------------------------------------------------------------------------------
/docker-compose.test.yml:
--------------------------------------------------------------------------------
1 | # This file is an override to the original docker-compose.yml file, and as such is meant to
2 | # extend that configuration with some additional concerns for e2e tests, such as a maildev
3 | # server. DO NOT USE THIS IN PRODUCTION.
4 |
5 | # This configuration does not work on its own and must be run together with docker-compose.yml,
6 | # e.g. `docker compose --profile postgres -f docker-compose.yml -f docker-compose.test.yml --env-file test.env up`.
7 |
8 | # For more information see https://docs.docker.com/compose/extends/
9 |
10 | services:
11 | maildev:
12 | image: docker.io/maildev/maildev:1.1.1
13 | labels:
14 | polis_tag: ${TAG}
15 | networks:
16 | - polis-net
17 | ports:
18 | - "1080:1080"
19 |
20 | server:
21 | environment:
22 | - GOOGLE_CREDENTIALS_BASE64
23 |
--------------------------------------------------------------------------------
/client-participation/js/util/ab.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 |
4 |
5 | function isA() {
6 | return 0 === userObject.uid % 2;
7 | }
8 | function isB() {
9 | return 1 === userObject.uid % 2;
10 | }
11 |
12 | module.exports = {
13 | isA: isA,
14 | isB: isB,
15 | };
16 |
--------------------------------------------------------------------------------
/client-participation/Dockerfile:
--------------------------------------------------------------------------------
1 | # NOTE: This Dockerfile is not actually used by the docker-compose.yml.
2 | # Instead, the file-server Dockerfile builds and serves these assets.
3 | # But this file is still useful for development or deployments that do not use
4 | # the docker compose configuration.
5 |
6 | FROM docker.io/node:18-alpine
7 |
8 | ARG EMBED_SERVICE_HOSTNAME
9 | ARG FB_APP_ID
10 | ARG GA_TRACKING_ID
11 | ENV EMBED_SERVICE_HOSTNAME ${EMBED_SERVICE_HOSTNAME}
12 | ENV FB_APP_ID ${FB_APP_ID}
13 | ENV GA_TRACKING_ID ${GA_TRACKING_ID}
14 |
15 | # Set default NODE_ENV to production unless overridden at build time with --build-arg NODE_ENV=development
16 | ARG NODE_ENV
17 | ENV NODE_ENV ${NODE_ENV:-production}
18 |
19 | WORKDIR /app
20 |
21 | COPY package*.json ./
22 |
23 | RUN npm ci --production=false
24 |
25 | COPY . .
26 |
27 | CMD npm run build:prod
28 |
--------------------------------------------------------------------------------
/client-participation/js/collections/votes.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Collection = require("../collection");
4 | var Vote = require("../models/vote");
5 |
6 | module.exports = Collection.extend({
7 | name: "votes",
8 | url: "votes",
9 | model: Vote
10 | });
11 |
--------------------------------------------------------------------------------
/e2e/cypress.config.js:
--------------------------------------------------------------------------------
1 | const { defineConfig } = require('cypress')
2 |
3 | // One way to run Cypress against a different url is to pass CYPRESS_BASE_URL env variable,
4 | // e.g. CYPRESS_BASE_URL=http://localhost:5000 npm test
5 | // See https://docs.cypress.io/guides/guides/environment-variables
6 |
7 | module.exports = defineConfig({
8 | blockHosts: ['*.twitter.com', '*.jsdelivr.net'],
9 | // required to test within iframe:
10 | chromeSecurity: false,
11 | requestTimeout: 10000,
12 | e2e: {
13 | baseUrl: 'http://localhost',
14 | experimentalRunAllSpecs: true,
15 | video: false,
16 | setupNodeEvents(on /*, config*/) {
17 | // implement node event listeners here
18 | require('cypress-terminal-report/src/installLogsPrinter')(on)
19 | },
20 | },
21 | env: {
22 | maildevUrl: 'http://localhost:1080',
23 | },
24 | })
25 |
--------------------------------------------------------------------------------
/.bundlewatch.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | ci: {
3 | trackBranches: [process.env.CI_BRANCH_DEFAULT],
4 | baseBranch: process.env.CI_BRANCH_DEFAULT,
5 | // Allows bundlewatch GitHub Actions workflow to work on: pull_request, or push
6 | commitSha: process.env.PR_COMMIT_SHA || process.env.PUSH_COMMIT_SHA,
7 | repoBranchBase: process.env.PR_BRANCH_BASE || process.env.PUSH_BRANCH_BASE,
8 | repoCurrentBranch: process.env.PR_BRANCH || process.env.PUSH_BRANCH,
9 | },
10 | files: [
11 | {
12 | path: "client-admin/build/static/js/*.js",
13 | maxSize: "250 kB",
14 | },
15 | {
16 | path: "client-participation/dist/js/*.js",
17 | maxSize: "450 kB",
18 | },
19 | {
20 | path: "client-report/dist/*.js",
21 | maxSize: "200 kB",
22 | }
23 | ],
24 | normalizeFileNames: /^.+?(\..+?)\.\w+$/,
25 | };
26 |
--------------------------------------------------------------------------------
/client-participation/js/collections/comments.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Collection = require("../collection");
4 | var Comment = require("../models/comment");
5 |
6 | module.exports = Collection.extend({
7 | name: "comments",
8 | url: "comments",
9 | model: Comment
10 | });
11 |
--------------------------------------------------------------------------------
/client-participation/js/templates/root.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 | {{! Calling RootView.getInstance().setView(view)
4 | will place a view where layout-element is called below. }}
5 |
6 |
7 |
8 |
9 |
10 | {{layout-element}}
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/client-participation/js/templates/link-TOS-partial.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
11 | {{s.TOS}}
12 |
--------------------------------------------------------------------------------
/client-participation/js/views/commentView.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Handlebones = require("handlebones");
4 | var template = require("../templates/commentView.handlebars");
5 |
6 | module.exports = Handlebones.ModelView.extend({
7 | name: "commentView",
8 | template: template
9 | });
10 |
--------------------------------------------------------------------------------
/client-participation/js/views/writingTips.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var template = require("../templates/writingTips.handlebars");
4 | var Handlebones = require("handlebones");
5 |
6 | module.exports = Handlebones.View.extend({
7 | name: "writingTips",
8 | template: template
9 | });
10 |
--------------------------------------------------------------------------------
/server/postgres/migrations/000006_update_votes_rule.sql:
--------------------------------------------------------------------------------
1 | -- This migration fixes an issue with a poorly specified rule definition in the original 000000_initial.sql schema.
2 | -- The old specification worked on Postgres 13, but not longer does on Postgres 14.
3 | -- Consequently, if you set up your Polis database prior to April 9th, 2023, and wish to upgrade to Postgres 14,
4 | -- you should run this migration first.
5 |
6 | DROP RULE IF EXISTS on_vote_insert_update_unique_table ON votes;
7 |
8 | CREATE RULE on_vote_insert_update_unique_table AS
9 | ON INSERT TO votes
10 | DO ALSO
11 | INSERT INTO votes_latest_unique (zid, pid, tid, vote, weight_x_32767, modified)
12 | values (NEW.zid, NEW.pid, NEW.tid, NEW.vote, NEW.weight_x_32767, NEW.created)
13 | ON CONFLICT (zid, pid, tid) DO UPDATE SET vote = excluded.vote, modified = excluded.modified;
14 |
--------------------------------------------------------------------------------
/e2e/embed/template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Embedded Polis Test
8 |
9 |
10 | Check out this conversation!
11 |
12 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/security-issue.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Security issue
3 | about: If you have found an exploit or have concerns about security
4 | title: PLEASE SEND AN EMAIL INSTEAD OF SUBMITTING AN ISSUE!
5 | labels: ''
6 | assignees: colinmegill, metasoarous
7 |
8 | ---
9 |
10 | If you have a security concern, and especially if you believe you have found an exploit, please do not submit an issue via GitHub, but instead send us an email at . Our [security policy](https://compdemocracy.org/security) (content pending, as of this writing) is to work with you for 60 days to try and resolve the issue, and to then notify the public as soon as the issue has been resolved and deployments updated. After this time, you are welcome to publish on it openly, but we ask you for this time to maintain the security of the application and the data of it's users.
11 |
12 | Thank you!
13 |
--------------------------------------------------------------------------------
/client-report/src/util/style.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 |
4 | var style = {
5 | variable: {
6 | color: "rgb(20,150,150)",
7 | // fontWeight: "bold",
8 | },
9 | metadataCategory: {
10 | color: "rgb(230,150,0)",
11 | // fontWeight: "bold",
12 | }
13 | };
14 |
15 | export default style;
16 |
--------------------------------------------------------------------------------
/client-admin/src/util/component-helpers.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | const helpers = {}
4 |
5 | helpers.shouldShowPermissionsError = (props) => {
6 | return (
7 | props.zid_metadata &&
8 | !props.zid_metadata.is_owner &&
9 | !props.zid_metadata.is_mod
10 | )
11 | }
12 |
13 | export default helpers
14 |
--------------------------------------------------------------------------------
/server/bin/copyGoogleCredsToHeroku:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
3 |
4 | heroku config:set --app=polisapp GOOGLE_CREDS_STRINGIFIED="`node bin/stringifyGoogleCreds.js GoogleCredsMasterCopy.json`"
5 | heroku config:set --app=polis-preprod GOOGLE_CREDS_STRINGIFIED="`node bin/stringifyGoogleCreds.js GoogleCredsMasterCopy.json`"
6 |
7 |
--------------------------------------------------------------------------------
/server/postgres/migrations/archived/db_000004.sql:
--------------------------------------------------------------------------------
1 | -- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | alter table comments add column lang VARCHAR(10);
4 | alter table comments add column lang_confidence REAL;
5 |
6 | alter table conversations alter column socialbtn_type set default 0;
7 | alter table conversations add column prioritize_seed BOOLEAN DEFAULT FALSE;
--------------------------------------------------------------------------------
/client-participation/js/templates/link-privacy-partial.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 | {{s.privacy}}
--------------------------------------------------------------------------------
/client-participation/js/templates/icon_fa_angle_left.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client-participation/js/templates/icon_fa_angle_right.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
4 |
--------------------------------------------------------------------------------
/server/postgres/migrations/000005_drop_slack_stripe_canvas.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS slack_oauth_access_tokens CASCADE;
2 | DROP TABLE IF EXISTS slack_users CASCADE;
3 | DROP TABLE IF EXISTS slack_user_invites CASCADE;
4 | DROP TABLE IF EXISTS slack_bot_events CASCADE;
5 |
6 | DROP TABLE IF EXISTS stripe_accounts CASCADE;
7 | DROP TABLE IF EXISTS stripe_subscriptions CASCADE;
8 | DROP TABLE IF EXISTS coupons_for_free_upgrades CASCADE;
9 |
10 | DROP TABLE IF EXISTS lti_users CASCADE;
11 | DROP TABLE IF EXISTS lti_context_memberships CASCADE;
12 | DROP TABLE IF EXISTS canvas_assignment_callback_info CASCADE;
13 | DROP TABLE IF EXISTS canvas_assignment_conversation_info CASCADE;
14 | DROP TABLE IF EXISTS lti_oauthv1_credentials CASCADE;
15 |
16 | ALTER TABLE conversations DROP COLUMN IF EXISTS is_slack CASCADE;
17 | ALTER TABLE conversations DROP COLUMN IF EXISTS lti_users_only CASCADE;
18 |
19 | ALTER TABLE users DROP COLUMN IF EXISTS plan CASCADE;
20 |
--------------------------------------------------------------------------------
/client-participation/css/polis/modules/_toggle.scss:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | //TOGGLE
4 |
5 | .Toggle {
6 | font-family: $sans-font;
7 | text-transform: uppercase;
8 | letter-spacing: 0.07em;
9 | }
10 |
11 | .ToggleContent {
12 | padding-left: $default-whitespace;
13 | border-inline-start: 2px solid $brand-color;
14 |
15 | color: $dark-gray;
16 | }
17 |
--------------------------------------------------------------------------------
/client-admin/src/reducers/conversation_config.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | const conversation_config = (
4 | state = {
5 | loading: false,
6 | conversation_config: null,
7 | update_error: null
8 | },
9 | action
10 | ) => {
11 | switch (action.type) {
12 | default:
13 | return state
14 | }
15 | }
16 |
17 | export default conversation_config
18 |
--------------------------------------------------------------------------------
/math/src/polismath/components/env.clj:
--------------------------------------------------------------------------------
1 | ;; Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | (ns polismath.components.env
4 | (:require [environ.core :as environ]))
5 |
6 | ;; Deprecating... Will remove by the end of refactor XXX
7 |
8 | (def ^:dynamic env environ/env)
9 |
10 | (defmacro with-env-overrides
11 | [overrides & body]
12 | `(binding [env (merge env ~overrides)]
13 | ~@body))
14 |
15 |
--------------------------------------------------------------------------------
/math/src/data_readers.clj:
--------------------------------------------------------------------------------
1 | ;; Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | {mikera.vectorz.Vector clojure.core.matrix/matrix
4 | mikera.arrayz.NDArray clojure.core.matrix/matrix
5 | mikera.matrixx.Matrix clojure.core.matrix/matrix
6 | ;clojure.core.matrix.impl.ndarray.NDArray clojure.core.matrix ;; Need to check this one... XXX
7 | polismath.named-matrix.NamedMatrix polismath.named-matrix/named-matrix-reader}
8 |
--------------------------------------------------------------------------------
/e2e/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | e2e-electron:
3 | image: cypress/included:12.17.3
4 | environment:
5 | - CYPRESS_BASE_URL=http://host.docker.internal:80
6 | - CYPRESS_MAILDEV_URL=http://host.docker.internal:1080
7 | volumes:
8 | - .:/e2e
9 | working_dir: /e2e
10 | command: npm run test
11 |
12 | e2e-chrome:
13 | image: cypress/included:12.17.3
14 | environment:
15 | - CYPRESS_BASE_URL=http://host.docker.internal:80
16 | - CYPRESS_MAILDEV_URL=http://host.docker.internal:1080
17 | volumes:
18 | - .:/e2e
19 | working_dir: /e2e
20 | command: npm run test --browser chrome
21 |
22 | e2e-firefox:
23 | image: cypress/included:12.17.3
24 | environment:
25 | - CYPRESS_BASE_URL=http://host.docker.internal:80
26 | - CYPRESS_MAILDEV_URL=http://host.docker.internal:1080
27 | volumes:
28 | - .:/e2e
29 | working_dir: /e2e
30 | command: npm run test --browser firefox
31 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "Docker: Attach to Node",
9 | "type": "node",
10 | "request": "attach",
11 | "port": 9229,
12 | "address": "localhost",
13 | "protocol": "inspector",
14 | "remoteRoot": "/app",
15 | "localRoot": "${workspaceFolder}/server",
16 | "restart": true
17 | },
18 | {
19 | "name": "Docker Node.js Launch",
20 | "type": "docker",
21 | "request": "launch",
22 | "preLaunchTask": "docker-run: debug",
23 | "platform": "node",
24 | "node": {
25 | "package": "${workspaceFolder}/server/package.json",
26 | "localRoot": "${workspaceFolder}/server"
27 | }
28 | }
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/client-participation/js/templates/profilePicView.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
15 |
16 |
--------------------------------------------------------------------------------
/client-report/Dockerfile:
--------------------------------------------------------------------------------
1 | # NOTE: This Dockerfile is not actually used by the docker-compose.yml.
2 | # Instead, the file-server Dockerfile builds and serves these assets.
3 | # But this file is still useful for development or deployments that do not use
4 | # the docker compose configuration.
5 |
6 | FROM docker.io/node:18-alpine
7 |
8 | # Set default NODE_ENV to production unless overridden at build time with --build-arg NODE_ENV=development
9 | ARG NODE_ENV
10 | ENV NODE_ENV ${NODE_ENV:-production}
11 |
12 | WORKDIR /app
13 |
14 | RUN apk add git
15 |
16 | COPY package*.json ./
17 |
18 | RUN npm ci --production=false
19 |
20 | COPY . .
21 |
22 | # GIT_HASH is optional and will be set properly when running `make` (see Makefile).
23 | # Or may be passed in at build time with --build-arg GIT_HASH=$(git rev-parse --short HEAD)
24 | ARG GIT_HASH
25 | ARG SERVICE_URL
26 | ENV GIT_HASH ${GIT_HASH:-placeholder}
27 | ENV SERVICE_URL ${SERVICE_URL}
28 |
29 | CMD npm run build:prod
30 |
--------------------------------------------------------------------------------
/server/bin/herokuConfigExport:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
4 |
5 | # usage (unsafe!)
6 | # eval `./bin/herokuConfigExport`
7 |
8 | heroku config --app "$1" | grep ": " | sed "s/[:=] */='/" | sed "s/$/'/" | sed "s/^/export /" | grep -v MATH_ENV
9 |
10 | # Set developer enviroment ("Beta") vars here:
11 | echo "export APPLICATION_NAME=PolisWebServerBeta"
12 | echo "export MATH_ENV=prod"
13 |
14 |
--------------------------------------------------------------------------------
/client-admin/src/components/landers/tos.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import React from 'react'
4 | import StaticLayout from './lander-layout'
5 | import TOSContent from '../../content/tos.md'
6 |
7 | class TOS extends React.Component {
8 | render() {
9 | return (
10 |
11 |
12 |
13 | )
14 | }
15 | }
16 |
17 | export default TOS
18 |
--------------------------------------------------------------------------------
/client-admin/src/strings/strings.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import en_us from './en_us'
4 |
5 | let s = {}
6 |
7 | // TODO port language choosing code
8 | s = en_us
9 |
10 | function f(key) {
11 | // strip whitespace from key
12 | key = key.replace(/\s+$/, '').replace(/^\s+/, '')
13 | if (typeof s[key] === 'undefined') {
14 | return key
15 | }
16 | return s[key]
17 | }
18 |
19 | export default f
20 |
--------------------------------------------------------------------------------
/.github/workflows/test-clojure.yml:
--------------------------------------------------------------------------------
1 | name: Test Math
2 |
3 | on:
4 | push:
5 | # Note: Only configured for client-admin right now.
6 | paths:
7 | - .github/workflows/test-clojure.yml
8 | - math/**
9 | pull_request:
10 | types: ["opened", "reopened", "synchronize"]
11 | paths:
12 | - .github/workflows/test-clojure.yml
13 | - math/**
14 |
15 | jobs:
16 | test-clj:
17 | runs-on: ubuntu-latest
18 | steps:
19 | - uses: actions/checkout@v4
20 |
21 | - name: Prepare java
22 | uses: actions/setup-java@v4
23 | with:
24 | distribution: adopt
25 | java-version: 16.0.2
26 |
27 | - name: Install Clojure tooling
28 | uses: DeLaGuardo/setup-clojure@12.5
29 | with:
30 | cli: 1.10.1.693
31 |
32 | - name: Run Clojure tests
33 | working-directory: math
34 | # Runs all except integration tests which require database and setup/teardown
35 | run: "clojure -M:test"
36 |
--------------------------------------------------------------------------------
/.vscode/polis.code-workspace:
--------------------------------------------------------------------------------
1 | {
2 | "folders": [
3 | {
4 | "name": "polis-root",
5 | "path": ".."
6 | },
7 | {
8 | "name": "client-admin",
9 | "path": "../client-admin"
10 | },
11 | {
12 | "name": "client-participation",
13 | "path": "../client-participation"
14 | },
15 | {
16 | "name": "client-report",
17 | "path": "../client-report"
18 | },
19 | {
20 | "name": "e2e",
21 | "path": "../e2e"
22 | },
23 | {
24 | "name": "file-server",
25 | "path": "../file-server"
26 | },
27 | {
28 | "name": "math",
29 | "path": "../math"
30 | },
31 | {
32 | "name": "server",
33 | "path": "../server"
34 | },
35 | ],
36 | "settings": {
37 | "jest.disabledWorkspaceFolders": [
38 | "polis-root",
39 | "client-admin",
40 | "client-participation",
41 | "client-report",
42 | "e2e",
43 | "file-server",
44 | "math"
45 | ]
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/client-admin/src/components/conversation-admin/no-permission.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import React from 'react'
4 | import strings from '../../strings/strings'
5 |
6 | class NoPermission extends React.Component {
7 | render() {
8 | return (
9 |
10 |
{strings('no_permission')}
11 |
12 | )
13 | }
14 | }
15 |
16 | export default NoPermission
17 |
--------------------------------------------------------------------------------
/client-participation/js/models/user.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Model = require("../model");
4 |
5 | module.exports = Model.extend({
6 | name: "user",
7 | urlRoot: "users",
8 | defaults: {
9 | uid: undefined, // user id
10 | hname: "", // human name (the token "name" returns too many results when grepped)
11 | created: 0,
12 | username: "",
13 | email: ""
14 | }
15 | });
16 |
--------------------------------------------------------------------------------
/math/bin/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
3 |
4 |
5 | while [ 1 ]
6 | do
7 | echo " "
8 | echo "XXXXXXXXXXXXXXXXXX REBOOTING MATH WORKER XXXXXXXXXXXXXXXXXX"
9 | echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
10 | echo " "
11 | timeout -s KILL 14400 clojure -M:run full
12 | done
13 |
--------------------------------------------------------------------------------
/client-admin/src/components/landers/privacy.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import React from 'react'
4 | import StaticLayout from './lander-layout'
5 | import PrivacyContent from '../../content/privacy.md'
6 |
7 | class Privacy extends React.Component {
8 | render() {
9 | return (
10 |
11 |
12 |
13 | )
14 | }
15 | }
16 |
17 | export default Privacy
18 |
--------------------------------------------------------------------------------
/client-participation/js/net/bbFetch.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | function makeOpt(o, opt, dfd) {
4 | return $.extend(opt, {
5 | success: _.bind(dfd.resolveWith, o),
6 | error: _.bind(dfd.rejectWith, o)
7 | });
8 | }
9 | // o is a backbone object
10 | function bbFetch(o, opt) {
11 | var dfd = $.Deferred();
12 | o.fetch(makeOpt(o, opt, dfd));
13 | return dfd.promise();
14 | }
15 |
16 | module.exports = bbFetch;
17 |
--------------------------------------------------------------------------------
/client-participation/js/net/bbDestroy.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | function makeOpt(o, opt, dfd) {
4 | return $.extend(opt, {
5 | success: _.bind(dfd.resolveWith, o),
6 | error: _.bind(dfd.rejectWith, o)
7 | });
8 | }
9 | // o is a backbone object
10 | function bbDestroy(o, opt) {
11 | var dfd = $.Deferred();
12 | o.destroy(makeOpt(o, opt, dfd));
13 | return dfd.promise();
14 | }
15 |
16 | module.exports = bbDestroy;
17 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: eletronic_demoracy_practices # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: ctto.polis # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12 | polar: # Replace with a single Polar username
13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14 | thanks_dev: # Replace with a single thanks.dev username
15 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
16 |
--------------------------------------------------------------------------------
/file-server/nginx/nginx-ssl.site.default.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen [::]:80 ipv6only=off;
3 | listen [::]:443 ipv6only=off ssl http2;
4 | server_name _;
5 |
6 | ssl_certificate /etc/nginx/certs/snakeoil.cert.pem;
7 | ssl_certificate_key /etc/nginx/certs/snakeoil.key.pem;
8 | ssl_session_timeout 10m;
9 | ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
10 | # See: https://github.com/dev-sec/nginx-baseline/blob/af883f35d86ed95a6f41ef7fdfdfc1b25a249273/controls/nginx_spec.rb#L227-L239
11 | ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
12 | ssl_prefer_server_ciphers on;
13 |
14 | location / {
15 | proxy_set_header X-Forwarded-Proto $scheme;
16 | proxy_set_header Host $host;
17 | proxy_pass http://server:5000;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/client-participation/js/models/comment.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Model = require("../model");
4 |
5 | module.exports = Model.extend({
6 | name: "comment",
7 | url: "comments",
8 | urlRoot: "comments",
9 | idAttribute: "tid",
10 | defaults: {
11 | //tid: undefined, // comment id
12 | //pid: undefined, // participant id
13 | //txt: "This is default comment text defined in the model.",
14 | //created: 0
15 | }
16 | });
17 |
--------------------------------------------------------------------------------
/client-participation/js/templates/countBadge.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 | {{! NOTE: the span with the badge class is not in this file because there is a delay before this view is rendered, and the bootstrap tabs render first, and they keep their tab width, not accounting for the width of these badges}}
4 | {{!-- {{#if hideWhenZero}}
5 | {{#if count}}
6 | {{count}}
7 | {{/if}}
8 | {{else}}
9 | {{count}}
10 | {{/if}} --}}
11 | {{count}}
12 |
--------------------------------------------------------------------------------
/client-participation/js/templates/icon_fa_times.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client-report/src/components/framework/Footer.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import React from "react";
4 | import LargeLogo from "./logoLargeShort";
5 |
6 | const Footer = (/*{conversation}*/) => {
7 | return (
8 |
17 | );
18 | }
19 | }
20 |
21 | ReactDOM.render(, document.getElementById("root"));
22 |
--------------------------------------------------------------------------------
/client-participation/js/templates/commentView.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
4 |
5 | {{!-- Comment
6 | --}} {{!-- when you are able to delete comments, uncomment this:
7 | --}}
10 |
11 |
12 | {{txt}}
13 |
14 |
15 |
--------------------------------------------------------------------------------
/client-participation/js/templates/cookiesDisabled.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
4 |
8 |
9 |
Apologies, pol.is requires that cookies be enabled to participate.
10 |
11 |
--------------------------------------------------------------------------------
/client-admin/src/store/index.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import { createStore, applyMiddleware, compose } from 'redux'
4 | import thunk from 'redux-thunk'
5 |
6 | import rootReducer from '../reducers'
7 |
8 | const middleware = [thunk]
9 |
10 | const finalCreateStore = compose(applyMiddleware(...middleware))(createStore)
11 |
12 | const configureStore = function (initialState) {
13 | return finalCreateStore(rootReducer, initialState)
14 | }
15 |
16 | export default configureStore
17 |
--------------------------------------------------------------------------------
/bin/purge-pii.clj:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env -S bb --classpath bin
2 |
3 | (require '[lib.db :as db]
4 | '[clojure.pprint :as pp]
5 | '[honey.sql.helpers :as sqlh])
6 |
7 | ;; Should we delete their conversations as well?
8 | ;; assuming leave IP address
9 | ;; Should maybe make sure we don't have their IP address from before we started saving encrypted
10 |
11 | (defn expunge-record
12 | [table where attrs]
13 | (db/execute!
14 | {:update table
15 | :where where
16 | :set (into {} (map #(vector %1 nil) attrs))}))
17 |
18 | (defn -main [email]
19 | (if-let [uid (db/get-email-uid email)]
20 | (do
21 | (println "Found uid:" uid)
22 | (println "Deleting user data:")
23 | (expunge-record :users [:= :uid uid] [:hname :email])
24 | (println "Deleting participants_extended data:")
25 | (expunge-record :participants_extended [:= :uid uid] [:subscribe_email]))
26 | (println "Could not find uid for email address")))
27 |
28 | (when (= *file* (System/getProperty "babashka.file"))
29 | (apply -main *command-line-args*))
30 |
31 |
32 |
--------------------------------------------------------------------------------
/client-participation/js/lib/PolisModelView.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var eb = require("../eventBus");
4 | var Handlebones = require("handlebones");
5 |
6 | var PolisModelView = Handlebones.ModelView.extend({
7 |
8 | render: function() {
9 | eb.trigger(eb.firstRender);
10 | // this.trigger("beforeRender");
11 | Handlebones.ModelView.prototype.render.apply(this, arguments);
12 | // this.trigger("afterRender");
13 | },
14 |
15 | });
16 |
17 |
18 | module.exports = PolisModelView;
19 |
--------------------------------------------------------------------------------
/client-participation/js/util/assemble.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | function assemble() {
4 | var obj = {};
5 | for (var i = 0; i < arguments.length; i++) {
6 | var candidateKvPairs = arguments[i];
7 | for (var k in candidateKvPairs) {
8 | if (candidateKvPairs.hasOwnProperty(k)) {
9 | if (candidateKvPairs[k] !== undefined) {
10 | obj[k] = candidateKvPairs[k];
11 | }
12 | }
13 | }
14 | }
15 | return obj;
16 | }
17 |
18 | module.exports = assemble;
19 |
--------------------------------------------------------------------------------
/client-admin/src/components/conversations-and-account/conversation.js:
--------------------------------------------------------------------------------
1 | /** @jsx jsx */
2 | import { jsx, Text, Card } from 'theme-ui'
3 | import PropTypes from 'prop-types'
4 |
5 | function Conversation({ c, i, goToConversation }) {
6 | return (
7 |
11 | {c.topic}
12 | {c.description}
13 |
14 | {c.parent_url ? `Embedded on ${c.parent_url}` : null}
15 |
16 | {c.participant_count} participants
17 |
18 | )
19 | }
20 |
21 | Conversation.propTypes = {
22 | c: PropTypes.shape({
23 | topic: PropTypes.string,
24 | description: PropTypes.string,
25 | parent_url: PropTypes.string,
26 | participant_count: PropTypes.number
27 | }),
28 | i: PropTypes.number.isRequired,
29 | goToConversation: PropTypes.func.isRequired
30 | }
31 |
32 | export default Conversation
33 |
--------------------------------------------------------------------------------
/client-participation/js/templates/icon_fa_ban.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client-admin/src/strings/footer.js:
--------------------------------------------------------------------------------
1 | export default {
2 | footer: {
3 | copyright: 'The Authors. All Rights Reserved.',
4 | social: ['https://github.com/pol-is/', 'https://twitter.com/usepolis'],
5 | groups: [
6 | {
7 | heading: 'Company',
8 | links: [
9 | {
10 | title: 'About',
11 | url: 'https://pol.is/company'
12 | },
13 | {
14 | title: 'Blog',
15 | url: 'https://blog.pol.is/'
16 | }
17 | ]
18 | },
19 | {
20 | heading: 'Support',
21 | links: [
22 | {
23 | title: 'FAQ',
24 | url:
25 | 'https://compdemocracy.org/faq'
26 | }
27 | ]
28 | },
29 | {
30 | heading: 'Legal',
31 | links: [
32 | {
33 | title: 'Terms',
34 | url: 'https://pol.is/tos'
35 | },
36 | {
37 | title: 'Privacy',
38 | url: 'https://pol.is/privacy'
39 | }
40 | ]
41 | }
42 | ]
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/client-participation/js/util/shuffleWithSeed.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var RandomWithSeed = require("../util/randomWithSeed");
4 |
5 | module.exports = function(array, seed) {
6 | var seq = new RandomWithSeed(seed);
7 | if (seed === null) {
8 | seq = Math.random;
9 | }
10 | var rand;
11 | var shuffled = array.slice();
12 | _.each(array, function(value, index) {
13 | rand = seq(index);
14 | shuffled[index] = shuffled[rand];
15 | shuffled[rand] = value;
16 | });
17 | return shuffled;
18 | };
19 |
--------------------------------------------------------------------------------
/client-participation/js/views/root.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var LayoutView = require("../layout-view");
4 | var rootTemplate = require("../templates/root.handlebars");
5 |
6 | var RootView = LayoutView.extend({
7 | name: "root",
8 | template: rootTemplate
9 | });
10 | var instance;
11 | RootView.getInstance = function(target) {
12 | if (!instance) {
13 | instance = new RootView();
14 | instance.appendTo(target || document.body);
15 | }
16 | return instance;
17 | };
18 |
19 | module.exports = RootView;
20 |
--------------------------------------------------------------------------------
/docs/ssl.md:
--------------------------------------------------------------------------------
1 |
2 | # SSL
3 |
4 | **Important:** The Docker Compose infrastructure described in the main README uses an insecure, self-signed SSL certificate, which is pre-generated and stored publicly in the source code.
5 | This HTTPS implementation is thus **ONLY suitable for testing.**
6 | Frequently, SSL support is something provided at the hosting layer, and we encourage you to pursue this option when possible.
7 |
8 | Nevertheless, we would like to find a way to streamline this part of the process as much as possible.
9 | There's been [some progress](https://github.com/compdemocracy/polis/issues/289) to that end, and we encourage you to help push it forward if you're able!
10 |
11 | ## Details
12 |
13 | For testing some functionality (e.g., social login via Facebook), some external services must interact with the Polis app via HTTPS.
14 |
15 | To modify these settings, edit `file-server/nginx/nginx-ssl.site.default.conf` before building the `nginx-proxy` docker container:
16 |
17 | ```
18 | edit file-server/nginx/nginx-ssl.site.default.conf
19 | docker compose up --detach --build --no-deps nginx-proxy
20 | ```
21 |
22 |
--------------------------------------------------------------------------------
/client-admin/src/components/landers/password-reset-init-done.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import React from 'react'
4 | import { connect } from 'react-redux'
5 |
6 | import StaticLayout from './lander-layout'
7 |
8 | @connect()
9 | class PasswordResetInitDone extends React.Component {
10 | render() {
11 | return (
12 |
13 |
14 |
Check your email for a password reset link
15 |
16 |
17 | )
18 | }
19 | }
20 |
21 | export default PasswordResetInitDone
22 |
--------------------------------------------------------------------------------
/server/postgres/migrations/archived/db_000010.sql:
--------------------------------------------------------------------------------
1 | -- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | alter table conversations add column use_xid_whitelist BOOLEAN DEFAULT FALSE;
4 |
5 | CREATE TABLE xid_whitelist (
6 | owner INTEGER NOT NULL REFERENCES users(uid),
7 | xid TEXT NOT NULL, -- TODO add constraint to limit length
8 | created BIGINT DEFAULT now_as_millis(),
9 | UNIQUE (owner, xid)
10 | );
11 | CREATE INDEX xid_whitelist_owner_idx ON xid_whitelist USING btree (owner);
12 |
13 | alter table participants_extended add column subscribe_email VARCHAR(256);
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "type": "docker-build",
6 | "label": "docker-build",
7 | "platform": "node",
8 | "dockerBuild": {
9 | "dockerfile": "${workspaceFolder}/server/Dockerfile",
10 | "context": "${workspaceFolder}/server",
11 | "pull": true
12 | },
13 | "node": {
14 | "package": "${workspaceFolder}/server/package.json"
15 | }
16 | },
17 | {
18 | "type": "docker-run",
19 | "label": "docker-run: release",
20 | "dependsOn": ["docker-build"],
21 | "platform": "node",
22 | "node": {
23 | "package": "${workspaceFolder}/server/package.json"
24 | }
25 | },
26 | {
27 | "type": "docker-run",
28 | "label": "docker-run: debug",
29 | "dependsOn": ["docker-build"],
30 | "dockerRun": {
31 | "env": {
32 | "DEBUG": "*",
33 | "NODE_ENV": "development"
34 | }
35 | },
36 | "node": {
37 | "package": "${workspaceFolder}/server/package.json",
38 | "enableDebugging": true
39 | }
40 | }
41 | ]
42 | }
43 |
--------------------------------------------------------------------------------
/client-report/src/index.css:
--------------------------------------------------------------------------------
1 | /*begin http://bl.ocks.org/jensgrubert/7789216 */
2 | .box {
3 | font: 10px sans-serif;
4 | }
5 |
6 | .box line,
7 | .box rect,
8 | .box circle {
9 | fill: steelblue;
10 | stroke: #000;
11 | stroke-width: 1px;
12 | }
13 |
14 | .box .center {
15 | stroke-dasharray: 3,3;
16 | }
17 |
18 | .box .outlier {
19 | fill: none;
20 | stroke: #000;
21 | }
22 |
23 | .axis {
24 | font: 12px sans-serif;
25 | }
26 |
27 | .axis path,
28 | .axis line {
29 | fill: none;
30 | stroke: #000;
31 | shape-rendering: crispEdges;
32 | }
33 |
34 | .x.axis path {
35 | fill: none;
36 | stroke: #000;
37 | shape-rendering: crispEdges;
38 | }
39 | /*end http://bl.ocks.org/jensgrubert/7789216 */
40 |
41 | html, p, div, input, button {
42 | font-family: "Helvetica Neue", "Helvetica", sans-serif;
43 | font-weight: 400;
44 | /*color: rgb(160, 160, 179);*/
45 | }
46 |
47 |
48 |
49 | @media print {
50 | .move-left-20-for-print {
51 | margin-inline-start: -20px;
52 | }
53 | .shrink-for-print-70 {
54 | transform: scale(0.7);
55 | }
56 | .shrink-for-print-50 {
57 | transform: scale(0.5);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/client-participation/js/net/bbSave.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | function makeOpt(o, opt, dfd) {
4 | return $.extend(opt, {
5 | success: function() {
6 | dfd.resolveWith(o, arguments);
7 | },
8 | error: function() {
9 | dfd.rejectWith(o, arguments);
10 | }
11 | });
12 | }
13 | // o is a backbone object
14 | function bbSave(o, attrs, opt) {
15 | var dfd = $.Deferred();
16 | if (!o.save(attrs, makeOpt(o, opt, dfd))) {
17 | dfd.rejectWith(o, "validation failed");
18 | }
19 | return dfd.promise();
20 | }
21 |
22 | module.exports = bbSave;
23 |
--------------------------------------------------------------------------------
/client-participation/js/templates/icon_fa_twitter_16.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client-participation/js/templates/icon_fa_twitter_25.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client-participation/js/util/constants.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | module.exports = {
4 | VIS_TYPE: {
5 | OFF: 0,
6 | PCA: 1,
7 | TOP_COMMENTS: 2,
8 | },
9 | CHARACTER_LIMIT: 140, // we can import tweets, so 140
10 | commentCarouselMinHeight: 135, // based on CHARACTER_LIMIT and font size
11 | REACTIONS: {
12 | AGREE: -1,
13 | PASS: 0,
14 | DISAGREE: 1
15 | },
16 | MOD: {
17 | BAN: -1,
18 | UNMODERATED: 0,
19 | OK: 1
20 | },
21 | FB_APP_ID: process.env.FB_APP_ID,
22 | GA_TRACKING_ID: process.env.GA_TRACKING_ID,
23 | };
24 |
--------------------------------------------------------------------------------
/file-server/nginx/certs/snakeoil.cert.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIC5DCCAcygAwIBAgIJAOOZs2LV5mz6MA0GCSqGSIb3DQEBCwUAMBIxEDAOBgNV
3 | BAMMB3Rlc3QtY2EwHhcNMjAwODE3MjAzNTE5WhcNMjAxMDE2MjAzNTE5WjAWMRQw
4 | EgYDVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
5 | ggEBAKA2k54etm2mhLqkKWIQTBQ8LjZ7x1MFUDjiGdsVkxMgTJqhjXtfm+Eq28++
6 | ot+PuQBLgW9ON9j77Cl3j1Ddr6cl+KZvoWPBrbM7wEDPF7pEdETa5B/UImShPs5Y
7 | xSMpA2iTf3VKpbICKZ07KKBVTTAFFFSamZRP+Z6eacHWPgSTptRubfi+yi7b9vTW
8 | hMGv/Em6JfYumnfiyOs6SVdAYHoQ98BAhaMKXzmVOgoRrI1yF3q1qLSzsiSrjacl
9 | TvHu8mWFMrwyMp4zjF3xo+h4w8e3CJfT7LIkDdvas+JJAJcvJrBGjXiB/SbgFmIC
10 | E43sGzHukOmpLmJ2shZ7tnB8Gl0CAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8E
11 | BAMCBeAwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMBMA0GCSqGSIb3DQEB
12 | CwUAA4IBAQBCGz2kuj38H13spXsv3Aca3U7brDZWAhrSxqcE9rWWMaWevyX0Dpaa
13 | FwzmnjKEx7NdlBEPRVwV1ws41wB8euSndNv4XGa3RGBSW0HS6oUki0ijTPYiKoPv
14 | d+hQHGb+2hYJDFNyn0EQ0ss+4fgoFwUEKM6MOjHfVDZ50lcqiXT5mhoQyPrj6OwZ
15 | Fu2hJDBBLfV71To5U4t49SDq6MZ4DxQFlJDdPqALyoEiLd38TdW9gWtbdfPCm478
16 | 2XBa2PwDtFImS8zgJCtQ9loLjN2OvkqL5QO37RPrK8hdavAsc1XGM8CsvhgEgTc7
17 | QPvSByCkAbqORNAm+WQ4flvEUfvw2ov8
18 | -----END CERTIFICATE-----
19 |
--------------------------------------------------------------------------------
/client-admin/src/components/conversation-admin/report/reports.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import React from 'react'
4 |
5 | import ReportsList from './reports-list'
6 | import { Switch, Route } from 'react-router-dom'
7 |
8 | class Reports extends React.Component {
9 | render() {
10 | return (
11 |
12 |
13 |
14 |
15 |
16 | )
17 | }
18 | }
19 |
20 | export default Reports
21 |
22 | //
23 | //
24 | //
25 |
--------------------------------------------------------------------------------
/client-participation/js/templates/voteMore.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{#if oneMore}}
9 | Keep voting!
10 | {{/if}}
11 | {{#if twoMore}}
12 | Welcome! Get started by voting on a couple of comments
13 | {{/if}}
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/client-participation/js/templates/icon_fa_check_circle.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
4 |
--------------------------------------------------------------------------------
/e2e/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "polis-e2e",
3 | "version": "1.0.0",
4 | "description": "End-to-End test suite for polis, using Cypress.js",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "cypress open",
8 | "test": "cypress run --spec 'cypress/e2e/!(third-party)/**/*.cy.js'",
9 | "test:all": "cypress run --spec 'cypress/**/*.cy.js'",
10 | "e2e": "npm test",
11 | "e2e:chrome": "npm test -- --browser chrome",
12 | "cy:run": "cypress run",
13 | "cy:open": "cypress open",
14 | "lint": "eslint .",
15 | "lint:fix": "eslint . --fix",
16 | "prettier": "prettier --write .",
17 | "build:embed": "node build-embed.js",
18 | "build:integrated": "node build-integrated.js"
19 | },
20 | "author": "",
21 | "license": "ISC",
22 | "dependencies": {
23 | "@faker-js/faker": "^8.2.0",
24 | "cypress": "^13.5.0",
25 | "cypress-terminal-report": "^5.3.9",
26 | "yargs": "^17.7.2"
27 | },
28 | "devDependencies": {
29 | "eslint": "^8.53.0",
30 | "eslint-config-prettier": "^9.0.0",
31 | "eslint-plugin-cypress": "^2.15.1",
32 | "eslint-plugin-mocha": "^10.2.0",
33 | "prettier": "^3.0.3"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/client-participation/js/templates/icon_fa_asterisk.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client-participation/js/templates/conversation-stats-header.handlebars:
--------------------------------------------------------------------------------
1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 . --}}
2 |
3 |
20 |
--------------------------------------------------------------------------------
/client-admin/src/components/landers/lander-header.js:
--------------------------------------------------------------------------------
1 | /** @jsx jsx */
2 | import { Component } from 'react'
3 | import { Flex, Box, jsx } from 'theme-ui'
4 |
5 | import { Link } from 'react-router-dom'
6 | import Logomark from '../framework/logomark'
7 |
8 | class Header extends Component {
9 | render() {
10 | return (
11 |
12 |
20 |
21 |
22 |
26 | Polis
27 |
28 |
29 |
30 |
31 | Sign in
32 |
33 |
34 |
35 |
36 | )
37 | }
38 | }
39 |
40 | export default Header
41 |
--------------------------------------------------------------------------------
/client-report/src/components/participantsGraph/hull.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import React from "react";
4 | // import * as globals from "../globals";
5 | import { curveLinear, line } from "d3-shape";
6 |
7 | const Hull = ({hull}) => {
8 | const curveLine = line().curve(curveLinear);
9 | const pathString = curveLine(hull.hull);
10 |
11 | return (
12 |
18 | );
19 | };
20 |
21 | export default Hull;
22 |
23 | // fill={"rgba(0,0,0,.2)" /*globals.groupColor(hull.group[0].gid)*/}
24 |
--------------------------------------------------------------------------------
/docs/upgrading.md:
--------------------------------------------------------------------------------
1 | # Upgrade Guide
2 |
3 | ## Configuration Changes (Q1 2023)
4 |
5 | `polis.config.template.js` and `polis.config.js` files are removed and no longer used.
6 | `docker-dev.env` and `docker-db-dev.env` files are removed and no longer used.
7 | `.env` and/or `prod.env` are now treated as the source of truth for the application and are ignored by git.
8 | See `example.env` for default values.
9 |
10 | Please read [configuration.md](./configuration.md) for more information and a complete list of configuration values.
11 |
12 | Values that have been renamed or replaced:
13 |
14 | - **`DATABASE_FOR_READS_NAME`** has been replaced by **`READ_ONLY_DATABASE_URL`**
15 | - **`PORT`** has been renamed **`API_SERVER_PORT`**
16 | - **`SERVICE_HOSTNAME`** has been renamed to **`EMBED_SERVICE_HOSTNAME`**
17 | - **`STATIC_FILES_ADMINDASH_PORT`** has been renamed to **`STATIC_FILES_ADMIN_PORT`**
18 |
19 | New values:
20 |
21 | - **`API_DEV_HOSTNAME`**
22 | - **`API_PROD_HOSTNAME`**
23 | - **`ENABLE_TWITTER_WIDGETS`**
24 | - **`GA_TRACKING_ID`**
25 | - **`POSTGRES_HOST`**
26 | - **`POSTGRES_PORT`**
27 | - **`SERVER_ENV_FILE`**
28 | - **`SERVER_LOG_LEVEL`**
29 | - **`SERVER_LOG_TO_FILE`**
30 | - **`STATIC_FILES_PARTICIPATION_PORT`**
31 |
--------------------------------------------------------------------------------
/server/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | es2021: true,
4 | node: true,
5 | "jest/globals": true
6 | },
7 | extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
8 | overrides: [
9 | {
10 | files: ["bin/*.js"],
11 | rules: {
12 | "no-console": "off",
13 | }
14 | }
15 | ],
16 | parser: "@typescript-eslint/parser",
17 | parserOptions: {
18 | ecmaVersion: "latest",
19 | sourceType: "module",
20 | },
21 | plugins: ["@typescript-eslint", "jest"],
22 | rules: {
23 | "@typescript-eslint/ban-ts-comment": 1,
24 | "@typescript-eslint/ban-types": 1,
25 | "@typescript-eslint/no-empty-function": 1,
26 | "@typescript-eslint/no-explicit-any": 1,
27 | "@typescript-eslint/no-inferrable-types": 1,
28 | "@typescript-eslint/no-var-requires": 1,
29 | "no-case-declarations": 1,
30 | 'no-console': 2,
31 | "no-constant-condition": 1,
32 | "no-empty": 1,
33 | "no-extra-boolean-cast": 1,
34 | "no-prototype-builtins": 1,
35 | "no-useless-escape": 1,
36 | "no-var": 1,
37 | "prefer-const": 1,
38 | "prefer-rest-params": 1,
39 | "prefer-spread": 1
40 | },
41 | ignorePatterns: ["dist"]
42 | };
43 |
--------------------------------------------------------------------------------
/client-admin/src/components/conversation-admin/stats/conversation-stats-number-card.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import React from 'react'
4 | import PropTypes from 'prop-types'
5 | import { Text, Flex } from 'theme-ui'
6 |
7 | class NumberCard extends React.Component {
8 | render() {
9 | return (
10 |
11 | {this.props.datum}
12 | {this.props.subheading}
13 |
14 | )
15 | }
16 | }
17 |
18 | NumberCard.propTypes = {
19 | datum: PropTypes.number,
20 | subheading: PropTypes.string
21 | }
22 |
23 | export default NumberCard
24 |
--------------------------------------------------------------------------------
/client-admin/src/components/interior-header.js:
--------------------------------------------------------------------------------
1 | /** @jsx jsx */
2 | import React from 'react'
3 | import { Box, jsx } from 'theme-ui'
4 | import { Link } from 'react-router-dom'
5 | import Logomark from './framework/logomark'
6 |
7 | class InteriorHeader extends React.Component {
8 | render() {
9 | return (
10 |
11 |
23 |
24 |
28 | Polis
29 |
30 |
31 | sign out
32 |
33 |
34 | {this.props.children}
35 |
36 | )
37 | }
38 | }
39 |
40 | export default InteriorHeader
41 |
--------------------------------------------------------------------------------
/client-participation/js/models/rule.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Model = require("../model");
4 |
5 | module.exports = Model.extend({
6 | name: "rule",
7 | urlRoot: "rules",
8 | idAttribute: "rid",
9 | defaults: {
10 | // rid: 0
11 | // data: null // A reference to the model which the rule refers to
12 | // setting: null // The setting of the rule:
13 | // for example [-1,0] would be AGREE OR PASS
14 | // for example [234, 235] would mean CHOICES WITH PMAID 234 OR 235
15 | // for example [98101, 98102] would be a subset of zipcodes
16 | //created: 0
17 | }
18 | });
19 |
--------------------------------------------------------------------------------
/client-participation/js/views/voteMoreView.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Handlebones = require("handlebones");
4 | var template = require("../templates/voteMore.handlebars");
5 |
6 | module.exports = Handlebones.ModelView.extend({
7 | name: "vote-more-view",
8 | template: template,
9 | events: {
10 | },
11 | context: function() {
12 | var ctx = Handlebones.ModelView.prototype.context.apply(this, arguments);
13 | ctx.oneMore = ctx.remaining === 1;
14 | ctx.twoMore = ctx.remaining === 2;
15 | return ctx;
16 | },
17 | initialize: function(options) {
18 | Handlebones.ModelView.prototype.initialize.apply(this, arguments);
19 | }
20 | });
21 |
--------------------------------------------------------------------------------
/e2e/cypress/fixtures/users.json:
--------------------------------------------------------------------------------
1 | {
2 | "moderator": {
3 | "name": "Test Moderator",
4 | "email": "moderator@polis.test",
5 | "password": "Te$tP@ssw0rd*"
6 | },
7 | "participant": {
8 | "name": "Test Participant 01",
9 | "email": "participant01@polis.test",
10 | "password": "Te$tP@ssw0rd*"
11 | },
12 | "participant2": {
13 | "name": "Test Participant 02",
14 | "email": "participant02@polis.test",
15 | "password": "Te$tP@ssw0rd*"
16 | },
17 | "participant3": {
18 | "name": "Test Participant 03",
19 | "email": "participant03@polis.test",
20 | "password": "Te$tP@ssw0rd*"
21 | },
22 | "participant4": {
23 | "name": "Test Participant 04",
24 | "email": "participant04@polis.test",
25 | "password": "Te$tP@ssw0rd*"
26 | },
27 | "participant5": {
28 | "name": "Test Participant 05",
29 | "email": "participant05@polis.test",
30 | "password": "Te$tP@ssw0rd*"
31 | },
32 | "participant6": {
33 | "name": "Test Participant 06",
34 | "email": "participant06@polis.test",
35 | "password": "Te$tP@ssw0rd*"
36 | },
37 | "participant7": {
38 | "name": "Test Participant 07",
39 | "email": "participant07@polis.test",
40 | "password": "Te$tP@ssw0rd*"
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/client-admin/src/reducers/stats.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import * as types from '../actions'
4 |
5 | const conversation_stats = (
6 | state = {
7 | loading: false,
8 | conversation_stats: {}
9 | },
10 | action
11 | ) => {
12 | switch (action.type) {
13 | case types.REQUEST_CONVERSATION_STATS:
14 | return Object.assign({}, state, {
15 | loading: true
16 | })
17 | case types.RECEIVE_CONVERSATION_STATS:
18 | return Object.assign({}, state, {
19 | loading: false,
20 | conversation_stats: action.data
21 | })
22 | default:
23 | return state
24 | }
25 | }
26 |
27 | export default conversation_stats
28 |
--------------------------------------------------------------------------------
/client-admin/src/reducers/mod_comments_accepted.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import * as types from '../actions'
4 |
5 | const accepted_comments = (
6 | state = {
7 | loading: false,
8 | accepted_comments: null
9 | },
10 | action
11 | ) => {
12 | switch (action.type) {
13 | case types.REQUEST_ACCEPTED_COMMENTS:
14 | return Object.assign({}, state, {
15 | loading: true
16 | })
17 | case types.RECEIVE_ACCEPTED_COMMENTS:
18 | return Object.assign({}, state, {
19 | loading: false,
20 | accepted_comments: action.data
21 | })
22 | default:
23 | return state
24 | }
25 | }
26 |
27 | export default accepted_comments
28 |
--------------------------------------------------------------------------------
/client-admin/src/reducers/mod_comments_rejected.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import * as types from '../actions'
4 |
5 | const rejected_comments = (
6 | state = {
7 | loading: false,
8 | rejected_comments: null
9 | },
10 | action
11 | ) => {
12 | switch (action.type) {
13 | case types.REQUEST_REJECTED_COMMENTS:
14 | return Object.assign({}, state, {
15 | loading: true
16 | })
17 | case types.RECEIVE_REJECTED_COMMENTS:
18 | return Object.assign({}, state, {
19 | loading: false,
20 | rejected_comments: action.data
21 | })
22 | default:
23 | return state
24 | }
25 | }
26 |
27 | export default rejected_comments
28 |
--------------------------------------------------------------------------------
/client-participation/api/twitterAuthReturn.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Please wait ...
6 |
29 |
30 |
31 |
32 |
33 | Please close this tab to continue to pol.is
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/client-admin/src/reducers/mod_ptpt_hidden.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import * as types from '../actions'
4 |
5 | const hidden_participants = (
6 | state = {
7 | loading: false,
8 | hidden_participants: null
9 | },
10 | action
11 | ) => {
12 | switch (action.type) {
13 | case types.REQUEST_HIDDEN_PARTICIPANTS:
14 | return Object.assign({}, state, {
15 | loading: true
16 | })
17 | case types.RECEIVE_HIDDEN_PARTICIPANTS:
18 | return Object.assign({}, state, {
19 | loading: false,
20 | hidden_participants: action.data
21 | })
22 | default:
23 | return state
24 | }
25 | }
26 |
27 | export default hidden_participants
28 |
--------------------------------------------------------------------------------
/client-participation/js/stores/currentUser.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Backbone = require("backbone");
4 | var $ = require("jquery");
5 |
6 | var preloadHelper = require("../util/preloadHelper");
7 | var currentUserModel = new Backbone.Model();
8 |
9 | currentUserModel.update = function() {
10 | var that = this;
11 | return preloadHelper.firstUserPromise.then(function(user) {
12 | // set up global userObject
13 | window.userObject = $.extend(window.userObject, user);
14 |
15 | window.userObject.uid = void 0;
16 |
17 | // migrating to a singleton model instead.
18 | that.set(user);
19 | return user;
20 | });
21 | };
22 |
23 | module.exports = currentUserModel;
24 |
--------------------------------------------------------------------------------
/client-participation/public/twitterAuthReturn.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Please wait ...
6 |
29 |
30 |
31 |
32 |
33 | Please close this tab to continue to pol.is
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/client-admin/src/reducers/mod_ptpt_default.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import * as types from '../actions'
4 |
5 | const default_participants = (
6 | state = {
7 | loading: false,
8 | default_participants: null
9 | },
10 | action
11 | ) => {
12 | switch (action.type) {
13 | case types.REQUEST_DEFAULT_PARTICIPANTS:
14 | return Object.assign({}, state, {
15 | loading: true
16 | })
17 | case types.RECEIVE_DEFAULT_PARTICIPANTS:
18 | return Object.assign({}, state, {
19 | loading: false,
20 | default_participants: action.data
21 | })
22 | default:
23 | return state
24 | }
25 | }
26 |
27 | export default default_participants
28 |
--------------------------------------------------------------------------------
/client-admin/src/reducers/mod_ptpt_featured.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import * as types from '../actions'
4 |
5 | const featured_participants = (
6 | state = {
7 | loading: false,
8 | featured_participants: null
9 | },
10 | action
11 | ) => {
12 | switch (action.type) {
13 | case types.REQUEST_FEATURED_PARTICIPANTS:
14 | return Object.assign({}, state, {
15 | loading: true
16 | })
17 | case types.RECEIVE_FEATURED_PARTICIPANTS:
18 | return Object.assign({}, state, {
19 | loading: false,
20 | featured_participants: action.data
21 | })
22 | default:
23 | return state
24 | }
25 | }
26 |
27 | export default featured_participants
28 |
--------------------------------------------------------------------------------
/math/test/utils_test.clj:
--------------------------------------------------------------------------------
1 | ;; Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | (ns utils-test
4 | (:require [clojure.test :refer :all]
5 | [polismath.utils :refer :all]))
6 |
7 |
8 | (deftest apply-kwargs-test
9 | (letfn [(fun [a b & {:keys [c d] :as kw-args}]
10 | {:a a :b b :c c :d d :kw-args kw-args})]
11 | (let [res (apply-kwargs fun "this" "that" {:c "crap" :d "stuff" :m "more"})]
12 | (testing "should pass through regular args"
13 | (is (= (res :a) "this"))
14 | (is (= (res :b) "that")))
15 | (testing "should pass through kw-args"
16 | (is (= (res :c) "crap"))
17 | (is (= (res :d) "stuff"))
18 | (is (= ((res :kw-args) :m) "more"))))))
19 |
20 |
21 |
--------------------------------------------------------------------------------
/client-admin/src/reducers/mod_comments_unmoderated.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import * as types from '../actions'
4 |
5 | const unmoderated_comments = (
6 | state = {
7 | loading: false,
8 | unmoderated_comments: null
9 | },
10 | action
11 | ) => {
12 | switch (action.type) {
13 | case types.REQUEST_UNMODERATED_COMMENTS:
14 | return Object.assign({}, state, {
15 | loading: true
16 | })
17 | case types.RECEIVE_UNMODERATED_COMMENTS:
18 | return Object.assign({}, state, {
19 | loading: false,
20 | unmoderated_comments: action.data
21 | })
22 | default:
23 | return state
24 | }
25 | }
26 |
27 | export default unmoderated_comments
28 |
--------------------------------------------------------------------------------
/client-participation/css/polis/modules/_legend.scss:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | #legendRoot {
4 | border-bottom-right-radius: 7px;
5 | border-bottom-left-radius: 7px;
6 | background-color: white;
7 | position: relative;
8 |
9 | }
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | /*XS XS XS XS XS XS XS */
19 | /* @screen-sm-min */
20 | @media(max-width:767px){
21 |
22 | }
23 |
24 | /*SM SM SM SM SM SM SM */
25 | /* @screen-sm-min */
26 | @media(min-width:768px){
27 |
28 | }
29 |
30 | /*MD MD MD MD MD MD MD MD */
31 | /* @screen-md-min */
32 | @media(min-width:992px){
33 |
34 |
35 | }
36 |
37 | /*LG LG LG LG LG LG LG LG */
38 | /* @screen-lg-min */
39 | @media(min-width:1200px){
40 |
41 |
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/client-participation/css/polis/modules/_accordion.scss:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | // ACCORDION
4 |
5 | .Accordion {
6 | margin-bottom: $default-whitespace;
7 | padding-top: $default-whitespace;
8 | border-top: 1px solid $default-border-color;
9 |
10 | &:last-child {
11 | padding-bottom: $default-whitespace;
12 | border-bottom: 1px solid $default-border-color;
13 | }
14 |
15 | & > *:last-child {
16 | margin-bottom: 0;
17 | }
18 | }
19 |
20 | .Accordion-toggle {
21 | margin-inline-end: 10px;
22 |
23 | color: $dark-gray;
24 | }
25 |
26 | .Accordion-content {
27 | padding-top: $default-whitespace;
28 | margin-inline-start: $default-whitespace;
29 |
30 | font-family: $serif-font;
31 | }
32 |
--------------------------------------------------------------------------------
/client-participation/css/polis/modules/_notifications.scss:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | // NOTIFICATIONS
4 | //
5 |
6 | .Notification {
7 | margin-bottom: $default-whitespace;
8 | padding: 0.75em 1em;
9 | border-radius: 4px;
10 | }
11 |
12 | .Notification--danger {
13 | background-color: $danger-bg-color;
14 | color: $danger-text-color;
15 | }
16 |
17 | .Notification--positive {
18 | background-color: $positive-bg-color;
19 | color: $positive-text-color;
20 | }
21 |
22 | .Notification--warning {
23 | background-color: $warning-bg-color;
24 | color: $warning-text-color;
25 | border: 1px solid $default-border-color;
26 | }
27 |
28 | .WarningIcon {
29 | margin-inline-end: 5px;
30 |
31 | color: $brand-color;
32 | }
33 |
--------------------------------------------------------------------------------
/client-participation/js/models/vote.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var Model = require("../model");
4 |
5 | module.exports = Model.extend({
6 | name: "vote",
7 | idAttribute: "tid", // assumes it is used in a context where conversation_id=current conversation and pid=self
8 | defaults: {
9 | commentText: "",
10 | tid: undefined, // commenTTTT id... must be provided by the view, because multiple are sent over at a time...
11 | pid: undefined, // PPPParticipant id -- this is a unique id every participant has in every convo that starts at 0
12 | conversation_id: undefined, // converSation id
13 | votes: undefined, // agree = -1, pass = 0, disagree = 1
14 | participantStarred: false
15 | }
16 | });
17 |
--------------------------------------------------------------------------------
/client-report/src/store/index.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import { createStore, applyMiddleware, compose } from "redux";
4 | import thunk from "redux-thunk";
5 |
6 | import rootReducer from "../reducers";
7 |
8 | const middleware = [thunk];
9 |
10 | let finalCreateStore;
11 |
12 | if (process.env.NODE_ENV === "production") {
13 | finalCreateStore = applyMiddleware(...middleware)(createStore);
14 | } else {
15 | finalCreateStore = compose(
16 | applyMiddleware(...middleware),
17 | window.devToolsExtension ? window.devToolsExtension() : (f) => f
18 | )(createStore);
19 | }
20 |
21 | const configureStore = function (initialState) {
22 | return finalCreateStore(rootReducer, initialState);
23 | };
24 |
25 | export default configureStore;
26 |
--------------------------------------------------------------------------------
/client-admin/public/index.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Polis
5 |
6 |
7 |
8 |
9 |
10 |
11 |
15 |
18 |
19 |
20 | <% if (enableTwitterWidgets) { %>
21 |
22 | <% } %>
23 |
24 | <% if (fbAppId) { %>
25 |
26 |
35 |
36 | <% } %>
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/bin/add-xid-whitelist.clj:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env -S bb --classpath bin
2 |
3 | (require '[lib.db :as db]
4 | '[clojure.java.io :as io]
5 | '[clojure.string :as str])
6 |
7 | (def batch-size 50)
8 |
9 | (defn xid-seq [filename]
10 | (map
11 | (fn [line] (first (str/split line #",")))
12 | (line-seq (io/reader filename))))
13 |
14 | (defn xid-record [owner xid]
15 | {:owner owner
16 | :xid xid})
17 |
18 | (defn resolve-owner-id [{:as opts-map :strs [--owner --owner-email]}]
19 | (if --owner
20 | (Integer/parseInt --owner)
21 | (db/get-email-uid --owner-email)))
22 |
23 | (defn -main [& {:as opts-map :strs [--owner --owner-email --xid-file]}]
24 | (let [xids (xid-seq --xid-file)
25 | owner-id (resolve-owner-id opts-map)]
26 | (loop [xids-batch (take batch-size xids)
27 | xids-rest (drop batch-size xids)]
28 | (when (seq xids-batch)
29 | (db/upsert! :xid_whitelist
30 | :xid_whitelist_owner_xid_key
31 | (map (partial xid-record owner-id)
32 | xids-batch)))
33 | (when (seq xids-rest)
34 | (recur (take batch-size xids-rest)
35 | (drop batch-size xids-rest))))
36 | (println "Done")))
37 |
38 |
39 | (when (= *file* (System/getProperty "babashka.file"))
40 | (apply -main *command-line-args*))
41 |
--------------------------------------------------------------------------------
/client-participation/css/polis/modules/_share.scss:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 |
4 | .share_page_url {
5 | font-size: 40px;
6 | }
7 |
8 | /*XS XS XS XS XS XS XS */
9 | /* @screen-sm-min */
10 | @media(max-width:767px){
11 |
12 | .share_page_url {
13 | font-size: 20px;
14 | }
15 |
16 | }
17 |
18 | /*SM SM SM SM SM SM SM */
19 | /* @screen-sm-min */
20 | @media(min-width:768px){
21 |
22 | // #vis_sibling_bottom {
23 | // margin-top: 30px;
24 | // }
25 |
26 | .share_page_url {
27 | font-size: 40px;
28 | }
29 | }
30 |
31 | /*MD MD MD MD MD MD MD MD */
32 | /* @screen-md-min */
33 | @media(min-width:992px){
34 |
35 |
36 |
37 | }
38 |
39 | /*LG LG LG LG LG LG LG LG */
40 | /* @screen-lg-min */
41 | @media(min-width:1200px){
42 |
43 |
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/e2e/cypress/e2e/third-party/comment-translation.cy.js:
--------------------------------------------------------------------------------
1 | describe('Comment translation', function () {
2 | const commentFrench = 'Cette déclaration est en français.'
3 | const commentEnglish = 'This statement is in French.'
4 |
5 | before(function () {
6 | cy.createConvo().then(() => {
7 | cy.seedComment(this.convoId, commentFrench)
8 | })
9 | })
10 |
11 | it('prevents translation when comment already in browser language', function () {
12 | cy.ensureUser()
13 | cy.openTranslated(this.convoId, 'fr')
14 |
15 | cy.contains('p', commentFrench).should('exist')
16 | cy.get('button#showTranslationButtonVoteView').should('not.exist')
17 | })
18 |
19 | it('allows translation when comment not in browser language', function () {
20 | cy.ensureUser()
21 | cy.openTranslated(this.convoId, 'en')
22 |
23 | cy.contains('p', commentFrench).should('exist')
24 |
25 | cy.get('button#showTranslationButtonVoteView').should('exist')
26 | cy.contains('p', commentEnglish).should('not.exist')
27 |
28 | // Enable translations.
29 | cy.get('button#showTranslationButtonVoteView').click()
30 | cy.contains('p', commentEnglish).should('exist')
31 |
32 | // Disable translations.
33 | cy.get('button#hideTranslationButtonVoteView').click()
34 | cy.contains('p', commentEnglish).should('not.exist')
35 | })
36 | })
37 |
--------------------------------------------------------------------------------
/client-report/src/util/dataUtils.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | import _ from "lodash";
4 |
5 |
6 | function getVoteTotals(math_main) {
7 | var x = {};
8 | var gv = math_main["group-votes"];
9 | _.each(gv, function(data/*, gid*/) {
10 | _.each(data.votes, function(counts, tid) {
11 | var z = x[tid] = x[tid] || {agreed:0, disagreed:0, saw:0};
12 | z.agreed += counts.A;
13 | z.disagreed += counts.D;
14 | z.saw += counts.S;
15 | });
16 | });
17 | _.each(x, function(z) {
18 | z.pctAgreed = z.agreed / z.saw;
19 | z.pctDisagreed = z.disagreed / z.saw;
20 | z.pctVoted = (z.saw - z.disagreed - z.agreed) / z.saw;
21 | });
22 | return x;
23 | }
24 |
25 | const dataUtils = {
26 | getVoteTotals: getVoteTotals,
27 | };
28 | export default dataUtils;
29 |
30 |
--------------------------------------------------------------------------------
/client-participation/js/util/popoverEach.js:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | var $ = require("jquery");
4 |
5 |
6 | // not sure about these
7 | require("bootstrap-sass/assets/javascripts/bootstrap/tooltip");
8 | require("bootstrap-sass/assets/javascripts/bootstrap/popover");
9 |
10 |
11 | var originalPopover = $.fn.popover;
12 | var popoverTargets = [];
13 |
14 | $.fn.popover = function() {
15 | if (arguments[0] === "show") {
16 | popoverTargets.push(this);
17 | }
18 | return originalPopover.apply(this, arguments);
19 | };
20 |
21 | // Pass in a popover command, like "hide" or "destroy"
22 | function each() {
23 | for (var i = 0; i < popoverTargets.length; i++) {
24 | var el = popoverTargets[i];
25 | el.popover.apply(el, arguments);
26 | }
27 | }
28 |
29 |
30 | module.exports = each;
31 |
--------------------------------------------------------------------------------
/client-report/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | pol.is report
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/client-participation/css/polis/modules/_navigation.scss:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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 .
2 |
3 | // NAVIGATION
4 | // styles for the navigation bar or nav or navbar
5 | //
6 | // .primaryNav