diff --git a/.babelrc b/.babelrc
index 9fe4b349..bc2b0e31 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,5 +1,5 @@
{
- "presets": ["es2015", "stage-2"],
- "plugins": ["transform-runtime", "lodash"],
+ "presets": ["es2015", "stage-2", "env"],
+ "plugins": ["transform-runtime", "lodash", "transform-vue-jsx"],
"comments": false
}
diff --git a/.eslintrc.js b/.eslintrc.js
index 8e6549e5..800f9a4f 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -11,7 +11,7 @@ module.exports = {
'html'
],
// add your custom rules here
- 'rules': {
+ rules: {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
diff --git a/.gitignore b/.gitignore
index faf39252..479d57c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ test/unit/coverage
test/e2e/reports
selenium-debug.log
.idea/
+config/local.json
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 694b77f9..6c83a123 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,32 +3,10 @@
# https://hub.docker.com/r/library/node/tags/
image: node:7
-before_script:
- # Install ssh-agent if not already installed, it is required by Docker.
- # (change apt-get to yum if you use a CentOS-based image)
- - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
-
- # Run ssh-agent (inside the build environment)
- - eval $(ssh-agent -s)
-
- # For Docker builds disable host key checking. Be aware that by adding that
- # you are suspectible to man-in-the-middle attacks.
- # WARNING: Use this only with the Docker executor, if you use it with shell
- # you will overwrite your user's SSH config.
- - mkdir -p ~/.ssh
- - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
-
-# This folder is cached between builds
-# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
-#cache:
-# paths:
-# - node_modules/
-
stages:
- lint
- build
- test
- - deploy
lint:
stage: lint
@@ -50,14 +28,3 @@ build:
artifacts:
paths:
- dist/
-
-deploy:
- stage: deploy
- environment: dev
- only:
- - develop
- script:
- - yarn
- - npm run build
- - ssh-add <(echo "$SSH_PRIVATE_KEY")
- - scp -r dist/* pleroma@tenshi.heldscal.la:~/pleroma
diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md
new file mode 100644
index 00000000..924c38da
--- /dev/null
+++ b/BREAKING_CHANGES.md
@@ -0,0 +1,10 @@
+# v1.0
+## Removed features/radically changed behavior
+### minimalScopesMode
+As of !633, `scopeOptions` is no longer available and instead is changed for `minimalScopesMode` (default: `false`)
+
+Reasoning is that scopeOptions option originally existed mostly as a backwards-compatibility with GNU Social which only had `public` scope available and using scope selector would''t work. Since at some point we dropped GNU Social support, this option was mostly a nuisance (being default `false`'), however some people think scopes are an annoyance to a certain degree and want as less of that feature as possible.
+
+Solution - to only show minimal set among: *Direct*, *User default* and *Scope of post replying to*. This also makes it impossible to reply to a DM with a non-DM post from UI.
+
+*This setting is admin-default, user-configurable. Admin can choose different default for their instance but user can override it.*
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 3673b8b7..d7c217ce 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -8,3 +8,4 @@ Contributors of this project.
- hakui (hakui@freezepeach.xyz): CSS and styling
- shpuld (shpuld@shitposter.club): CSS and styling
- Vincent Guth (https://unsplash.com/photos/XrwVIFy6rTw): Background images.
+- hj (hj@shigusegubu.club): Code
diff --git a/README.md b/README.md
index 5a3e2a4b..889f0837 100644
--- a/README.md
+++ b/README.md
@@ -6,11 +6,12 @@
# For Translators
-To translate Pleroma, add your language to [src/i18n/messages.js](https://git.pleroma.social/pleroma/pleroma-fe/blob/develop/src/i18n/messages.js). Pleroma will set your language by your browser locale, but you can temporarily force it in the code by changing the locale in main.js.
+To translate Pleroma-FE, add your language to [src/i18n/messages.js](https://git.pleroma.social/pleroma/pleroma-fe/blob/develop/src/i18n/messages.js). Pleroma-FE will set your language by your browser locale, but you can temporarily force it in the code by changing the locale in main.js.
# FOR ADMINS
-You don't need to build Pleroma yourself. Check out https://git.pleroma.social/pleroma/pleroma-fe/wikis/dual-boot-with-qvitter to see how to run Pleroma and Qvitter at the same time.
+You don't need to build Pleroma-FE yourself. Those using the Pleroma backend will be able to use it out of the box.
+For the GNU social backend, check out https://git.pleroma.social/pleroma/pleroma-fe/wikis/dual-boot-with-qvitter to see how to run Pleroma-FE and Qvitter at the same time.
## Build Setup
@@ -29,6 +30,21 @@ npm run build
npm run unit
```
+# For Contributors:
+
+You can create file `/config/local.json` (see [example](https://git.pleroma.social/pleroma/pleroma-fe/blob/develop/config/local.example.json)) to enable some convenience dev options:
+
+* `target`: makes local dev server redirect to some existing instance's BE instead of local BE, useful for testing things in near-production environment and searching for real-life use-cases.
+* `staticConfigPreference`: makes FE's `/static/config.json` take preference of BE-served `/api/statusnet/config.json`. Only works in dev mode.
+
+FE Build process also leaves current commit hash in global variable `___pleromafe_commit_hash` so that you can easily see which pleroma-fe commit instance is running, also helps pinpointing which commit was used when FE was bundled into BE.
+
# Configuration
-Edit config.json for configuration. scopeOptionsEnabled gives you input fields for CWs and the scope settings.
+Edit config.json for configuration.
+
+## Options
+
+### Login methods
+
+```loginMethod``` can be set to either ```password``` (the default) or ```token```, which will use the full oauth redirection flow, which is useful for SSO situations.
diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js
index 7bba3a10..e07bb7a2 100644
--- a/build/webpack.base.conf.js
+++ b/build/webpack.base.conf.js
@@ -2,6 +2,7 @@ var path = require('path')
var config = require('../config')
var utils = require('./utils')
var projectRoot = path.resolve(__dirname, '../')
+var ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin')
var env = process.env.NODE_ENV
// check env & config/index.js to decide weither to enable CSS Sourcemaps for the
@@ -54,7 +55,7 @@ module.exports = {
loader: 'vue'
},
{
- test: /\.js$/,
+ test: /\.jsx?$/,
loader: 'babel',
include: projectRoot,
exclude: /node_modules\/(?!tributejs)/
@@ -91,5 +92,11 @@ module.exports = {
browsers: ['last 2 versions']
})
]
- }
+ },
+ plugins: [
+ new ServiceWorkerWebpackPlugin({
+ entry: path.join(__dirname, '..', 'src/sw.js'),
+ filename: 'sw-pleroma.js'
+ })
+ ]
}
diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js
index 7e1a104f..9f34619c 100644
--- a/build/webpack.dev.conf.js
+++ b/build/webpack.dev.conf.js
@@ -18,7 +18,9 @@ module.exports = merge(baseWebpackConfig, {
devtool: '#eval-source-map',
plugins: [
new webpack.DefinePlugin({
- 'process.env': config.dev.env
+ 'process.env': config.dev.env,
+ 'COMMIT_HASH': JSON.stringify('DEV'),
+ 'DEV_OVERRIDES': JSON.stringify(config.dev.settings)
}),
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
new webpack.optimize.OccurenceOrderPlugin(),
diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js
index 6119f700..9699f221 100644
--- a/build/webpack.prod.conf.js
+++ b/build/webpack.prod.conf.js
@@ -7,8 +7,13 @@ var baseWebpackConfig = require('./webpack.base.conf')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var env = process.env.NODE_ENV === 'testing'
- ? require('../config/test.env')
- : config.build.env
+ ? require('../config/test.env')
+ : config.build.env
+
+let commitHash = require('child_process')
+ .execSync('git rev-parse --short HEAD')
+ .toString();
+console.log(commitHash)
var webpackConfig = merge(baseWebpackConfig, {
module: {
@@ -29,7 +34,9 @@ var webpackConfig = merge(baseWebpackConfig, {
plugins: [
// http://vuejs.github.io/vue-loader/workflow/production.html
new webpack.DefinePlugin({
- 'process.env': env
+ 'process.env': env,
+ 'COMMIT_HASH': JSON.stringify(commitHash),
+ 'DEV_OVERRIDES': JSON.stringify(undefined)
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
@@ -51,7 +58,8 @@ var webpackConfig = merge(baseWebpackConfig, {
minify: {
removeComments: true,
collapseWhitespace: true,
- removeAttributeQuotes: true
+ removeAttributeQuotes: true,
+ ignoreCustomComments: [/server-generated-meta/]
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
diff --git a/config/index.js b/config/index.js
index c48d91b8..56fa5940 100644
--- a/config/index.js
+++ b/config/index.js
@@ -1,5 +1,15 @@
// see http://vuejs-templates.github.io/webpack for documentation.
-var path = require('path')
+const path = require('path')
+let settings = {}
+try {
+ settings = require('./local.json')
+ console.log('Using local dev server settings (/config/local.json):')
+ console.log(JSON.stringify(settings, null, 2))
+} catch (e) {
+ console.log('Local dev server settings not found (/config/local.json)')
+}
+
+const target = settings.target || 'http://localhost:4000/'
module.exports = {
build: {
@@ -19,16 +29,22 @@ module.exports = {
dev: {
env: require('./dev.env'),
port: 8080,
+ settings,
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/api': {
- target: 'htts://localhost:4000/',
+ target,
+ changeOrigin: true,
+ cookieDomainRewrite: 'localhost'
+ },
+ '/nodeinfo': {
+ target,
changeOrigin: true,
cookieDomainRewrite: 'localhost'
},
'/socket': {
- target: 'htts://localhost:4000/',
+ target,
changeOrigin: true,
cookieDomainRewrite: 'localhost',
ws: true
diff --git a/config/local.example.json b/config/local.example.json
new file mode 100644
index 00000000..2a3bd00d
--- /dev/null
+++ b/config/local.example.json
@@ -0,0 +1,4 @@
+{
+ "target": "https://pleroma.soykaf.com/",
+ "staticConfigPreference": false
+}
diff --git a/index.html b/index.html
index f0872ec9..d8defc2e 100644
--- a/index.html
+++ b/index.html
@@ -4,6 +4,7 @@