Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • coverage-stable
  • develop
  • feature/ability-to-add-custom-tags
  • feature/add-metrics-exporter-settings
  • feature/dynamic-settings-rendering
  • feature/fetchs-list-of-tabs
  • feature/media-preview-proxy
  • feature/post-pagination
  • feature/render-settings-dynamically
  • feature/settings-rollback
  • feature/update-styles
  • release/2.5.0
  • release/2.6
  • remove-workers
  • renovate/autoprefixer-10.x
  • renovate/babel-eslint-replacement
  • renovate/babel-loader-8.x
  • renovate/babel-monorepo
  • renovate/element-ui-2.x
  • renovate/sass-1.x
  • renovate/vue-monorepo
  • renovate/vue-test-utils-1.x
  • renovate/vue-test-utils-2.x
  • renovate/vuex-3.x
  • revert-fd9f0542
  • stable
  • 1.2.0
  • 2.4.0
  • 2.5.0
  • v2.0.2
  • v2.1.0
  • v2.2.0
32 results

Target

Select target project
No results found
Select Git revision
  • develop
  • display-name-emoji-packs
  • feature/add-new-user-filters
  • feature/edit-tags-manually
  • feature/update-styles
  • master
  • release/2.0.3
  • release/2.1.0
  • remove-ssh-gopher
  • 1.2.0
  • v2.0.2
  • v2.1.0
12 results
Show changes

Commits on Source 1235

1,135 additional commits have been omitted to prevent performance issues.
426 files
+ 25140
23199
Compare changes
  • Side-by-side
  • Inline

Files

.dockerignore

0 → 100644
+32 −0
Original line number Diff line number Diff line
# SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
# SPDX-License-Identifier: AGPL-3.0-only

# block everything
**

# allowed files
!AGPL-3
!CHANGELOG.md
!README.md
!.babelrc
!.eslintignore
!.eslintrc.js
!.postcssrc.js
!favicon.ico
!index.html
!package.json
!yarn.lock

# allowed subdirectories
!/build/**
!/config/**
!/docker/**
!/public/**
!/static/**
!/src/**

# blocked subdirectory files
**/*.log
**/*~
**/.DS_Store
**/Thumbs.db
+3 −0
Original line number Diff line number Diff line
# SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
# SPDX-License-Identifier: MIT

# http://editorconfig.org
root = true

+3 −0
Original line number Diff line number Diff line
# SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
# SPDX-License-Identifier: MIT

build/*.js
config/*.js
src/assets
+6 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT
//
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

module.exports = {
  root: true,
  parserOptions: {
+6 −0
Original line number Diff line number Diff line
# SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
# SPDX-License-Identifier: MIT
#
# SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
# SPDX-License-Identifier: AGPL-3.0-only

.DS_Store
node_modules/
dist/
+45 −14
Original line number Diff line number Diff line
image: node:10
# SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
# SPDX-License-Identifier: AGPL-3.0-only

image: node:20-alpine

variables: &global_variables
  DOCKER_DRIVER: overlay2
  DOCKER_HOST: unix:///var/run/docker.sock

cache: &global_cache_policy
  key: '$CI_COMMIT_SHORT_SHA'
  policy: pull-push
  paths:
    - node_modules/
    - build

stages:
  - lint
  - build
  - test

lint:
  stage: lint
build:
  stage: build
  before_script: &before-build
    - apk --no-cache add git python3 build-base
  script:
    - yarn
    - yarn lint
    - yarn build:prod
  artifacts: &release-artifacts
    name: "admin-fe-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA"
    paths:
      - dist/

test:
lint:
  stage: test
  variables:
    APT_CACHE_DIR: apt-cache
  script:
  before_script: &before-yarn
    - apk --no-cache add git python3 build-base
    - yarn
    - yarn test
  cache:
    key: '$CI_COMMIT_SHORT_SHA'
    policy: pull
  script:
    - yarn lint

build:
  stage: build
test:
  stage: test
  before_script: *before-yarn
  cache:
    key: '$CI_COMMIT_SHORT_SHA'
    policy: pull
  script:
    - yarn
    - npm run build:prod
    - yarn test --coverage
  coverage: '/^Lines *: *([^ ]*%) [^%]*$/'
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: coverage/cobertura-coverage.xml
+6 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT
//
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

// https://github.com/michael-ciniawsky/postcss-load-config

module.exports = {

.reuse/dep5

0 → 100644
+9 −0
Original line number Diff line number Diff line
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://git.pleroma.social/pleroma/admin-fe/

# Grabbed from tiptap@1.29.6
# See https://github.com/ueberdosis/tiptap/blob/tiptap%401.29.6/LICENSE.md
# and https://github.com/ueberdosis/tiptap/tree/tiptap%401.29.6/examples/assets/images/icons
Files: src/icons/svg/tiptap-*.svg
Copyright: 2020 überdosis GbR
License: MIT

.tool-versions

0 → 100644
+2 −0
Original line number Diff line number Diff line
yarn 1.22.19
nodejs 20.14.0
+3 −0
Original line number Diff line number Diff line
# SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
# SPDX-License-Identifier: MIT

language: node_js
node_js: stable
script: npm run test

AGPL-3

deleted100644 → 0
+0 −661

File deleted.

Preview size limit exceeded, changes collapsed.

+189 −0
Original line number Diff line number Diff line
<!--
SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
SPDX-License-Identifier: AGPL-3.0-only
-->

# Changelog

All notable changes to this project will be documented in this file.
@@ -6,15 +11,199 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Added

### Changed

### Fixed
- The Service account type has been renamed to Bot so it's consistent with the termoniology used by most fediverse software.

## [2.5.0] - 2022-12-21

### Added
- Support for fine-grained privileges

### Added
- Support for fine-grained privileges

### Fixed
- Crash when parsing tuples in Settings
- Broken parsing of Settings

## [2.4.0] - 2021-08-01

### Added

- Evicting and banning objects from the MediaProxy cache is disabled if MediaProxy is disabled on the Settings tab. Add ability to enable MediaProxy and Invalidation from MediaProxy tab.
- Allow to upload the custom Terms of Service and Instance Panel HTML pages via Admin API
- Add Report show page and link Moderation log references to the respective reports
- Add Unconfimed filter for Users table
- Filter users by actor type: Person, Bot or Application
- Add ability to configure Media Preview Proxy, User Backup, Websocket based federation and Pleroma.Web.Endpoint.MetricsExporter settings
- Mobile and Tablet UI for Single Report show page
- Ability to set rules and conditions for rendering settings (e.g. `:proxy_remote` setting is hidden if `:uploader` setting is set to `Pleroma.Uploaders.Local`)
- Ability to install new frontends from the Frontend tab in the Settings section

### Changed

- **Breaking**: AdminAPI changed User field `confirmation_pending` to `is_confirmed`
- **Breaking**: AdminAPI changed User field `approval_pending` to `is_approved`
- **Breaking**: AdminAPI changed User field `deactivated` to `is_active`
- Hide Tag actions on Users tab if MRF TagPolicy is disabled. Add ability to enable TagPolicy from Moderation menu
- Move `:restrict_unauthenticated` settings from Authentication tab to Instance tab
- Replace regular inputs with textareas for setting welcome messages in the Settings section
- Remove Websocket based federation settings
- Move Settings tab navigation from the tabbed menu to the main sidebar menu. A separate route is created for each tab.
- Move Emoji packs configuration to the Emoji tab in the Settings section
- 401 and 404 error pages updated
- Remove unused components

### Fixed

- Fix depricatied action names in Reports, move actions that manage users from Reports to reports module
- Allow using underscores and hyphens in new account's usernames
- Fix wrapping `:icons` setting and parsing tuples in settings with key `:headers`
- Update keys for Pleroma.Web.Plugs.RemoteIp and PurgeExpiredActivity settings
- Update switching between local and remote emoji packs panels: the panel with the pack's metadata will be closed when another panel is opened
- Fix displaying messages for multiple errors
## [2.2] - 2020-11-18

### Added

- Ability to configure Media Preview Proxy settings on MediaProxy tab

### Fixed

- Update keys for PurgeExpiredActivity and RemoteIp settings
- Fix wrapping `:icons` setting and parsing tuples in settings with key `:headers`

## [2.1] - 2020-08-26

### Added

- Create `/statuses/:id` route that shows single status
- Add link to the user's account in Pleroma on the user's profile page
- On Reports page add links to reported account and the author of the report 
- In Notes add link to the note author's profile page 
- In Moderation log add link to the actor's profile page
- Support pagination of local emoji packs and files
- Add MRF Activity Expiration setting
- Add ability to disable multi-factor authentication for a user
- Add ability to configure Invalidation settings on MediaProxy tab
- Ability to configure `S3` settings on Upload tab, `Pleroma.Web.ApiSpec.CastAndValidate` and `:modules` settings on Other tab, `:pools`, `:connections_pool` and `:hackney_pools` settings on Job Queue tab, `:restrict_unauthenticated` settings on Authentication tab, `:favicons` and `:welcome` settings on Instance tab, `:frontends` and `Pleroma.Web.Preload` settings on Frontend tab
- Show number of open reports in Sidebar Menu
- Add confirmation message when deleting a user
- Add new MediaProxy Cache Tab with ability to manually evict and ban objects from the Pleroma MediaProxy cache
- Allow managing user's actor_type field via Admin API

### Changed

- Statuses count changes when an instance is selected and shows the amount of statuses from an originating instance
- Add a confirmation dialog window when Remove button is clicked on the Settings page
- Disable tab on the Settings page if there are no settings on this tab that can be changed in Admin FE
- Settings that can't be altered in Admin FE are removed: HTTP Signatures settings, Federation publisher modules and Oban Repo
- When rendering user's profile, statuses, reports and notes check if required properties exist
- Remove ability to moderate users that don't have valid nicknames
- Displays both labels and description in the header of group of settiings
- Ability to add custom values in Pleroma.Upload.Filter.Mogrify setting in the following format: '{"implode", "1"}'
- Change types of the following settings: ':groups', ':replace', ':federated_timeline_removal', ':reject', ':match_actor'. Update functions that parses and wraps settings data according to this change.
- Move rendering Crontab setting from a separate component to EditableKeyword component
- Show only those MRF settings that have been enabled in MRF Policies setting
- Move Auto Linker settings to Link Formatter Tab as its configuration was moved to :pleroma, Pleroma.Formatter
- Active and Local filters are applied by default on the Users tab
- Update Emoji Packs API to support special chars in pack names

### Fixed

- Send `true` and `false` as booleans if they are values of single selects on the Settings page
- Fix sorting users on Users page if there is an acount with missing nickname or ID
- Add new type of settings: `['string', 'image']`. Render Image upload Input depending on the type of setting, not its key
- Fix displaying `Pending` tag and filtering by Pending Approval status
- Fix following and unfollowing relays from Admin-FE, update mobile UI
- Support special chars in Emoji packs names

## [2.0.3] - 2020-04-29

### Added

- Link settings that enable registrations and invites
- Ability to upload logo, background, default user avatar, instance thumbnail, and NSFW hiding images

### Changed

- Put Instance Reboot button on all pages of admin-fe
- Make Instance Reboot button's positon fixed on Settings page
- Update jest and babel-jest
- Generate an invite link when an invite token has been generated
- Put labels on top of inputs in mobile version
- Shorten suggestions for a series of select inputs: Rewrite policy, Pleroma Authenticator, Captcha Method, Mailer adapter, Metadata providers, Rich Media parsers, TTL setters, Scrub policy, Uploader, Filters and Federation publisher modules

### Fixed

- Disable Invites tab when invites are disabled on BE

## [2.0.2] - 2020-04-01

### Added

- Ability to see local statuses in Statuses by instance section
- Ability to configure Oban.Cron settings and settings for notifications streamer
- Settings search
- Ability to set user's password and email on user's page
- Display status count by scope on Statuses page

### Changed

- Link to Pleroma docs when a non-admin user tries to log in 

### Fixed

- Fix parsing tuples in Pleroma.Upload.Filter.Mogrify and Pleroma.Emails.Mailer settings
- Fix settings submit button position on wide screens when sidebar menu is open
- Updates links for downloading remote emoji packs
- Fix parsing emails that have symbols in it

## [2.0] - 2020-02-27

### Added

- Optimistic update for actions in users module and fetching users after api function finished its execution
- Relay management
- Ability to fetch all statuses from a given instance
- Ability to confirm users' emails and resend confirmation emails
- Report notes
- Ability to moderate users on the statuses page
- Ability to moderate user on the user's page
- Ability to remove setting's updated value and set it back to initial value
- Ability to restart an application when settings that require instance reboot were changed
- Mobile and Tablet UI for all sections

### Changed

- **breaking** PleromaFE login feature relies on `admin` scope presence in PleromaFE token (older versions of PleromaFE don't support it)
- `mailerEnabled` must be set to `true` in order to require password reset (password reset currently only works via email)
- Render inputs for configuring settings based on description that comes from the BE
- Remove fetching initial data for configuring server settings
- Actions in users module (ActivateUsers, AddRight, DeactivateUsers, DeleteRight, DeleteUsers) now accept an array of users instead of one user
- Leave dropdown menu open after clicking an action
- Display checkboxes in status card and fetch statuses only when status card was rendered from Statuses by instance page
- Move statuses by instance state from local state to store state

### Fixed

- Show checkmarks when tag is applied
- Reports update (also, now it's optimistic)
- Remove duplicated success message
- Fix styles for Statuses by instance page
- Fix styles for Reports section
- Fix listing remote emoji

## [1.2.0] - 2019-09-27

### Added

- Emoji pack configuration
- Statuses page: fetch all statuses from a given instance
- Ability to require user's password reset
– Ability to track admin/moderator actions, a.k.a. "the moderation log"

Dockerfile

0 → 100644
+41 −0
Original line number Diff line number Diff line
# SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
# SPDX-License-Identifier: AGPL-3.0-only

FROM node:16-alpine as build

COPY . .

RUN apk --no-cache add git && \
    npm install && \
    npm run build:prod

FROM nginx:mainline-alpine

LABEL maintainer="ops@pleroma.social" \
    org.opencontainers.image.title="pleroma-adminfe" \
    org.opencontainers.image.description="Pleroma-adminfe for Docker" \
    org.opencontainers.image.authors="ops@pleroma.social" \
    org.opencontainers.image.vendor="pleroma.social" \
    org.opencontainers.image.documentation="https://git.pleroma.social/pleroma/pleroma-adminfe" \
    org.opencontainers.image.licenses="AGPL-3.0" \
    org.opencontainers.image.url="https://pleroma.social" \
    org.opencontainers.image.revision=$VCS_REF \
    org.opencontainers.image.created=$BUILD_DATE


ARG DATA=/usr/share/nginx/html

COPY --from=build /dist/ ${DATA}

COPY ./docker/docker-entrypoint.sh /usr/local/bin/

COPY ./docker/nginx.conf.tpl /etc/nginx/nginx.conf.tpl

RUN apk add --no-cache gettext

EXPOSE 80

ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

CMD exec nginx -g 'daemon off;'

LICENSE

deleted100644 → 0
+0 −21
Original line number Diff line number Diff line
MIT License

Copyright (c) 2017-present PanJiaChen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

LICENSES/MIT.txt

0 → 100644
+9 −0
Original line number Diff line number Diff line
MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+40 −7
Original line number Diff line number Diff line
@@ -6,6 +6,13 @@

Admin UI for pleroma instance owners.

### Branches

There are two main branches here:

- `develop`: ongoing work and all merge requests go here, *unstable*
- `stable`: after `develop` is stabilized it is merged to `stable`, *stable*, allegedly

### Features

1. User administration: grant roles to users (admin/moderator), deactivate/delete as well as force their statuses to have NSFW tag, strip media and many more
@@ -18,13 +25,37 @@ You can have any combination of these features (i.e. you can disable anything, b

## Usage

### Bundled

AdminFE is bundled with Pleroma, i.e. you can just visit `https://your.instance/pleroma/admin/` to try it out.

### Development

To run AdminFE locally execute `yarn dev`
To run AdminFE locally execute

```
# install dependencies
npm install -g yarn
yarn

# run AdminFE locally
yarn dev
```

### Build

To compile everything for production run `yarn build:prod`.
To compile everything for production run

```
# install dependencies
npm install -g yarn
yarn

# compile everything for production
yarn build:prod
```

This will build admin-fe into `dist` folder, which you will need to upload to your server and/or point your webserver of choice to.

#### Disabling features

@@ -54,8 +85,10 @@ Modern browsers and Internet Explorer 10+.
| --------- | --------- | --------- | --------- |
| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions

## License

Pleroma AdminFE is build on top of the [Vue Element Admin](https://github.com/PanJiaChen/vue-element-admin), which is licensed under [MIT](https://github.com/PanJiaChen/vue-element-admin/blob/master/LICENSE) license.

AdminFE's own code is licensed under [AGPL](./AGPL-3)
## Copyright
```
Copyright 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
SPDX-License-Identifier: MIT
Copyright 2019-2022 Pleroma Authors <https://pleroma.social>
SPDX-License-Identifier: AGPL-3.0-only
```

README.png

deleted100644 → 0
−566 KiB

566.32 KiB

+9 −10
Original line number Diff line number Diff line
'use strict'
require('./check-versions')()
// SPDX-FileCopyrightText: 2017-2018 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT
//
// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileCopyrightText: 2022 Pleroma Authors <https://pleroma.social>

'use strict'
const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
@@ -32,17 +35,15 @@ rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
    )

    if (stats.hasErrors()) {
      console.log(chalk.red(' Build failed with errors.\n'))
      console.log(' Build failed with errors.\n')
      process.exit(1)
    }

    console.log(chalk.cyan(' Build complete.\n'))
    console.log(' Build complete.\n')
    console.log(
      chalk.yellow(
        ' Tip: built files are meant to be served over an HTTP server.\n' +
          " Opening index.html over file:// won't work.\n"
    )
    )

    if (process.env.npm_config_preview) {
      const port = 9526
@@ -58,9 +59,7 @@ rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
      )

      app.listen(port, function() {
        console.log(
          chalk.green(`> Listening at  http://localhost:${port}${basePath}`)
        )
        console.log(`> Listening at  http://localhost:${port}${basePath}`)
      })
    }
  })

build/check-versions.js

deleted100644 → 0
+0 −64
Original line number Diff line number Diff line
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')

function exec(cmd) {
  return require('child_process')
    .execSync(cmd)
    .toString()
    .trim()
}

const versionRequirements = [
  {
    name: 'node',
    currentVersion: semver.clean(process.version),
    versionRequirement: packageConfig.engines.node
  }
]

if (shell.which('npm')) {
  versionRequirements.push({
    name: 'npm',
    currentVersion: exec('npm --version'),
    versionRequirement: packageConfig.engines.npm
  })
}

module.exports = function() {
  const warnings = []

  for (let i = 0; i < versionRequirements.length; i++) {
    const mod = versionRequirements[i]

    if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
      warnings.push(
        mod.name +
          ': ' +
          chalk.red(mod.currentVersion) +
          ' should be ' +
          chalk.green(mod.versionRequirement)
      )
    }
  }

  if (warnings.length) {
    console.log('')
    console.log(
      chalk.yellow(
        'To use this template, you must update following to modules:'
      )
    )
    console.log()

    for (let i = 0; i < warnings.length; i++) {
      const warning = warnings[i]
      console.log('  ' + warning)
    }

    console.log()
    process.exit(1)
  }
}
+6 −18
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2017-2018 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT
//
// SPDX-FileCopyrightText: 2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

'use strict'
const path = require('path')
const config = require('../config')
@@ -88,21 +94,3 @@ exports.styleLoaders = function(options) {

  return output
}

exports.createNotifierCallback = () => {
  const notifier = require('node-notifier')

  return (severity, errors) => {
    if (severity !== 'error') return

    const error = errors[0]
    const filename = error.file && error.file.split('!').pop()

    notifier.notify({
      title: packageConfig.name,
      message: severity + ': ' + error.name,
      subtitle: filename || '',
      icon: path.join(__dirname, 'logo.png')
    })
  }
}
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2017-2018 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT

'use strict'

module.exports = {
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2017-2018 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT
//
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

'use strict'
const path = require('path')
const utils = require('./utils')
@@ -31,7 +37,8 @@ module.exports = {
    publicPath:
      process.env.NODE_ENV === 'production'
        ? config.build.assetsPublicPath
        : config.dev.assetsPublicPath
        : config.dev.assetsPublicPath,
    hashFunction: 'sha512'
  },
  resolve: {
    extensions: ['.js', '.vue', '.json'],
@@ -65,22 +72,14 @@ module.exports = {
        }
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        loader: 'url-loader',
        test: /\.(png|jpe?g|gif)(\?.*)?$/,
        loader: 'file-loader',
        exclude: [resolve('src/icons')],
        options: {
          limit: 10000,
          name: utils.assetsPath('img/[name].[hash:7].[ext]')
        }
      },
      {
        test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('media/[name].[hash:7].[ext]')
        }
      },
      {
        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
        loader: 'file-loader',
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2017-2018 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT
//
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

'use strict'
const path = require('path')
const utils = require('./utils')
@@ -6,8 +12,6 @@ const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')

function resolve(dir) {
  return path.join(__dirname, '..', dir)
@@ -43,7 +47,6 @@ const devWebpackConfig = merge(baseWebpackConfig, {
      : false,
    publicPath: devEnv.ASSETS_PUBLIC_PATH,
    proxy: config.dev.proxyTable,
    quiet: true, // necessary for FriendlyErrorsPlugin
    watchOptions: {
      poll: config.dev.poll
    },
@@ -71,33 +74,5 @@ const devWebpackConfig = merge(baseWebpackConfig, {
})

module.exports = new Promise((resolve, reject) => {
  portfinder.basePort = process.env.PORT || config.dev.port
  portfinder.getPort((err, port) => {
    if (err) {
      reject(err)
    } else {
      // publish the new Port, necessary for e2e tests
      process.env.PORT = port
      // add port to devServer config
      devWebpackConfig.devServer.port = port

      // Add FriendlyErrorsPlugin
      devWebpackConfig.plugins.push(
        new FriendlyErrorsPlugin({
          compilationSuccessInfo: {
            messages: [
              `Your application is running here: http://${
                devWebpackConfig.devServer.host
              }:${port}`
            ]
          },
          onErrors: config.dev.notifyOnErrors
            ? utils.createNotifierCallback()
            : undefined
        })
      )

  resolve(devWebpackConfig)
    }
  })
})
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2017-2018 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT
//
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

'use strict'
const path = require('path')
const utils = require('./utils')
@@ -5,9 +11,7 @@ const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
@@ -89,14 +93,6 @@ const webpackConfig = merge(baseWebpackConfig, {
    }),
    // keep module.id stable when vender modules does not change
    new webpack.HashedModuleIdsPlugin(),
    // copy custom static assets
    new CopyWebpackPlugin([
      {
        from: path.resolve(__dirname, '../static'),
        to: config.build.assetsSubDirectory,
        ignore: ['.*']
      }
    ])
  ],
  optimization: {
    splitChunks: {
@@ -156,28 +152,4 @@ if (config.build.productionGzip) {
  )
}

if (config.build.generateAnalyzerReport || config.build.bundleAnalyzerReport) {
  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
    .BundleAnalyzerPlugin

  if (config.build.bundleAnalyzerReport) {
    webpackConfig.plugins.push(
      new BundleAnalyzerPlugin({
        analyzerPort: 8080,
        generateStatsFile: false
      })
    )
  }

  if (config.build.generateAnalyzerReport) {
    webpackConfig.plugins.push(
      new BundleAnalyzerPlugin({
        analyzerMode: 'static',
        reportFilename: 'bundle-report.html',
        openAnalyzer: false
      })
    )
  }
}

module.exports = webpackConfig
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT
//
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

module.exports = {
  NODE_ENV: '"development"',
  ENV_CONFIG: '"dev"',
+6 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT
//
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

'use strict'
// Template version: 1.2.6
// see http://vuejs-templates.github.io/webpack for documentation.
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT
//
// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>

module.exports = {
  NODE_ENV: '"production"',
  ENV_CONFIG: '"prod"',
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT

module.exports = {
  NODE_ENV: '"production"',
  ENV_CONFIG: '"sit"',
+8 −0
Original line number Diff line number Diff line
#!/bin/sh

# SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
# SPDX-License-Identifier: AGPL-3.0-only

set -e
envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < "/etc/nginx/nginx.conf.tpl" > "/etc/nginx/nginx.conf"
exec "$@"

docker/nginx.conf.tpl

0 → 100644
+35 −0
Original line number Diff line number Diff line
# SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
# SPDX-License-Identifier: AGPL-3.0-only

user  nginx;
worker_processes  1;
error_log  /var/log/nginx/error.log warn;
pid        /tmp/nginx.pid;
events {
    worker_connections  1024;
}
http {
    client_body_temp_path /tmp/client_temp;
    proxy_temp_path       /tmp/proxy_temp_path;
    fastcgi_temp_path     /tmp/fastcgi_temp;
    uwsgi_temp_path       /tmp/uwsgi_temp;
    scgi_temp_path        /tmp/scgi_temp;
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    keepalive_timeout  65;
    proxy_cache_path /tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cache:10m max_size=10g
                     inactive=720m use_temp_path=off;
    server {
        listen 80;
        server_name _;
        root /usr/share/nginx/html;
        location / {
        try_files $uri $uri/ /index.html;
      }
    }
}
+5 −1
Original line number Diff line number Diff line
<!--
SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
SPDX-License-Identifier: MIT
-->

<!DOCTYPE html>
<html>
  <head>
@@ -8,7 +13,6 @@
    <title>Admin FE</title>
  </head>
  <body>
    <script src=<%= BASE_URL %>/tinymce4.7.5/tinymce.min.js></script>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
+69 −97
Original line number Diff line number Diff line
@@ -5,20 +5,13 @@
  "author": "Pan <panfree23@gmail.com>",
  "license": "MIT",
  "scripts": {
    "dev": "cross-env BABEL_ENV=development webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
    "build:prod": "cross-env NODE_ENV=production env_config=prod node build/build.js",
    "build:sit": "cross-env NODE_ENV=production env_config=sit node build/build.js",
    "dev": "cross-env BABEL_ENV=development NODE_OPTIONS=--openssl-legacy-provider webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
    "build:prod": "cross-env NODE_OPTIONS=--openssl-legacy-provider NODE_ENV=production env_config=prod node build/build.js",
    "build:sit": "cross-env NODE_OPTIONS=--openssl-legacy-provider NODE_ENV=production env_config=sit node build/build.js",
    "lint": "eslint --ext .js,.vue src",
    "test": "jest",
    "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
    "precommit": "lint-staged",
    "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
  },
  "lint-staged": {
    "src/**/*.{js,vue}": [
      "eslint --fix",
      "git add"
    ]
    "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.json"
  },
  "keywords": [
    "vue",
@@ -29,110 +22,88 @@
  ],
  "repository": {
    "type": "git",
    "url": "git+https://github.com/PanJiaChen/vue-element-admin.git"
    "url": "git+https://git.pleroma.social/pleroma/admin-fe.git"
  },
  "resolutions": {
    "prosemirror-model": "1.18.3"
  },
  "bugs": {
    "url": "https://github.com/PanJiaChen/vue-element-admin/issues"
    "url": "https://git.pleroma.social/pleroma/admin-fe/-/issues"
  },
  "dependencies": {
    "@babel/runtime": "^7.3.4",
    "axios": "0.18.0",
    "clipboard": "1.7.1",
    "codemirror": "5.39.2",
    "default-passive-events": "^1.0.10",
    "driver.js": "0.8.1",
    "dropzone": "5.2.0",
    "echarts": "4.1.0",
    "element-ui": "^2.10.0",
    "file-saver": "1.3.8",
    "fuse.js": "3.4.2",
    "js-cookie": "2.2.0",
    "jsonlint": "1.6.3",
    "jszip": "3.1.5",
    "localforage": "^1.7.3",
    "lodash": "^4.17.11",
    "lodash.debounce": "^4.0.8",
    "moment": "^2.24.0",
    "@babel/runtime": "7.19.0",
    "axios": "0.27.2",
    "clipboard": "2.0.11",
    "element-ui": "2.15.12",
    "js-cookie": "2.2.1",
    "localforage": "1.10.0",
    "lodash": "4.17.21",
    "lodash.debounce": "4.0.8",
    "marked": "0.8.2",
    "luxon": "3.1.1",
    "normalize.css": "7.0.0",
    "nprogress": "0.2.0",
    "numeral": "^2.0.6",
    "screenfull": "4.0.0",
    "showdown": "1.8.6",
    "sortablejs": "1.7.0",
    "tui-editor": "1.2.7",
    "vue": "^2.6.8",
    "vue-count-to": "1.0.13",
    "vue-i18n": "^8.9.0",
    "vue-router": "3.0.2",
    "vue-splitpane": "1.0.2",
    "vue2-ace-editor": "^0.0.13",
    "vuedraggable": "^2.16.0",
    "vuex": "3.0.1",
    "xlsx": "^0.11.16"
    "numeral": "2.0.6",
    "tiptap": "1.32.2",
    "tiptap-extensions": "1.35.2",
    "vue": "2.7.8",
    "vue-i18n": "8.28.2",
    "vue-router": "3.6.5",
    "vuex": "3.0.1"
  },
  "devDependencies": {
    "@babel/core": "^7.3.4",
    "@babel/plugin-syntax-dynamic-import": "^7.2.0",
    "@babel/plugin-transform-runtime": "^7.3.4",
    "@babel/preset-env": "^7.3.4",
    "@vue/babel-helper-vue-jsx-merge-props": "^1.0.0-beta.2",
    "@vue/babel-preset-jsx": "^1.0.0-beta.2",
    "@vue/test-utils": "^1.0.0-beta.29",
    "autoprefixer": "8.5.0",
    "@babel/core": "7.19.1",
    "@babel/plugin-syntax-dynamic-import": "7.8.3",
    "@babel/plugin-transform-runtime": "7.19.1",
    "@babel/preset-env": "7.19.1",
    "@vue/babel-helper-vue-jsx-merge-props": "1.4.0",
    "@vue/babel-preset-jsx": "1.4.0",
    "@vue/test-utils": "1.3.3",
    "autoprefixer": "10.4.16",
    "babel-eslint": "8.2.6",
    "babel-helper-vue-jsx-merge-props": "2.0.3",
    "babel-jest": "^24.1.0",
    "babel-loader": "^8.0.5",
    "babel-plugin-dynamic-import-node-babel-7": "^2.0.7",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
    "chalk": "2.4.1",
    "babel-jest": "25.5.1",
    "babel-loader": "8.2.5",
    "babel-plugin-dynamic-import-node-babel-7": "2.0.7",
    "babel-plugin-transform-es2015-modules-commonjs": "6.26.2",
    "compression-webpack-plugin": "2.0.0",
    "connect": "3.6.6",
    "copy-webpack-plugin": "4.5.2",
    "cross-env": "5.2.0",
    "css-loader": "1.0.0",
    "connect": "3.7.0",
    "cross-env": "7.0.3",
    "css-loader": "1.0.1",
    "eslint": "4.19.1",
    "eslint-friendly-formatter": "4.0.1",
    "eslint-loader": "2.0.0",
    "eslint-loader": "2.2.1",
    "eslint-plugin-vue": "4.7.1",
    "file-loader": "1.1.11",
    "flush-promises": "^1.0.2",
    "friendly-errors-webpack-plugin": "1.7.0",
    "flush-promises": "1.0.2",
    "hash-sum": "1.0.2",
    "html-webpack-plugin": "^3.2.0",
    "husky": "0.14.3",
    "jest": "^24.1.0",
    "jest-transform-stub": "^2.0.0",
    "lint-staged": "7.2.2",
    "mini-css-extract-plugin": "0.4.1",
    "node-notifier": "5.2.1",
    "node-sass": "^4.12.0",
    "optimize-css-assets-webpack-plugin": "5.0.0",
    "ora": "3.0.0",
    "html-webpack-plugin": "3.2.0",
    "jest": "25.5.4",
    "jest-transform-stub": "2.0.0",
    "mini-css-extract-plugin": "0.12.0",
    "sass": "1.57.1",
    "optimize-css-assets-webpack-plugin": "5.0.8",
    "ora": "3.4.0",
    "path-to-regexp": "2.4.0",
    "portfinder": "1.0.13",
    "postcss-loader": "2.1.6",
    "postcss-url": "7.3.2",
    "rimraf": "2.6.2",
    "sass-loader": "7.0.3",
    "script-ext-html-webpack-plugin": "2.0.1",
    "postcss": "8.4.20",
    "postcss-loader": "4.3.0",
    "postcss-url": "10.1.3",
    "rimraf": "2.7.1",
    "sass-loader": "7.3.1",
    "script-loader": "0.7.2",
    "semver": "5.5.0",
    "serve-static": "1.13.2",
    "shelljs": "0.8.2",
    "svg-sprite-loader": "3.8.0",
    "svgo": "1.0.5",
    "uglifyjs-webpack-plugin": "1.2.7",
    "url-loader": "1.0.1",
    "vue-jest": "4.0.0-beta.2",
    "vue-loader": "15.3.0",
    "vue-style-loader": "4.1.2",
    "vue-template-compiler": "^2.6.8",
    "webpack": "^4.29.6",
    "webpack-bundle-analyzer": "2.13.1",
    "webpack-cli": "^3.2.3",
    "webpack-dev-server": "3.1.14",
    "webpack-merge": "4.1.4"
    "semver": "5.7.1",
    "serve-static": "1.15.0",
    "svg-sprite-loader": "3.9.2",
    "svgo": "2.8.0",
    "uglifyjs-webpack-plugin": "1.3.0",
    "vue-jest": "4.0.1",
    "vue-loader": "15.10.1",
    "vue-style-loader": "4.1.3",
    "vue-template-compiler": "2.7.8",
    "webpack": "4.46.0",
    "webpack-cli": "3.3.12",
    "webpack-dev-server": "3.11.3",
    "webpack-merge": "4.2.2"
  },
  "engines": {
    "node": ">= 6.0.0",
@@ -144,6 +115,7 @@
    "not ie <= 8"
  ],
  "jest": {
    "coverageReporters": ["cobertura", "text-summary"],
    "moduleFileExtensions": [
      "js",
      "json",

renovate.json

0 → 100644
+6 −0
Original line number Diff line number Diff line
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": [
    "config:base"
  ]
}
+5 −0
Original line number Diff line number Diff line
<!--
SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
SPDX-License-Identifier: MIT
-->

<template>
  <div id="app">
    <router-view/>
+10 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

export async function needReboot(authHost, token) {
  return Promise.resolve({ data: false })
}

export async function restartApp(authHost, token) {
  return Promise.resolve()
}
+620 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

export async function fetchChat(id, authHost, token) {
  return Promise.resolve({ data: userChats[0] })
}

export async function fetchChatMessages(id, max_id, authHost, token) {
  return Promise.resolve({ data: chatMessages })
}

export async function deleteChat(chat_id, message_id, authHost, token) {
  return Promise.resolve({ data: userChats[0] })
}

export const userChats = [
  {
    id: '9y8e7ESoVUiKVMAoCW',
    last_message: {
      account_id: '9xUIiQfGrdPJDZe39s',
      attachment: null,
      card: null,
      chat_id: '9y8e7ESoVUiKVMAoCW',
      content: 'heyy',
      created_at: '2020-09-11T00:07:13.000Z',
      emojis: [],
      id: '9z22Q9MzWiAk7GZnNY',
      unread: false
    },
    receiver: {
      acct: 'test10',
      avatar: 'http://localhost:4000/images/avi.png',
      avatar_static: 'http://localhost:4000/images/avi.png',
      bot: false,
      created_at: '2020-07-27T00:33:02.000Z',
      display_name: 'test10',
      emojis: [],
      fields: [],
      followers_count: 2,
      following_count: 1,
      header: 'http://localhost:4000/images/banner.png',
      header_static: 'http://localhost:4000/images/banner.png',
      id: '9xUj5WTmzSlFPN6OLg',
      locked: false,
      note: '',
      pleroma: {
        accepts_chat_messages: true,
        ap_id: 'http://localhost:4000/users/test10',
        background_image: null,
        is_confirmed: true,
        favicon: null,
        hide_favorites: true,
        hide_followers: false,
        hide_followers_count: false,
        hide_follows: false,
        hide_follows_count: false,
        is_admin: false,
        is_moderator: true,
        relationship: {},
        skip_thread_containment: false,
        tags: [
          'mrf_tag:media-force-nsfw',
          'mrf_tag:media-strip',
          'mrf_tag:force-unlisted'
        ]
      },
      source: {
        fields: [],
        note: '',
        pleroma: {
          actor_type: 'Person',
          discoverable: false
        },
        sensitive: false
      },
      statuses_count: 20,
      url: 'http://localhost:4000/users/test10',
      username: 'test10'
    },
    sender: {
      acct: 'mk',
      avatar: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
      avatar_static: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
      bot: false,
      created_at: '2020-07-26T19:37:31.000Z',
      display_name: 'mk',
      emojis: [],
      fields: [
        {
          name: 'website',
          value: '<a href="http://marykatefain.com" rel="ugc">marykatefain.com</a>'
        }
      ],
      followers_count: 2,
      following_count: 1,
      header: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
      header_static: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
      id: '9xUIiQfGrdPJDZe39s',
      locked: false,
      note: 'a bio about me',
      pleroma: {
        accepts_chat_messages: true,
        ap_id: 'https://localhost/users/mk',
        background_image: null,
        is_confirmed: true,
        favicon: null,
        hide_favorites: true,
        hide_followers: false,
        hide_followers_count: false,
        hide_follows: false,
        hide_follows_count: false,
        is_admin: true,
        is_moderator: false,
        relationship: {},
        skip_thread_containment: false,
        tags: [
          'verified'
        ]
      },
      source: {
        fields: [
          {
            name: 'website',
            value: 'marykatefain.com'
          }
        ],
        note: 'a bio about me',
        pleroma: {
          actor_type: 'Person',
          discoverable: false
        },
        sensitive: false
      },
      statuses_count: 77,
      url: 'https://localhost/users/mk',
      username: 'mk'
    },
    unread: 0,
    updated_at: '2020-09-11T00:07:13.000Z'
  },
  {
    id: '9y8dwDAQzFBZIZJzEG',
    last_message: {
      account_id: '9xUIiQfGrdPJDZe39s',
      attachment: null,
      card: null,
      chat_id: '9y8dwDAQzFBZIZJzEG',
      content: 'hiiiiiiiiiiiiiiiiiii',
      created_at: '2020-08-15T06:45:13.000Z',
      emojis: [],
      id: '9y8e4EZndDmfzA0lGa',
      unread: false
    },
    receiver: {
      acct: 'user2',
      avatar: 'http://localhost:4000/media/5a702176cd5181f81532a42fafa87953db1586ca39a3c83cd3df1bc9b5cb7d07.png',
      avatar_static: 'http://localhost:4000/media/5a702176cd5181f81532a42fafa87953db1586ca39a3c83cd3df1bc9b5cb7d07.png',
      bot: false,
      created_at: '2020-08-01T19:23:57.000Z',
      display_name: 'User2',
      emojis: [],
      fields: [],
      followers_count: 0,
      following_count: 2,
      header: 'http://localhost:4000/media/1b1fc87d56e4f94b0ca8eb23100c92f67371bfa37b2898cd804341ed1a2d5c84.jpg',
      header_static: 'http://localhost:4000/media/1b1fc87d56e4f94b0ca8eb23100c92f67371bfa37b2898cd804341ed1a2d5c84.jpg',
      id: '9xfhRuCIyydruc0Sh6',
      locked: false,
      note: 'Just me!',
      pleroma: {
        accepts_chat_messages: true,
        ap_id: 'http://localhost:4000/users/user2',
        background_image: null,
        is_confirmed: false,
        favicon: null,
        hide_favorites: true,
        hide_followers: false,
        hide_followers_count: false,
        hide_follows: false,
        hide_follows_count: false,
        is_admin: false,
        is_moderator: false,
        relationship: {},
        skip_thread_containment: false,
        tags: [
          'mrf_tag:force-unlisted',
          'mrf_tag:media-strip'
        ]
      },
      source: {
        fields: [],
        note: 'Just me!',
        pleroma: {
          actor_type: 'Person',
          discoverable: false
        },
        sensitive: false
      },
      statuses_count: 69,
      url: 'http://localhost:4000/users/user2',
      username: 'user2'
    },
    sender: {
      acct: 'mk',
      avatar: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
      avatar_static: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
      bot: false,
      created_at: '2020-07-26T19:37:31.000Z',
      display_name: 'mk',
      emojis: [],
      fields: [
        {
          name: 'website',
          value: '<a href="http://marykatefain.com" rel="ugc">marykatefain.com</a>'
        }
      ],
      followers_count: 2,
      following_count: 1,
      header: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
      header_static: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
      id: '9xUIiQfGrdPJDZe39s',
      locked: false,
      note: 'a bio about me',
      pleroma: {
        accepts_chat_messages: true,
        ap_id: 'https://localhost/users/mk',
        background_image: null,
        is_confirmed: true,
        favicon: null,
        hide_favorites: true,
        hide_followers: false,
        hide_followers_count: false,
        hide_follows: false,
        hide_follows_count: false,
        is_admin: true,
        is_moderator: false,
        relationship: {},
        skip_thread_containment: false,
        tags: [
          'verified'
        ]
      },
      source: {
        fields: [
          {
            name: 'website',
            value: 'marykatefain.com'
          }
        ],
        note: 'a bio about me',
        pleroma: {
          actor_type: 'Person',
          discoverable: false
        },
        sensitive: false
      },
      statuses_count: 77,
      url: 'https://localhost/users/mk',
      username: 'mk'
    },
    unread: 0,
    updated_at: '2020-08-15T06:45:13.000Z'
  },
  {
    id: '9y8dubemxq32fkkoeu',
    last_message: null,
    receiver: {
      acct: 'mk',
      avatar: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
      avatar_static: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
      bot: false,
      created_at: '2020-07-26T19:37:31.000Z',
      display_name: 'mk',
      emojis: [],
      fields: [
        {
          name: 'website',
          value: '<a href="http://marykatefain.com" rel="ugc">marykatefain.com</a>'
        }
      ],
      followers_count: 2,
      following_count: 1,
      header: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
      header_static: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
      id: '9xUIiQfGrdPJDZe39s',
      locked: false,
      note: 'a bio about me',
      pleroma: {
        accepts_chat_messages: true,
        ap_id: 'https://localhost/users/mk',
        background_image: null,
        is_confirmed: true,
        favicon: null,
        hide_favorites: true,
        hide_followers: false,
        hide_followers_count: false,
        hide_follows: false,
        hide_follows_count: false,
        is_admin: true,
        is_moderator: false,
        relationship: {},
        skip_thread_containment: false,
        tags: [
          'verified'
        ]
      },
      source: {
        fields: [
          {
            name: 'website',
            value: 'marykatefain.com'
          }
        ],
        note: 'a bio about me',
        pleroma: {
          actor_type: 'Person',
          discoverable: false
        },
        sensitive: false
      },
      statuses_count: 77,
      url: 'https://localhost/users/mk',
      username: 'mk'
    },
    sender: {
      acct: 'mk',
      avatar: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
      avatar_static: 'http://localhost:4000/media/9051960b674309674f2f1a3a0e05916013260af13f672df32c869cb841958a44.gif',
      bot: false,
      created_at: '2020-07-26T19:37:31.000Z',
      display_name: 'mk',
      emojis: [],
      fields: [
        {
          name: 'website',
          value: '<a href="http://marykatefain.com" rel="ugc">marykatefain.com</a>'
        }
      ],
      followers_count: 2,
      following_count: 1,
      header: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
      header_static: 'http://localhost:4000/media/139889433c4085dcf219171fdcc48659fa3fb5090a748ca37513fda051226b12.gif',
      id: '9xUIiQfGrdPJDZe39s',
      locked: false,
      note: 'a bio about me',
      pleroma: {
        accepts_chat_messages: true,
        ap_id: 'https://localhost/users/mk',
        background_image: null,
        is_confirmed: true,
        favicon: null,
        hide_favorites: true,
        hide_followers: false,
        hide_followers_count: false,
        hide_follows: false,
        hide_follows_count: false,
        is_admin: true,
        is_moderator: false,
        relationship: {},
        skip_thread_containment: false,
        tags: [
          'verified'
        ]
      },
      source: {
        fields: [
          {
            name: 'website',
            value: 'marykatefain.com'
          }
        ],
        note: 'a bio about me',
        pleroma: {
          actor_type: 'Person',
          discoverable: false
        },
        sensitive: false
      },
      statuses_count: 77,
      url: 'https://localhost/users/mk',
      username: 'mk'
    },
    unread: 0,
    updated_at: '2020-08-15T06:43:29.000Z'
  }
]

export const chatMessages = [
  {
    account_id: '9xUIiQfGrdPJDZe39s',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'heyy',
    created_at: '2020-09-11T00:07:13.000Z',
    emojis: [],
    id: '9z22Q9MzWiAk7GZnNY',
    unread: false
  },
  {
    account_id: '9xUIiQfGrdPJDZe39s',
    attachment: {
      description: null,
      id: '-1990764178',
      pleroma: {
        mime_type: 'image/png'
      },
      preview_url: 'http://localhost:4000/media/b087b890b39aa8301f736e8b45c02213183986c8a994c2c99e921ae85afa17e4.png',
      remote_url: 'http://localhost:4000/media/b087b890b39aa8301f736e8b45c02213183986c8a994c2c99e921ae85afa17e4.png',
      text_url: 'http://localhost:4000/media/b087b890b39aa8301f736e8b45c02213183986c8a994c2c99e921ae85afa17e4.png',
      type: 'image',
      url: 'http://localhost:4000/media/b087b890b39aa8301f736e8b45c02213183986c8a994c2c99e921ae85afa17e4.png'
    },
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: null,
    created_at: '2020-09-10T20:35:33.000Z',
    emojis: [],
    id: '9z1jWuQNaq8Ef6fdOS',
    unread: false
  },
  {
    account_id: '9xUIiQfGrdPJDZe39s',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'probably',
    created_at: '2020-09-10T16:57:33.000Z',
    emojis: [],
    id: '9z1Q4eXb9kBYA8rNT6',
    unread: false
  },
  {
    account_id: '9xUj5WTmzSlFPN6OLg',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'That has got to be 20 by now',
    created_at: '2020-09-10T16:57:29.000Z',
    emojis: [],
    id: '9z1Q4LQAF9wuraEfk8',
    unread: false
  },
  {
    account_id: '9xUIiQfGrdPJDZe39s',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'I miss bars :(',
    created_at: '2020-09-10T16:57:22.000Z',
    emojis: [],
    id: '9z1Q3gmlKEfEpnUdm4',
    unread: false
  },
  {
    account_id: '9xUIiQfGrdPJDZe39s',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'Yeah tying to!',
    created_at: '2020-09-10T16:57:15.000Z',
    emojis: [],
    id: '9z1Q307VxCiKVhs6eO',
    unread: false
  },
  {
    account_id: '9xUj5WTmzSlFPN6OLg',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'staying safe with covid and such?',
    created_at: '2020-09-10T16:57:10.000Z',
    emojis: [],
    id: '9z1Q2Z56U3k6ePXIe1',
    unread: false
  },
  {
    account_id: '9xUj5WTmzSlFPN6OLg',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'how have you been?',
    created_at: '2020-09-10T16:57:06.000Z',
    emojis: [],
    id: '9z1Q29XvQHLfSGowxU',
    unread: false
  },
  {
    account_id: '9xUj5WTmzSlFPN6OLg',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'so what are you doing?',
    created_at: '2020-09-10T16:57:02.000Z',
    emojis: [],
    id: '9z1Q1lPb9aQYbUjxeD',
    unread: false
  },
  {
    account_id: '9xUIiQfGrdPJDZe39s',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'crazy',
    created_at: '2020-09-10T16:56:55.000Z',
    emojis: [],
    id: '9z1Q19zQHwVMXbD2DA',
    unread: false
  },
  {
    account_id: '9xUIiQfGrdPJDZe39s',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'omg yeah same',
    created_at: '2020-09-10T16:56:54.000Z',
    emojis: [],
    id: '9z1Q12zWJBQIpsCVtI',
    unread: false
  },
  {
    account_id: '9xUIiQfGrdPJDZe39s',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'hahahaha',
    created_at: '2020-09-10T16:56:51.000Z',
    emojis: [],
    id: '9z1Q0pyKiHkWSQXsjg',
    unread: false
  },
  {
    account_id: '9xUj5WTmzSlFPN6OLg',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'I think this is 13',
    created_at: '2020-09-10T16:56:45.000Z',
    emojis: [],
    id: '9z1Q0Ft6sEBGXnpCb3',
    unread: false
  },
  {
    account_id: '9xUj5WTmzSlFPN6OLg',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'We need to keep typing until we hit 20',
    created_at: '2020-09-10T16:56:42.000Z',
    emojis: [],
    id: '9z1PzywjrTyy08OMOO',
    unread: false
  },
  {
    account_id: '9xUIiQfGrdPJDZe39s',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'That&#39;s nice',
    created_at: '2020-09-10T16:56:03.000Z',
    emojis: [],
    id: '9z1PwOkJzs8orKsJDU',
    unread: false
  },
  {
    account_id: '9xUj5WTmzSlFPN6OLg',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'I&#39;ve been good! Keeping busy',
    created_at: '2020-09-10T16:56:00.000Z',
    emojis: [],
    id: '9z1Pw7qmoaDASSljQv',
    unread: false
  },
  {
    account_id: '9xUIiQfGrdPJDZe39s',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: '*been',
    created_at: '2020-09-10T16:55:55.000Z',
    emojis: [],
    id: '9z1PvcWVHwZFIa2b0y',
    unread: false
  },
  {
    account_id: '9xUIiQfGrdPJDZe39s',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'How have you ben?',
    created_at: '2020-09-10T16:55:52.000Z',
    emojis: [],
    id: '9z1PvK4BuTE03YejNw',
    unread: false
  },
  {
    account_id: '9xUIiQfGrdPJDZe39s',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'Oh it&#39;s okay! No worries!',
    created_at: '2020-09-10T16:55:44.000Z',
    emojis: [],
    id: '9z1Puc4hTDUJcOYW4O',
    unread: false
  },
  {
    account_id: '9xUj5WTmzSlFPN6OLg',
    attachment: null,
    card: null,
    chat_id: '9y8e7ESoVUiKVMAoCW',
    content: 'didn&#39;t mean to ignore you',
    created_at: '2020-09-10T16:55:32.000Z',
    emojis: [],
    id: '9z1PtWGNamQTIvUspk',
    unread: false
  }
]
+54 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

export async function addNewEmojiFile(packName, file, shortcode, filename, host, token) {
  return Promise.resolve()
}

export function addressOfEmojiInPack(host, packName, name) {
  return Promise.resolve()
}

export async function createPack(host, token, packName) {
  return Promise.resolve()
}

export async function deleteEmojiFile(packName, shortcode, host, token) {
  return Promise.resolve()
}

export async function deletePack(host, token, packName) {
  return Promise.resolve()
}

export async function downloadFrom(instanceAddress, packName, as, host, token) {
  return Promise.resolve()
}

export async function fetchPack(packName, page, pageSize, host, token) {
  return Promise.resolve()
}

export async function importFromFS(host, token) {
  return Promise.resolve()
}

export async function listPacks(page, pageSize, host, token) {
  return Promise.resolve()
}

export async function listRemotePacks(instance, page, pageSize, host, token) {
  return Promise.resolve()
}

export async function reloadEmoji(host, token) {
  return Promise.resolve()
}

export async function savePackMetadata(host, token, packName, metadata) {
  return Promise.resolve()
}

export async function updateEmojiFile(packName, shortcode, newShortcode, newFilename, force, host, token) {
  return Promise.resolve()
}
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

let inviteTokens = [
  { expires_at: '01-01-2020', id: 1, invite_type: 'one_time', max_use: 3, token: 'DCN8XyTsVEuz9_KuxPlkbH1RgMsMHepwmZE2gyX07Jw=', used: false, uses: 1 },
  { expires_at: '02-02-2020', id: 2, invite_type: 'one_time', max_use: 1, token: 'KnJTHNedj2Mh14ckx06t-VfOuFL8oNA0nVAK1HLeLf4=', used: true, uses: 1 },
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

const users = [
  { username: 'bob', password: '123456', authHost: 'pleroma' }
]
@@ -8,7 +11,7 @@ export async function loginByUsername(username, password, authHost) {
  const verifyHost = user.authHost === authHost
  const data = {
    'token_type': 'Bearer',
    'scope': 'read write follow',
    'scope': 'read write follow push admin',
    'refresh_token': 'foo123',
    'me': 'bob',
    'expires_in': 600,
@@ -43,7 +46,7 @@ export function getUserInfo(token, authHost) {
    'statuses_count': 0,
    'cover_photo': '',
    'hide_follows': false,
    'pleroma': { 'confirmation_pending': false, 'deactivated': false, 'tags': ['force_nsfw'], 'is_admin': true },
    'pleroma': { 'is_confirmed': true, 'is_active': true, 'tags': ['force_nsfw'], 'is_admin': true },
    'profile_image_url_original': '',
    'created_at': 'Fri Mar 01 15:15:19 +0000 2019',
    'fields': [],
+23 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

const urls = [
  'http://example.com/media/a688346.jpg',
  'http://example.com/media/fb1f4d.jpg'
]

export async function listBannedUrls(page, pageSize, authHost, token) {
  return Promise.resolve({ data: { page_size: 1, count: 2, urls }})
}

export async function purgeUrls(urls, ban, authHost, token) {
  return Promise.resolve()
}

export async function removeBannedUrls(urls, authHost, token) {
  return Promise.resolve()
}

export async function searchBannedUrls(query, page, pageSize, authHost, token) {
  return Promise.resolve()
}
+6 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

export function uploadMedia({ formData, authHost }) {
  return Promise.resolve()
}
+14 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

export async function fetchLog(authHost, token, params, page = 1) {
  return Promise.resolve()
}

export async function fetchAdmins(authHost, token) {
  return Promise.resolve()
}

export async function fetchModerators(authHost, token) {
  return Promise.resolve()
}
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

export async function getNodeInfo(authHost) {
  const data = {
    metadata: {
+7 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

export async function fetchPeers(authHost, token) {
  const data = ['lain.com', 'heaven.com']
  return Promise.resolve({ data })
}
+14 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

export async function fetchRelays(authHost, token) {
  return Promise.resolve()
}

export async function addRelay(relay_url, authHost, token) {
  return Promise.resolve()
}

export async function deleteRelay(relay_url, authHost, token) {
  return Promise.resolve()
}
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

const reports = [
  { created_at: '2019-05-21T21:35:33.000Z', account: { acct: 'benj', display_name: 'Benjamin Fame', tags: [] }, actor: { acct: 'admin' }, state: 'open', id: '2', content: 'This is a report', statuses: [] },
  { created_at: '2019-05-20T22:45:33.000Z', account: { acct: 'alice', display_name: 'Alice Pool', tags: [] }, actor: { acct: 'admin2' }, state: 'resolved', id: '1', content: 'Please block this user', statuses: [] },
  { created_at: '2019-05-18T13:01:33.000Z', account: { acct: 'nick', display_name: 'Nick Keys', tags: [] }, actor: { acct: 'admin' }, state: 'closed', id: '3', content: '', statuses: [] },
  { created_at: '2019-05-21T21:35:33.000Z', account: { acct: 'benj', display_name: 'Benjamin Fame', tags: [] }, actor: { acct: 'admin' }, state: 'open', id: '5', content: 'This is a report', statuses: [] },
  { created_at: '2019-05-20T22:45:33.000Z', account: { acct: 'alice', display_name: 'Alice Pool', tags: [] }, actor: { acct: 'admin2' }, state: 'resolved', id: '7', content: 'Please block this user', statuses: [
    { account: { display_name: 'Alice Pool', avatar: '' }, visibility: 'public', sensitive: false, id: '11', content: 'Hey!', url: '', created_at: '2019-05-10T21:35:33.000Z' },
    { account: { display_name: 'Alice Pool', avatar: '' }, visibility: 'unlisted', sensitive: true, id: '10', content: 'Bye!', url: '', created_at: '2019-05-10T21:00:33.000Z' }
  { created_at: '2019-05-21T21:35:33.000Z', account: { nickname: 'benjamin', tags: [] }, actor: {}, state: 'open', id: '2', content: 'This is a report', statuses: [] },
  { created_at: '2019-05-20T22:45:33.000Z', account: { nickname: 'alice', tags: [] }, actor: {}, state: 'resolved', id: '1', content: 'Please block this user', statuses: [] },
  { created_at: '2019-05-18T13:01:33.000Z', account: { nickname: 'nick_keys', tags: [] }, actor: {}, state: 'closed', id: '3', content: '', statuses: [] },
  { created_at: '2019-05-21T21:35:33.000Z', account: { nickname: 'benjamin', tags: [] }, actor: {}, state: 'open', id: '5', content: 'This is a report', statuses: [] },
  { created_at: '2019-05-20T22:45:33.000Z', account: { nickname: 'alice', tags: [] }, actor: {}, state: 'resolved', id: '7', content: 'Please block this user', statuses: [
    { account: { nickname: 'alice', avatar: '' }, visibility: 'public', sensitive: false, id: '11', content: 'Hey!', url: '', created_at: '2019-05-10T21:35:33.000Z' },
    { account: { nickname: 'alice', avatar: '' }, visibility: 'unlisted', sensitive: true, id: '10', content: 'Bye!', url: '', created_at: '2019-05-10T21:00:33.000Z' }
  ] },
  { created_at: '2019-05-18T13:01:33.000Z', account: { acct: 'nick', display_name: 'Nick Keys', tags: [] }, actor: { acct: 'admin' }, state: 'closed', id: '6', content: '', statuses: [] },
  { created_at: '2019-05-18T13:01:33.000Z', account: { acct: 'nick', display_name: 'Nick Keys', tags: [] }, actor: { acct: 'admin' }, state: 'closed', id: '4', content: '', statuses: [] }
  { created_at: '2019-05-18T13:01:33.000Z', account: { nickname: 'nick_keys', tags: [] }, actor: {}, state: 'closed', id: '6', content: '', statuses: [] },
  { created_at: '2019-05-18T13:01:33.000Z', account: { nickname: 'nick_keys', tags: [] }, actor: {}, state: 'closed', id: '4', content: '', statuses: [] }
]

export async function fetchReports(limit, max_id, authHost, token) {
  const paginatedReports = max_id.length > 0 ? reports.slice(5) : reports.slice(0, 5)
  return Promise.resolve({ data: { reports: paginatedReports }})
}

export async function filterReports(filter, limit, max_id, authHost, token) {
  const filteredReports = reports.filter(report => report.state === filter)
  const paginatedReports = max_id.length > 0 ? filteredReports.slice(5) : filteredReports.slice(0, 5)
  return Promise.resolve({ data: { reports: paginatedReports }})
export async function fetchReports(filter, page, pageSize, authHost, token) {
  return filter.length > 0
    ? Promise.resolve({ data: { reports: reports.filter(report => report.state === filter) }})
    : Promise.resolve({ data: { reports }})
}

export async function changeState(state, id, authHost, token) {
  const report = reports.find(report => report.id === id)
  return Promise.resolve({ data: { ...report, state }})
export async function changeState(reportsData, authHost, token) {
  return Promise.resolve({ data: '' })
}

export async function changeStatusScope(id, sensitive, visibility, authHost, token) {
  const status = reports[4].statuses[0]
  return Promise.resolve({ data: { ...status, sensitive, visibility }})
export async function createNote(content, reportID, authHost, token) {
  return Promise.resolve()
}

export async function deleteStatus(statusId, authHost, token) {
export async function deleteNote(noteID, reportID, authHost, token) {
  return Promise.resolve()
}

// export async function changeStatusScope(id, sensitive, visibility, authHost, token) {
//   const status = reports[4].statuses[0]
//   return Promise.resolve({ data: { ...status, sensitive, visibility }})
// }

// export async function deleteStatus(statusId, authHost, token) {
//   return Promise.resolve()
// }
+62 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

const configsWithTagPolicy = {
  configs: [{
    group: ':pleroma',
    key: ':mrf',
    value: [
      { tuple: [':policies', ['Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy', 'Pleroma.Web.ActivityPub.MRF.TagPolicy']] },
      { tuple: [':transparency', true] },
      { tuple: [':transparency_exclusions', []] }
    ] },
  {
    group: ':pleroma',
    key: ':media_proxy',
    value: [
      { tuple: [':enabled', true] },
      { tuple: [':invalidation', [
        { tuple: [':provider', 'Pleroma.Web.MediaProxy.Invalidation.Script'] },
        { tuple: [':enabled', true] }
      ]] }
    ] }],
  need_reboot: false
}

const configAfterUpdate = {
  configs: [{
    db: [':policies'],
    group: ':pleroma',
    key: ':mrf',
    value: [{ tuple: [':policies', ['Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy', 'Pleroma.Web.ActivityPub.MRF.TagPolicy']] }]
  }],
  need_reboot: false
}

export async function fetchSettings(authHost, token) {
  return Promise.resolve({ data: configsWithTagPolicy })
}

export async function getInstanceDocument(name, authHost, token) {
  return Promise.resolve({ data: '<h1>Instance panel</h1>' })
}

export async function updateSettings(configs, authHost, token) {
  return Promise.resolve({ data: configAfterUpdate })
}

export async function deleteInstanceDocument(name, authHost, token) {
  return Promise.resolve()
}

export async function fetchDescription(authHost, token) {
  return Promise.resolve()
}

export async function updateInstanceDocument(name, formData, authHost, token) {
  return Promise.resolve()
}

export async function removeSettings(configs, authHost, token) {
  return Promise.resolve()
}
+100 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

export async function changeStatusScope(id, sensitive, visibility, authHost, token) {
  return Promise.resolve()
}

export async function deleteStatus(id, authHost, token) {
  return Promise.resolve()
}

export async function fetchStatus(id, authHost, token) {
  const data = {
    account: {
      id: '9n1bySks25olxWrku0',
      avatar: 'http://localhost:4000/images/avi.png',
      nickname: 'dolin',
      tags: ['mrf_tag:media-strip', 'mrf_tag:sandbox', 'mrf_tag:disable-any-subscription', 'mrf_tag:media-force-nsfw'],
      url: 'http://localhost:4000/users/dolin'
    },
    content: 'pizza makes everything better',
    created_at: '2020-05-22T17:34:34.000Z',
    id: '9vJOO3iFPyjNaEhJ5s',
    media_attachments: [],
    poll: null,
    sensitive: false,
    spoiler_text: '',
    visibility: 'public',
    url: 'http://localhost:4000/notice/9vJOO3iFPyjNaEhJ5s'
  }

  return Promise.resolve({ data })
}

export async function fetchStatusesByInstance({ instance, authHost, token, pageSize, page }) {
  let data
  if (pageSize === 1) {
    data = page === 1 || page === 2
      ? [{
        'account': {
          'avatar': 'http://localhost:4000/images/avi.png',
          'nickname': 'sky',
          'url': 'http://localhost:4000/users/sky'
        },
        'content': 'A nice young couple contacted us from Brazil to decorate their newly acquired apartment.',
        'created_at': '2020-01-31T18:20:01.000Z',
        'id': '9rZIr0Jzao5Gjgfmro',
        'sensitive': false,
        'url': 'http://localhost:4000/objects/7af9abbd-fb6c-4318-aeb7-6636c138ac98',
        'visibility': 'unlisted'
      }]
      : []
  } else {
    data = [
      {
        'account': {
          'avatar': 'http://localhost:4000/images/avi.png',
          'nickname': 'sky',
          'url': 'http://localhost:4000/users/sky'
        },
        'content': 'i love parks&rec',
        'created_at': '2020-04-12T18:20:01.000Z',
        'id': 'o5Gjgfmro9rZIr0Jza',
        'sensitive': false,
        'url': 'http://localhost:4000/objects/7af9abbd-aeb7-6636c138ac98-fb6c-4318',
        'visibility': 'unlisted'
      },
      {
        'account': {
          'avatar': 'http://localhost:4000/images/avi.png',
          'nickname': 'sky',
          'url': 'http://localhost:4000/users/sky'
        },
        'content': 'the happiest man ever',
        'created_at': '2019-11-23T12:56:18.000Z',
        'id': '9pFoVfWMU3A96Rzq3k',
        'sensitive': false,
        'url': 'http://localhost:4000/objects/449c90fe-c457-4c64-baf2-fe6d0a59ca25',
        'visibility': 'unlisted'
      }]
  }
  return Promise.resolve({ data })
}

export async function fetchStatusesCount(instance, authHost, token) {
  const data = instance === 'heaven.com'
    ? {
      'status_visibility':
      { 'direct': 1, 'private': 2, 'public': 3, 'unlisted': 0 }
    }
    : {
      'status_visibility':
      { 'direct': 4, 'private': 10, 'public': 4, 'unlisted': 10 }
    }
  return Promise.resolve({ data })
}

export async function fetchStatuses({ godmode, localOnly, authHost, token, pageSize, page }) {
  return Promise.resolve()
}
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import userChats from './chat'

export let users = [
  { active: true, deactivated: false, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [] },
  { active: true, deactivated: false, id: '10', nickname: 'bob', local: false, external: true, roles: { admin: false, moderator: false }, tags: ['sandbox'] },
  { active: false, deactivated: true, id: 'abc', nickname: 'john', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['strip_media'] }
  { is_confirmed: true, is_approved: true, is_active: true, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [], actor_type: 'Person' },
  { is_confirmed: true, is_approved: true, is_active: true, id: '10', nickname: 'bob', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:sandbox'], actor_type: 'Person' },
  { is_confirmed: true, is_approved: false, is_active: true, id: '567', nickname: 'ded', local: false, external: true, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Person' },
  { is_confirmed: true, is_approved: true, is_active: false, id: 'abc', nickname: 'john', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:media-strip'], actor_type: 'Person' },
  { is_confirmed: true, is_approved: false, is_active: true, id: '100', nickname: 'sally', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Service' },
  { is_confirmed: true, is_approved: false, is_active: true, id: '123', nickname: 'bot', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Application' }
]

const filterUsers = (str) => {
  const filters = str.split(',').filter(item => item.length > 0)
  if (filters.length === 0) {
    return users
  }
  const applyFilters = (acc, filters, users) => {
    if (filters.length === 0) {
      return acc
    }
    const filteredUsers = users.filter(user => user[filters[0]])
    const newAcc = [...filteredUsers]
    return applyFilters(newAcc, filters.slice(1), filteredUsers)
const userProfile = { avatar: 'avatar.jpg', nickname: 'allis', id: '2', tags: [], roles: { admin: true, moderator: false }, local: true, external: false }

const userStatuses = [
  { account: { id: '9n1bySks25olxWrku0', nickname: 'dolin' }, content: 'pizza makes everything better', id: '9vJOO3iFPyjNaEhJ5s', created_at: '2020-05-22T17:34:34.000Z', visibility: 'public' },
  { account: { id: '9n1bySks25olxWrku0', nickname: 'dolin' }, content: 'pizza time', id: '9vJPD5XKOdzQ0bvGLY', created_at: '2020-05-22T17:34:34.000Z', visibility: 'public' },
  { account: { id: '9n1bySks25olxWrku0', nickname: 'dolin' }, content: 'what is yout favorite pizza?', id: '9jop82OBXeFPYulVjM', created_at: '2020-05-22T17:34:34.000Z', visibility: 'public' }
]

export async function fetchUser(id, authHost, token) {
  return Promise.resolve({ data: userProfile })
}
  return applyFilters([], filters, users)

export async function fetchUserCredentials(nickname, authHost, token) {
  return Promise.resolve({ data: {}})
}

export async function fetchUsers(filters, authHost, token, page = 1) {
  const filteredUsers = filterUsers(filters)
export async function fetchUsers(filters, actorTypeFilters, authHost, token, page = 1) {
  return Promise.resolve({ data: {
    users: filteredUsers,
    count: filteredUsers.length,
    users,
    count: users.length,
    page_size: 50
  }})
}

export async function getPasswordResetToken(nickname, authHost, token) {
  return Promise.resolve({ data: { token: 'g05lxnBJQnL', link: 'http://url/api/pleroma/password_reset/g05lxnBJQnL' }})
export async function fetchUserStatuses(id, authHost, godmode, token) {
  return Promise.resolve({ data: userStatuses })
}

export async function toggleUserActivation(nickname, authHost, token) {
  const response = users.find(user => user.nickname === nickname)
  return Promise.resolve({ data: { ...response, deactivated: !response.deactivated }})
export async function fetchUserChats(id, authHost, godmode, token) {
  return Promise.resolve({ data: userChats })
}

export async function searchUsers(query, filters, authHost, token, page = 1) {
  const filteredUsers = filterUsers(filters)
  const response = filteredUsers.filter(user => user.nickname === query)
export async function getPasswordResetToken(nickname, authHost, token) {
  return Promise.resolve({ data: { token: 'g05lxnBJQnL', link: 'http://url/api/pleroma/password_reset/g05lxnBJQnL' }})
}

export async function searchUsers(query, filters, actorTypeFilters, authHost, token, page = 1) {
  const response = users.filter(user => user.nickname === query)
  return Promise.resolve({ data: {
    users: response,
    count: response.length,
@@ -48,21 +57,45 @@ export async function searchUsers(query, filters, authHost, token, page = 1) {
  }})
}

export async function addRight(nickname, right, authHost, token) {
export async function activateUsers(nicknames, authHost, token) {
  const response = nicknames.map(nickname => {
    const currentUser = users.find(user => user.nickname === nickname)
    return { ...currentUser, is_active: true }
  })
  return Promise.resolve({ data: response })
}

export async function addRight(nicknames, right, authHost, token) {
  return Promise.resolve({ data:
    { [`is_${right}`]: true }
  })
}

export async function deactivateUsers(nicknames, authHost, token) {
  const response = nicknames.map(nickname => {
    const currentUser = users.find(user => user.nickname === nickname)
    return { ...currentUser, is_active: false }
  })
  return Promise.resolve({ data: response })
}

export async function approveUserAccount(nicknames, authHost, token) {
  const response = nicknames.map(nickname => {
    const currentUser = users.find(user => user.nickname === nickname)
    return { ...currentUser, is_approved: true }
  })
  return Promise.resolve({ data: response })
}

export async function deleteRight(nickname, right, authHost, token) {
  return Promise.resolve({ data:
    { [`is_${right}`]: false }
  })
}

export async function deleteUser(nickname, authHost, token) {
export async function deleteUsers(nicknames, authHost, token) {
  return Promise.resolve({ data:
    nickname
    nicknames
  })
}

@@ -75,7 +108,27 @@ export async function untagUser(nickname, tag, authHost, token) {
}

export async function createNewAccount(nickname, email, password, authHost, token) {
  const newUser = { active: true, deactivated: false, id: '15', nickname, local: true, external: false, roles: { admin: false, moderator: false }, tags: [] }
  const newUser = { active: true, is_active: true, id: '15', nickname, local: true, external: false, roles: { admin: false, moderator: false }, tags: [] }
  users = [...users, newUser]
  return Promise.resolve()
}

export async function updateUserCredentials(nickname, credentials, authHost, token) {
  return Promise.resolve()
}

export async function disableMfa(nickname, authHost, token) {
  return Promise.resolve()
}

export async function forcePasswordReset(nicknames, authHost, token) {
  return Promise.resolve()
}

export async function confirmUserEmail(nicknames, authHost, token) {
  return Promise.resolve()
}

export async function resendConfirmationEmail(nicknames, authHost, token) {
  return Promise.resolve()
}

src/api/app.js

0 → 100644
+26 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'

export async function needReboot(authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/need_reboot`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function restartApp(authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/restart`,
    method: 'get',
    headers: authHeaders(token)
  })
}

const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {}

src/api/chat.js

0 → 100644
+38 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'

export async function deleteChatMessage(chat_id, message_id, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/chats/${chat_id}/messages/${message_id}`,
    method: 'delete',
    headers: authHeaders(token)
  })
}

export async function fetchChat(id, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/chats/${id}`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function fetchChatMessages(id, maxId, authHost, token) {
  const url = maxId
    ? `/api/pleroma/admin/chats/${id}/messages?max_id=${maxId}`
    : `/api/pleroma/admin/chats/${id}/messages`
  return await request({
    baseURL: baseName(authHost),
    url,
    method: 'get',
    headers: authHeaders(token)
  })
}

const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {}
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'

import _ from 'lodash'

export async function deletePack(host, token, name) {
  return await request({
    baseURL: baseName(host),
    url: `/api/pleroma/emoji/packs/${name}`,
    method: 'delete',
    headers: authHeaders(token)
  })
export async function addNewEmojiFile(packName, file, shortcode, filename, host, token) {
  const data = new FormData()
  if (filename.trim() !== '') {
    data.set('filename', filename)
  }
  if (shortcode.trim() !== '') {
    data.set('shortcode', shortcode)
  }
  data.set('file', file)

export async function reloadEmoji(host, token) {
  return await request({
    baseURL: baseName(host),
    url: '/api/pleroma/admin/reload_emoji',
    url: `/api/pleroma/emoji/packs/files?name=${packName}`,
    method: 'post',
    headers: authHeaders(token)
    headers: authHeaders(token),
    data
  })
}

export async function importFromFS(host, token) {
export function addressOfEmojiInPack(host, packName, name) {
  return `${baseName(host)}/emoji/${encodeUri(packName)}/${name}`
}

export async function createPack(host, token, packName) {
  return await request({
    baseURL: baseName(host),
    url: '/api/pleroma/emoji/packs/import_from_fs',
    url: `/api/pleroma/emoji/pack?name=${packName}`,
    method: 'post',
    headers: authHeaders(token)
  })
}

export async function createPack(host, token, name) {
export async function deleteEmojiFile(packName, shortcode, host, token) {
  return await request({
    baseURL: baseName(host),
    url: `/api/pleroma/emoji/packs/${name}`,
    method: 'put',
    url: `/api/pleroma/emoji/packs/files?name=${packName}&shortcode=${shortcode}`,
    method: 'delete',
    headers: authHeaders(token)
  })
}

export async function listPacks(host) {
export async function deletePack(host, token, packName) {
  return await request({
    baseURL: baseName(host),
    url: `/api/pleroma/emoji/packs/`,
    method: 'get'
    url: `/api/pleroma/emoji/pack?name=${packName}`,
    method: 'delete',
    headers: authHeaders(token)
  })
}

export async function listRemotePacks(host, token, instance) {
export async function downloadFrom(instanceAddress, packName, as, host, token) {
  return await request({
    baseURL: baseName(host),
    url: `/api/pleroma/emoji/packs/list_from`,
    url: '/api/pleroma/emoji/packs/download',
    method: 'post',
    headers: authHeaders(token),
    data: { instance_address: baseName(instance) }
    data: as.trim() === ''
      ? { url: baseName(instanceAddress), name: packName }
      : { url: baseName(instanceAddress), name: packName, as },
    timeout: 0
  })
}

export async function downloadFrom(host, instance_address, pack_name, as, token) {
  if (as.trim() === '') {
    as = null
  }

export async function fetchPack(packName, page, pageSize, host, token) {
  return await request({
    baseURL: baseName(host),
    url: '/api/pleroma/emoji/packs/download_from',
    method: 'post',
    headers: authHeaders(token),
    data: { instance_address: baseName(instance_address), pack_name, as },
    timeout: 0
    url: `/api/pleroma/emoji/pack?name=${packName}&page=${page}&page_size=${pageSize}`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function savePackMetadata(host, token, name, new_data) {
export async function importFromFS(host, token) {
  return await request({
    baseURL: baseName(host),
    url: `/api/pleroma/emoji/packs/${name}/update_metadata`,
    method: 'post',
    headers: authHeaders(token),
    data: { name, new_data },
    timeout: 0 // This might take a long time
    url: '/api/pleroma/emoji/packs/import',
    method: 'get',
    headers: authHeaders(token)
  })
}

function fileUpdateFormData(d) {
  const data = new FormData()

  _.each(d, (v, k) => {
    data.set(k, v)
export async function listPacks(page, pageSize, host, token) {
  return await request({
    baseURL: baseName(host),
    url: `/api/pleroma/emoji/packs?page=${page}&page_size=${pageSize}`,
    method: 'get',
    headers: authHeaders(token)
  })

  return data
}

export async function updatePackFile(host, token, args) {
  let data = null

  switch (args.action) {
    case 'add': {
      const { shortcode, file, fileName } = args

      data = fileUpdateFormData({
        action: 'add',
        shortcode: shortcode,
        file: file
export async function listRemotePacks(instance, page, pageSize, host, token) {
  return await request({
    baseURL: baseName(host),
    url: `/api/pleroma/emoji/packs/remote?url=${baseName(instance)}&page=${page}&page_size=${pageSize}`,
    method: 'get',
    headers: authHeaders(token)
  })
      if (fileName.trim() !== '') {
        data.set('filename', fileName)
      }

      break
}

    case 'update': {
      const { oldName, newName, newFilename } = args

      data = fileUpdateFormData({
        action: 'update',
        shortcode: oldName,
        new_shortcode: newName,
        new_filename: newFilename
export async function reloadEmoji(host, token) {
  return await request({
    baseURL: baseName(host),
    url: '/api/pleroma/admin/reload_emoji',
    method: 'post',
    headers: authHeaders(token)
  })

      break
}

    case 'remove': {
      const { name } = args
      data = fileUpdateFormData({
        action: 'remove',
        shortcode: name
export async function savePackMetadata(host, token, packName, metadata) {
  return await request({
    baseURL: baseName(host),
    url: `/api/pleroma/emoji/pack?name=${packName}`,
    method: 'patch',
    headers: authHeaders(token),
    data: { metadata },
    timeout: 0 // This might take a long time
  })

      break
}
  }

  const { packName } = args

export async function updateEmojiFile(packName, shortcode, newShortcode, newFilename, force, host, token) {
  return await request({
    baseURL: baseName(host),
    url: `/api/pleroma/emoji/packs/${packName}/update_file`,
    method: 'post',
    url: `/api/pleroma/emoji/packs/files?name=${packName}`,
    method: 'patch',
    headers: authHeaders(token),
    data: data,
    timeout: 0
    data: { shortcode, new_shortcode: newShortcode, new_filename: newFilename, force }
  })
}

export function addressOfEmojiInPack(host, packName, name) {
  return `${baseName(host)}/emoji/${packName}/${name}`
}

const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {}

const encodeUri = (name) => encodeURIComponent(name)

src/api/initialDataForConfig.js

deleted100644 → 0
+0 −117
Original line number Diff line number Diff line
export const initialSettings = [
  {
    group: 'pleroma',
    key: ':instance',
    value: [
      { 'tuple': [':name', 'Pleroma'] },
      { 'tuple': [':email', 'example@example.com'] },
      { 'tuple': [':notify_email', 'noreply@example.com'] },
      { 'tuple': [':description', 'A Pleroma instance, an alternative fediverse server'] },
      { 'tuple': [':limit', 5000] },
      { 'tuple': [':remote_limit', 100000] },
      { 'tuple': [':upload_limit', 16 * 1048576] },
      { 'tuple': [':avatar_upload_limit', 2 * 1048576] },
      { 'tuple': [':background_upload_limit', 4 * 1048576] },
      { 'tuple': [':banner_upload_limit', 4 * 1048576] },
      { 'tuple': [':poll_limits', [
        { 'tuple': [':max_options', 20] },
        { 'tuple': [':max_option_chars', 200] },
        { 'tuple': [':min_expiration', 0] },
        { 'tuple': [':max_expiration', 365 * 86400] }
      ]] },
      { 'tuple': [':registrations_open', true] },
      { 'tuple': [':invites_enabled', false] },
      { 'tuple': [':account_activation_required', false] },
      { 'tuple': [':federating', true] },
      { 'tuple': [':federation_reachability_timeout_days', 7] },
      { 'tuple':
        [':federation_publisher_modules', ['Pleroma.Web.ActivityPub.Publisher', 'Pleroma.Web.Websub', 'Pleroma.Web.Salmon']] },
      { 'tuple': [':allow_relay', true] },
      { 'tuple': [':rewrite_policy', 'Pleroma.Web.ActivityPub.MRF.NoOpPolicy'] },
      { 'tuple': [':public', true] },
      { 'tuple': [':managed_config', true] },
      { 'tuple': [':static_dir', 'instance/static/'] },
      { 'tuple': [':allowed_post_formats', ['text/plain', 'text/html', 'text/markdown', 'text/bbcode']] },
      { 'tuple': [':mrf_transparency', true] },
      { 'tuple': [':extended_nickname_format', false] },
      { 'tuple': [':max_pinned_statuses', 1] },
      { 'tuple': [':no_attachment_links', false] },
      { 'tuple': [':max_report_comment_size', 1000] },
      { 'tuple': [':safe_dm_mentions', false] },
      { 'tuple': [':healthcheck', false] },
      { 'tuple': [':remote_post_retention_days', 90] },
      { 'tuple': [':skip_thread_containment', true] },
      { 'tuple': [':limit_to_local_content', ':unauthenticated'] },
      { 'tuple': [':dynamic_configuration', true] },
      { 'tuple': [':max_account_fields', 10] },
      { 'tuple': [':max_remote_account_fields', 20] },
      { 'tuple': [':account_field_name_length', 255] },
      { 'tuple': [':account_field_value_length', 255] },
      { 'tuple': [':external_user_synchronization', true] },
      { 'tuple': [':user_bio_length', 5000] },
      { 'tuple': [':user_name_length', 100] }
    ]
  },
  {
    group: 'mime',
    key: ':types',
    value: {
      'application/activity+json': ['activity+json'],
      'application/jrd+json': ['jrd+json'],
      'application/ld+json': ['activity+json'],
      'application/xml': ['xml'],
      'application/xrd+xml': ['xrd+xml']
    }
  },
  {
    group: 'cors_plug',
    key: ':max_age',
    value: 86400
  },
  {
    group: 'cors_plug',
    key: ':methods',
    value: ['POST', 'PUT', 'DELETE', 'GET', 'PATCH', 'OPTIONS']
  },
  {
    group: 'cors_plug',
    key: ':expose',
    value: [
      'Link',
      'X-RateLimit-Reset',
      'X-RateLimit-Limit',
      'X-RateLimit-Remaining',
      'X-Request-Id',
      'Idempotency-Key'
    ]
  },
  {
    group: 'cors_plug',
    key: ':credentials',
    value: true
  },
  {
    group: 'cors_plug',
    key: ':headers',
    value: ['Authorization', 'Content-Type', 'Idempotency-Key']
  },
  {
    group: 'tesla',
    key: ':adapter',
    value: 'Tesla.Adapter.Hackney'
  },
  {
    group: 'pleroma',
    key: ':markup',
    value: [
      { 'tuple': [':allow_inline_images', true] },
      { 'tuple': [':allow_headings', false] },
      { 'tuple': [':allow_tables', false] },
      { 'tuple': [':allow_fonts', false] },
      { 'tuple': [':scrub_policy', [
        'Pleroma.HTML.Transform.MediaProxy',
        'Pleroma.HTML.Scrubber.Default'
      ]] }
    ]
  }
]
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'
@@ -13,14 +16,13 @@ export async function generateInviteToken(max_use, expires_at, authHost, token)
}

export async function inviteViaEmail(email, name, authHost, token) {
  const url = name.length > 0
    ? `/api/pleroma/admin/users/email_invite?email=${email}&name=${name}`
    : `/api/pleroma/admin/users/email_invite?email=${email}`
  const data = name.length > 0 ? { email, name } : { email }
  return await request({
    baseURL: baseName(authHost),
    url,
    url: '/api/pleroma/admin/users/email_invite',
    method: 'post',
    headers: authHeaders(token)
    headers: authHeaders(token),
    data
  })
}

Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2017-2019 PanJiaChen <https://github.com/PanJiaChen/vue-element-admin>
// SPDX-License-Identifier: MIT
//
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { baseName } from './utils'

@@ -9,7 +15,7 @@ export async function loginByUsername(username, password, authHost) {
    data: {
      client_name: `AdminFE_${Math.random()}`,
      redirect_uris: `${window.location.origin}/oauth-callback`,
      scopes: 'read write follow'
      scopes: 'read write follow push admin'
    }
  })

+46 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'

export async function listBannedUrls(page, pageSize, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/media_proxy_caches?page=${page}&page_size=${pageSize}`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function purgeUrls(urls, ban, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/media_proxy_caches/purge`,
    method: 'post',
    headers: authHeaders(token),
    data: { urls, ban }
  })
}

export async function removeBannedUrls(urls, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/media_proxy_caches/delete`,
    method: 'post',
    headers: authHeaders(token),
    data: { urls }
  })
}

export async function searchBannedUrls(query, page, pageSize, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/media_proxy_caches?query=${query}&page=${page}&page_size=${pageSize}`,
    method: 'get',
    headers: authHeaders(token)
  })
}

const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {}

src/api/mediaUpload.js

0 → 100644
+22 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import { getToken } from '@/utils/auth'
import { baseName } from './utils'

const UPLOAD_URL = '/api/v1/media'

export function uploadMedia({ formData, authHost }) {
  const url = baseName(authHost) + UPLOAD_URL

  return fetch(url, {
    body: formData,
    method: 'POST',
    headers: authHeaders()
  })
    .then((data) => data.json())
}

const authHeaders = () => {
  return { 'Authorization': `Bearer ${getToken()}` }
}
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import _ from 'lodash'

import request from '@/utils/request'
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { baseName } from './utils'

src/api/peers.js

0 → 100644
+17 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'

export async function fetchPeers(authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/v1/instance/peers`,
    method: 'get',
    headers: authHeaders(token)
  })
}

const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {}

src/api/relays.js

0 → 100644
+37 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'

export async function fetchRelays(authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: '/api/pleroma/admin/relay',
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function addRelay(relay_url, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: '/api/pleroma/admin/relay',
    method: 'post',
    headers: authHeaders(token),
    data: { relay_url }
  })
}

export async function deleteRelay(relay_url, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: '/api/pleroma/admin/relay',
    method: 'delete',
    headers: authHeaders(token),
    data: { relay_url }
  })
}

const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {}
+25 −19
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'

export async function changeState(state, id, authHost, token) {
export async function changeState(reports, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/reports/${id}`,
    method: 'put',
    url: `/api/pleroma/admin/reports`,
    method: 'patch',
    headers: authHeaders(token),
    data: { state }
    data: { reports }
  })
}

export async function changeStatusScope(id, sensitive, visibility, authHost, token) {
export async function fetchReports(filter, page, pageSize, authHost, token) {
  const url = filter.length > 0
    ? `/api/pleroma/admin/reports?state=${filter}&page=${page}&page_size=${pageSize}`
    : `/api/pleroma/admin/reports?page=${page}&page_size=${pageSize}`
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/statuses/${id}`,
    method: 'put',
    headers: authHeaders(token),
    data: { sensitive, visibility }
    url,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function deleteStatus(id, authHost, token) {
export async function fetchSingleReport(id, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/statuses/${id}`,
    method: 'delete',
    url: `/api/pleroma/admin/reports/${id}`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function fetchReports(limit, max_id, authHost, token) {
export async function createNote(content, reportID, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/reports?limit=${limit}&max_id=${max_id}`,
    method: 'get',
    headers: authHeaders(token)
    url: `/api/pleroma/admin/reports/${reportID}/notes`,
    method: `post`,
    headers: authHeaders(token),
    data: { content }
  })
}

export async function filterReports(filter, limit, max_id, authHost, token) {
export async function deleteNote(noteID, reportID, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/reports?state=${filter}&limit=${limit}&max_id=${max_id}`,
    method: 'get',
    url: `/api/pleroma/admin/reports/${reportID}/notes/${noteID}`,
    method: `delete`,
    headers: authHeaders(token)
  })
}

src/api/reportsData.js

deleted100644 → 0
+0 −218
Original line number Diff line number Diff line
export const reports = [
  {
    id: '1',
    timestamp: '2019/4/12',
    local: true,
    from: 'John', // actor nickname
    object: 'Bob', // user nickname
    header: 'Report #1', // content
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [
      { author: 'Nick', text: 'Lorem ipsum', id: '1', timestamp: '2019/4/13' },
      { author: 'Val', text: 'dolor sit amet', id: '2', timestamp: '2019/4/13' }
    ]
  },
  {
    id: '2',
    timestamp: '2019/4/1',
    local: true,
    from: 'Max',
    object: 'Vic',
    header: 'Report #2',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [
      { author: 'Tony', text: 'consectetur adipiscing elit', id: '3', timestamp: '2019/4/2' },
      { author: 'Zac', text: 'sed do eiusmod tempor incididunt', id: '4', timestamp: '2019/4/3' }
    ]
  },
  {
    id: '3',
    timestamp: '2019/2/28',
    local: true,
    from: 'Tim',
    object: 'Jen',
    header: 'Report #3',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', id: '5', timestamp: '2019/3/1' }]
  },
  {
    id: '4',
    timestamp: '2019/4/12',
    local: true,
    from: 'John', // actor nickname
    object: 'Bob', // user nickname
    header: 'Report #4', // content
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [
      { author: 'Nick', text: 'Lorem ipsum', id: '6', timestamp: '2019/4/13' },
      { author: 'Val', text: 'dolor sit amet', id: '7', timestamp: '2019/4/13' }
    ]
  },
  {
    id: '5',
    timestamp: '2019/4/1',
    local: true,
    from: 'Max',
    object: 'Vic',
    header: 'Report #5',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [
      { author: 'Tony', text: 'consectetur adipiscing elit', id: '8', timestamp: '2019/4/2' },
      { author: 'Zac', text: 'sed do eiusmod tempor incididunt', id: '9', timestamp: '2019/4/3' }
    ]
  },
  {
    id: '6',
    timestamp: '2019/2/28',
    local: true,
    from: 'Tim',
    object: 'Jen',
    header: 'Report #6',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', id: '10', timestamp: '2019/3/1' }]
  },
  {
    id: '7',
    timestamp: '2019/4/12',
    local: true,
    from: 'John', // actor nickname
    object: 'Bob', // user nickname
    header: 'Report #7', // content
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [
      { author: 'Nick', text: 'Lorem ipsum', id: '11', timestamp: '2019/4/13' },
      { author: 'Val', text: 'dolor sit amet', id: '12', timestamp: '2019/4/13' }
    ]
  },
  {
    id: '8',
    timestamp: '2019/4/1',
    local: true,
    from: 'Max',
    object: 'Vic',
    header: 'Report #8',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [
      { author: 'Tony', text: 'consectetur adipiscing elit', id: '13', timestamp: '2019/4/2' },
      { author: 'Zac', text: 'sed do eiusmod tempor incididunt', id: '14', timestamp: '2019/4/3' }
    ]
  },
  {
    id: '9',
    timestamp: '2019/2/28',
    local: true,
    from: 'Tim',
    object: 'Jen',
    header: 'Report #9',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', id: '15', timestamp: '2019/3/1' }]
  },
  {
    id: '10',
    timestamp: '2019/4/12',
    local: true,
    from: 'John', // actor nickname
    object: 'Bob', // user nickname
    header: 'Report #10', // content
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [
      { author: 'Nick', text: 'Lorem ipsum', id: '16', timestamp: '2019/4/13' },
      { author: 'Val', text: 'dolor sit amet', id: '17', timestamp: '2019/4/13' }
    ]
  },
  {
    id: '11',
    timestamp: '2019/4/1',
    local: true,
    from: 'Max',
    object: 'Vic',
    header: 'Report #11',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [
      { author: 'Tony', text: 'consectetur adipiscing elit', id: '18', timestamp: '2019/4/2' },
      { author: 'Zac', text: 'sed do eiusmod tempor incididunt', id: '19', timestamp: '2019/4/3' }
    ]
  },
  {
    id: '12',
    timestamp: '2019/2/28',
    local: true,
    from: 'Tim',
    object: 'Jen',
    header: 'Report #12',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', id: '20', timestamp: '2019/3/1' }]
  },
  {
    id: '13',
    timestamp: '2019/4/12',
    local: true,
    from: 'John', // actor nickname
    object: 'Bob', // user nickname
    header: 'Report #13', // content
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [
      { author: 'Nick', text: 'Lorem ipsum', id: '21', timestamp: '2019/4/13' },
      { author: 'Val', text: 'dolor sit amet', id: '22', timestamp: '2019/4/13' }
    ]
  },
  {
    id: '14',
    timestamp: '2019/4/1',
    local: true,
    from: 'Max',
    object: 'Vic',
    header: 'Report #14',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [
      { author: 'Tony', text: 'consectetur adipiscing elit', id: '23', timestamp: '2019/4/2' },
      { author: 'Zac', text: 'sed do eiusmod tempor incididunt', id: '24', timestamp: '2019/4/3' }
    ]
  },
  {
    id: '15',
    timestamp: '2019/2/28',
    local: true,
    from: 'Tim',
    object: 'Jen',
    header: 'Report #15',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', id: '25', timestamp: '2019/3/1' }]
  },
  {
    id: '16',
    timestamp: '2019/4/12',
    local: true,
    from: 'John', // actor nickname
    object: 'Bob', // user nickname
    header: 'Report #16', // content
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [
      { author: 'Nick', text: 'Lorem ipsum', id: '26', timestamp: '2019/4/13' },
      { author: 'Val', text: 'dolor sit amet', id: '27', timestamp: '2019/4/13' }
    ]
  },
  {
    id: '17',
    timestamp: '2019/4/1',
    local: true,
    from: 'Max',
    object: 'Vic',
    header: 'Report #17',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [
      { author: 'Tony', text: 'consectetur adipiscing elit', id: '28', timestamp: '2019/4/2' },
      { author: 'Zac', text: 'sed do eiusmod tempor incididunt', id: '29', timestamp: '2019/4/3' }
    ]
  },
  {
    id: '18',
    timestamp: '2019/2/28',
    local: true,
    from: 'Tim',
    object: 'Jen',
    header: 'Report #18',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', id: '30', timestamp: '2019/3/1' }]
  }
]
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'
import _ from 'lodash'

export async function deleteInstanceDocument(name, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/instance_document/${name}`,
    method: 'delete',
    headers: authHeaders(token)
  })
}

export async function fetchDescription(authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/v1/pleroma/admin/config/descriptions`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function fetchDescription2(authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/v2/pleroma/admin/config/descriptions`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function fetchSettings(authHost, token) {
  return await request({
@@ -11,6 +42,25 @@ export async function fetchSettings(authHost, token) {
  })
}

export async function getInstanceDocument(name, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/instance_document/${name}`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function updateInstanceDocument(name, formData, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/instance_document/${name}`,
    method: 'patch',
    data: formData,
    headers: { ...authHeaders(token), 'Content-Type': 'multipart/form-data' }
  })
}

export async function updateSettings(configs, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
@@ -21,15 +71,33 @@ export async function updateSettings(configs, authHost, token) {
  })
}

export async function uploadMedia(file, authHost, token) {
  const formData = new FormData()
  formData.append('file', file)
export async function removeSettings(configs, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/config`,
    method: 'post',
    headers: authHeaders(token),
    data: { configs }
  })
}

export async function fetchFrontends(authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/frontends`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function installFrontend(data, authHost, token) {
  const filteredData = _.pickBy(data)
  return await request({
    baseURL: baseName(authHost),
    url: `/api/v1/media`,
    url: `/api/pleroma/admin/frontends/install`,
    method: 'post',
    headers: authHeaders(token),
    data: formData
    data: filteredData
  })
}

src/api/status.js

0 → 100644
+63 −0
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'

export async function changeStatusScope(id, sensitive, visibility, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/statuses/${id}`,
    method: 'put',
    headers: authHeaders(token),
    data: { sensitive, visibility }
  })
}

export async function deleteStatus(id, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/statuses/${id}`,
    method: 'delete',
    headers: authHeaders(token)
  })
}

export async function fetchStatus(id, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/statuses/${id}`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function fetchStatuses({ godmode, localOnly, authHost, token, pageSize, page }) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/statuses?godmode=${godmode}&local_only=${localOnly}&page=${page}&page_size=${pageSize}`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function fetchStatusesCount(instance, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: instance ? `/api/pleroma/admin/stats?instance=${instance}` : `/api/pleroma/admin/stats`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function fetchStatusesByInstance({ instance, authHost, token, pageSize, page }) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/instances/${instance}/statuses?page=${page}&page_size=${pageSize}`,
    method: 'get',
    headers: authHeaders(token)
  })
}

const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {}
+125 −25
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'

export async function addRight(nickname, right, authHost, token) {
export async function activateUsers(nicknames, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/users/${nickname}/permission_group/${right}`,
    url: `/api/pleroma/admin/users/activate`,
    method: 'patch',
    headers: authHeaders(token),
    data: { nicknames }
  })
}

export async function addRight(nicknames, right, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/users/permission_group/${right}`,
    method: 'post',
    headers: authHeaders(token)
    headers: authHeaders(token),
    data: { nicknames }
  })
}

@@ -21,21 +35,43 @@ export async function createNewAccount(nickname, email, password, authHost, toke
  })
}

export async function deleteRight(nickname, right, authHost, token) {
export async function deactivateUsers(nicknames, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/users/${nickname}/permission_group/${right}`,
    url: `/api/pleroma/admin/users/deactivate`,
    method: 'patch',
    headers: authHeaders(token),
    data: { nicknames }
  })
}

export async function deleteRight(nicknames, right, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/users/permission_group/${right}`,
    method: 'delete',
    headers: authHeaders(token)
    headers: authHeaders(token),
    data: { nicknames }
  })
}

export async function deleteUser(nickname, authHost, token) {
export async function deleteUsers(nicknames, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/users?nickname=${nickname}`,
    url: `/api/pleroma/admin/users`,
    method: 'delete',
    headers: authHeaders(token)
    headers: authHeaders(token),
    data: { nicknames }
  })
}

export async function disableMfa(nickname, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/users/disable_mfa`,
    method: 'put',
    headers: authHeaders(token),
    data: { nickname }
  })
}

@@ -48,10 +84,36 @@ export async function fetchUser(id, authHost, token) {
  })
}

export async function fetchUsers(filters, authHost, token, page = 1) {
export async function fetchUserCredentials(nickname, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/users?page=${page}&filters=${filters}`,
    url: `/api/pleroma/admin/users/${nickname}/credentials`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function updateUserCredentials(nickname, credentials, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/users/${nickname}/credentials`,
    method: 'patch',
    headers: authHeaders(token),
    data: credentials
  })
}

export async function fetchUsers(filters, actorTypeFilters, authHost, token, page = 1) {
  const url = actorTypeFilters.length === 0
    ? `/api/pleroma/admin/users?page=${page}&filters=${filters}`
    : actorTypeFilters.reduce((acc, filter) => {
      const newAcc = acc.concat(`&actor_types[]=${filter}`)
      return newAcc
    }, `/api/pleroma/admin/users?page=${page}&filters=${filters}`)

  return await request({
    baseURL: baseName(authHost),
    url,
    method: 'get',
    headers: authHeaders(token)
  })
@@ -66,19 +128,27 @@ export async function getPasswordResetToken(nickname, authHost, token) {
  })
}

export async function requirePasswordReset(nickname, authHost, token) {
export async function forcePasswordReset(nicknames, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/users/${nickname}/force_password_reset`,
    url: `/api/pleroma/admin/users/force_password_reset`,
    method: 'patch',
    headers: authHeaders(token)
    headers: authHeaders(token),
    data: { nicknames }
  })
}

export async function searchUsers(query, filters, authHost, token, page = 1) {
export async function searchUsers(query, filters, actorTypeFilters, authHost, token, page = 1) {
  const url = actorTypeFilters.length === 0
    ? `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`
    : actorTypeFilters.reduce((acc, filter) => {
      const newAcc = acc.concat(`&actor_types[]=${filter}`)
      return newAcc
    }, `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`)

  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`,
    url,
    method: 'get',
    headers: authHeaders(token)
  })
@@ -94,15 +164,6 @@ export async function tagUser(nicknames, tags, authHost, token) {
  })
}

export async function toggleUserActivation(nickname, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/users/${nickname}/toggle_activation`,
    method: 'patch',
    headers: authHeaders(token)
  })
}

export async function untagUser(nicknames, tags, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
@@ -122,4 +183,43 @@ export async function fetchUserStatuses(id, authHost, godmode, token) {
  })
}

export async function fetchUserChats(id, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: `/api/pleroma/admin/users/${id}/chats`,
    method: 'get',
    headers: authHeaders(token)
  })
}

export async function approveUserAccount(nicknames, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: '/api/pleroma/admin/users/approve',
    method: 'patch',
    headers: authHeaders(token),
    data: { nicknames }
  })
}

export async function confirmUserEmail(nicknames, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: '/api/pleroma/admin/users/confirm_email',
    method: 'patch',
    headers: authHeaders(token),
    data: { nicknames }
  })
}

export async function resendConfirmationEmail(nicknames, authHost, token) {
  return await request({
    baseURL: baseName(authHost),
    url: '/api/pleroma/admin/users/resend_confirmation_email',
    method: 'patch',
    headers: authHeaders(token),
    data: { nicknames }
  })
}

const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {}
Original line number Diff line number Diff line
// SPDX-FileCopyrightText: 2019-2022 Pleroma Authors <https://pleroma.social>
// SPDX-License-Identifier: AGPL-3.0-only

const isLocalhost = (instanceName) =>
  instanceName.startsWith('localhost:') || instanceName.startsWith('127.0.0.1:')

+0 −116
Original line number Diff line number Diff line
<template>
  <transition :name="transitionName">
    <div v-show="visible" :style="customStyle" class="back-to-ceiling" @click="backToTop">
      <svg width="16" height="16" viewBox="0 0 17 17" xmlns="http://www.w3.org/2000/svg" class="Icon Icon--backToTopArrow" aria-hidden="true" style="height: 16px; width: 16px;">
        <title>回到顶部</title>
        <g>
          <path d="M12.036 15.59c0 .55-.453.995-.997.995H5.032c-.55 0-.997-.445-.997-.996V8.584H1.03c-1.1 0-1.36-.633-.578-1.416L7.33.29c.39-.39 1.026-.385 1.412 0l6.878 6.88c.782.78.523 1.415-.58 1.415h-3.004v7.004z" fill-rule="evenodd"/>
        </g>
      </svg>
    </div>
  </transition>
</template>

<script>
export default {
  name: 'BackToTop',
  props: {
    visibilityHeight: {
      type: Number,
      default: 400
    },
    backPosition: {
      type: Number,
      default: 0
    },
    customStyle: {
      type: Object,
      default: function() {
        return {
          right: '50px',
          bottom: '50px',
          width: '40px',
          height: '40px',
          'border-radius': '4px',
          'line-height': '45px',
          background: '#e7eaf1'
        }
      }
    },
    transitionName: {
      type: String,
      default: 'fade'
    }
  },
  data: function() {
    return {
      visible: false,
      interval: null,
      isMoving: false
    }
  },
  mounted() {
    window.addEventListener('scroll', this.handleScroll)
  },
  beforeDestroy() {
    window.removeEventListener('scroll', this.handleScroll)
    if (this.interval) {
      clearInterval(this.interval)
    }
  },
  methods: {
    handleScroll() {
      this.visible = window.pageYOffset > this.visibilityHeight
    },
    backToTop() {
      if (this.isMoving) return
      const start = window.pageYOffset
      let i = 0
      this.isMoving = true
      this.interval = setInterval(() => {
        const next = Math.floor(this.easeInOutQuad(10 * i, start, -start, 500))
        if (next <= this.backPosition) {
          window.scrollTo(0, this.backPosition)
          clearInterval(this.interval)
          this.isMoving = false
        } else {
          window.scrollTo(0, next)
        }
        i++
      }, 16.7)
    },
    easeInOutQuad(t, b, c, d) {
      if ((t /= d / 2) < 1) return c / 2 * t * t + b
      return -c / 2 * (--t * (t - 2) - 1) + b
    }
  }
}
</script>

<style scoped>
  .back-to-ceiling {
    position: fixed;
    display: inline-block;
    text-align: center;
    cursor: pointer;
  }

  .back-to-ceiling:hover {
    background: #d5dbe7;
  }

  .fade-enter-active,
  .fade-leave-active {
    transition: opacity .5s;
  }

  .fade-enter,
  .fade-leave-to {
    opacity: 0
  }

  .back-to-ceiling .Icon {
    fill: #9aaabf;
    background: none;
  }
</style>
+0 −72
Original line number Diff line number Diff line
<template>
  <el-breadcrumb class="app-breadcrumb" separator="/">
    <transition-group name="breadcrumb">
      <el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
        <span v-if="item.redirect==='noredirect'||index==levelList.length-1" class="no-redirect">{{
        generateTitle(item.meta.title) }}</span>
        <a v-else @click.prevent="handleLink(item)">{{ generateTitle(item.meta.title) }}</a>
      </el-breadcrumb-item>
    </transition-group>
  </el-breadcrumb>
</template>

<script>
import { generateTitle } from '@/utils/i18n'
import pathToRegexp from 'path-to-regexp'

export default {
  data: function() {
    return {
      levelList: null
    }
  },
  watch: {
    $route() {
      this.getBreadcrumb()
    }
  },
  created() {
    this.getBreadcrumb()
  },
  methods: {
    generateTitle,
    getBreadcrumb() {
      let matched = this.$route.matched.filter(item => item.name)

      const first = matched[0]
      if (first && first.name.trim().toLocaleLowerCase() !== 'Dashboard'.toLocaleLowerCase()) {
        matched = [{ path: '/dashboard', meta: { title: 'dashboard' }}].concat(matched)
      }

      this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
    },
    pathCompile(path) {
      // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
      const { params } = this.$route
      var toPath = pathToRegexp.compile(path)
      return toPath(params)
    },
    handleLink(item) {
      const { redirect, path } = item
      if (redirect) {
        this.$router.push(redirect)
        return
      }
      this.$router.push(this.pathCompile(path))
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .app-breadcrumb.el-breadcrumb {
    display: inline-block;
    font-size: 14px;
    line-height: 50px;
    margin-left: 8px;
    .no-redirect {
      color: #97a8be;
      cursor: text;
    }
  }
</style>
+0 −156
Original line number Diff line number Diff line
<template>
  <div :class="className" :id="id" :style="{height:height,width:width}"/>
</template>

<script>
import echarts from 'echarts'
import resize from './mixins/resize'

export default {
  mixins: [resize],
  props: {
    className: {
      type: String,
      default: 'chart'
    },
    id: {
      type: String,
      default: 'chart'
    },
    width: {
      type: String,
      default: '200px'
    },
    height: {
      type: String,
      default: '200px'
    }
  },
  data: function() {
    return {
      chart: null
    }
  },
  mounted() {
    this.initChart()
  },
  beforeDestroy() {
    if (!this.chart) {
      return
    }
    this.chart.dispose()
    this.chart = null
  },
  methods: {
    initChart() {
      this.chart = echarts.init(document.getElementById(this.id))

      const xAxisData = []
      const data = []
      const data2 = []
      for (let i = 0; i < 50; i++) {
        xAxisData.push(i)
        data.push((Math.sin(i / 5) * (i / 5 - 10) + i / 6) * 5)
        data2.push((Math.sin(i / 5) * (i / 5 + 10) + i / 6) * 3)
      }
      this.chart.setOption(
        {
          backgroundColor: '#08263a',
          grid: {
            left: '5%',
            right: '5%'
          },
          xAxis: [{
            show: false,
            data: xAxisData
          }, {
            show: false,
            data: xAxisData
          }],
          visualMap: {
            show: false,
            min: 0,
            max: 50,
            dimension: 0,
            inRange: {
              color: ['#4a657a', '#308e92', '#b1cfa5', '#f5d69f', '#f5898b', '#ef5055']
            }
          },
          yAxis: {
            axisLine: {
              show: false
            },
            axisLabel: {
              textStyle: {
                color: '#4a657a'
              }
            },
            splitLine: {
              show: true,
              lineStyle: {
                color: '#08263f'
              }
            },
            axisTick: {
              show: false
            }
          },
          series: [{
            name: 'back',
            type: 'bar',
            data: data2,
            z: 1,
            itemStyle: {
              normal: {
                opacity: 0.4,
                barBorderRadius: 5,
                shadowBlur: 3,
                shadowColor: '#111'
              }
            }
          }, {
            name: 'Simulate Shadow',
            type: 'line',
            data,
            z: 2,
            showSymbol: false,
            animationDelay: 0,
            animationEasing: 'linear',
            animationDuration: 1200,
            lineStyle: {
              normal: {
                color: 'transparent'
              }
            },
            areaStyle: {
              normal: {
                color: '#08263a',
                shadowBlur: 50,
                shadowColor: '#000'
              }
            }
          }, {
            name: 'front',
            type: 'bar',
            data,
            xAxisIndex: 1,
            z: 3,
            itemStyle: {
              normal: {
                barBorderRadius: 5
              }
            }
          }],
          animationEasing: 'elasticOut',
          animationEasingUpdate: 'elasticOut',
          animationDelay(idx) {
            return idx * 20
          },
          animationDelayUpdate(idx) {
            return idx * 20
          }
        })
    }
  }
}
</script>
+0 −32
Original line number Diff line number Diff line
import { debounce } from '@/utils'

export default {
  data: function() {
    return {
      sidebarElm: null
    }
  },
  mounted() {
    this.__resizeHandler = debounce(() => {
      if (this.chart) {
        this.chart.resize()
      }
    }, 100)
    window.addEventListener('resize', this.__resizeHandler)

    this.sidebarElm = document.getElementsByClassName('sidebar-container')[0]
    this.sidebarElm && this.sidebarElm.addEventListener('transitionend', this.sidebarResizeHandler)
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.__resizeHandler)

    this.sidebarElm && this.sidebarElm.removeEventListener('transitionend', this.sidebarResizeHandler)
  },
  methods: {
    sidebarResizeHandler(e) {
      if (e.propertyName === 'width') {
        this.__resizeHandler()
      }
    }
  }
}

src/components/DndList/index.vue

deleted100644 → 0
+0 −157
Original line number Diff line number Diff line
<template>
  <div class="dndList">
    <div :style="{width:width1}" class="dndList-list">
      <h3>{{ list1Title }}</h3>
      <draggable :list="list1" :options="{group:'article'}" class="dragArea">
        <div v-for="element in list1" :key="element.id" class="list-complete-item">
          <div class="list-complete-item-handle">{{ element.id }}[{{ element.author }}] {{ element.title }}</div>
          <div style="position:absolute;right:0px;">
            <span style="float: right ;margin-top: -20px;margin-right:5px;" @click="deleteEle(element)">
              <i style="color:#ff4949" class="el-icon-delete"/>
            </span>
          </div>
        </div>
      </draggable>
    </div>
    <div :style="{width:width2}" class="dndList-list">
      <h3>{{ list2Title }}</h3>
      <draggable :list="list2" :options="{group:'article'}" class="dragArea">
        <div v-for="element in list2" :key="element.id" class="list-complete-item">
          <div class="list-complete-item-handle2" @click="pushEle(element)">{{ element.id }} [{{ element.author }}] {{ element.title }}</div>
        </div>
      </draggable>
    </div>
  </div>
</template>

<script>
import draggable from 'vuedraggable'

export default {
  name: 'DndList',
  components: { draggable },
  props: {
    list1: {
      type: Array,
      default() {
        return []
      }
    },
    list2: {
      type: Array,
      default() {
        return []
      }
    },
    list1Title: {
      type: String,
      default: 'list1'
    },
    list2Title: {
      type: String,
      default: 'list2'
    },
    width1: {
      type: String,
      default: '48%'
    },
    width2: {
      type: String,
      default: '48%'
    }
  },
  methods: {
    isNotInList1(v) {
      return this.list1.every(k => v.id !== k.id)
    },
    isNotInList2(v) {
      return this.list2.every(k => v.id !== k.id)
    },
    deleteEle(ele) {
      for (const item of this.list1) {
        if (item.id === ele.id) {
          const index = this.list1.indexOf(item)
          this.list1.splice(index, 1)
          break
        }
      }
      if (this.isNotInList2(ele)) {
        this.list2.unshift(ele)
      }
    },
    pushEle(ele) {
      for (const item of this.list2) {
        if (item.id === ele.id) {
          const index = this.list2.indexOf(item)
          this.list2.splice(index, 1)
          break
        }
      }
      if (this.isNotInList1(ele)) {
        this.list1.push(ele)
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.dndList {
  background: #fff;
  padding-bottom: 40px;
  &:after {
    content: "";
    display: table;
    clear: both;
  }
  .dndList-list {
    float: left;
    padding-bottom: 30px;
    &:first-of-type {
      margin-right: 2%;
    }
    .dragArea {
      margin-top: 15px;
      min-height: 50px;
      padding-bottom: 30px;
    }
  }
}

.list-complete-item {
  cursor: pointer;
  position: relative;
  font-size: 14px;
  padding: 5px 12px;
  margin-top: 4px;
  border: 1px solid #bfcbd9;
  transition: all 1s;
}

.list-complete-item-handle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 50px;
}

.list-complete-item-handle2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 20px;
}

.list-complete-item.sortable-chosen {
  background: #4AB7BD;
}

.list-complete-item.sortable-ghost {
  background: #30B08F;
}

.list-complete-enter,
.list-complete-leave-active {
  opacity: 0;
}
</style>
+0 −19
Original line number Diff line number Diff line
/**
 * database64文件格式转换为2进制
 *
 * @param  {[String]} data dataURL 的格式为 “data:image/png;base64,****”,逗号之前都是一些说明性的文字,我们只需要逗号之后的就行了
 * @param  {[String]} mime [description]
 * @return {[blob]}      [description]
 */
export default function(data, mime) {
  data = data.split(',')[1]
  data = window.atob(data)
  var ia = new Uint8Array(data.length)
  for (var i = 0; i < data.length; i++) {
    ia[i] = data.charCodeAt(i)
  }
  // canvas.toDataURL 返回的默认格式就是 image/png
  return new Blob([ia], {
    type: mime
  })
}
+0 −7
Original line number Diff line number Diff line
export default {
  'jpg': 'image/jpeg',
  'png': 'image/png',
  'gif': 'image/gif',
  'svg': 'image/svg+xml',
  'psd': 'image/photoshop'
}
+3 −0

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

src/icons/svgo.json

0 → 100644
+10 −0

File added.

Preview size limit exceeded, changes collapsed.

src/icons/svgo.yml

deleted100644 → 0
+0 −22

File deleted.

Preview size limit exceeded, changes collapsed.

+269 −33

File changed.

Preview size limit exceeded, changes collapsed.

+7 −8

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

+4 −8

File changed.

Preview size limit exceeded, changes collapsed.

+7 −8

File changed.

Preview size limit exceeded, changes collapsed.

+6 −0

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

+125 −15

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

src/utils/tabs.js

0 → 100644
+24 −0

File added.

Preview size limit exceeded, changes collapsed.

File changed.

Preview size limit exceeded, changes collapsed.

src/vendor/Export2Excel.js

deleted100644 → 0
+0 −206

File deleted.

Preview size limit exceeded, changes collapsed.

src/vendor/Export2Zip.js

deleted100644 → 0
+0 −24

File deleted.

Preview size limit exceeded, changes collapsed.

src/views/charts/line.vue

deleted100644 → 0
+0 −23

File deleted.

Preview size limit exceeded, changes collapsed.

+255 −0

File added.

Preview size limit exceeded, changes collapsed.

src/views/guide/index.vue

deleted100644 → 0
+0 −34

File deleted.

Preview size limit exceeded, changes collapsed.

src/views/pdf/content.js

deleted100644 → 0
+0 −58

File deleted.

Preview size limit exceeded, changes collapsed.

src/views/pdf/download.vue

deleted100644 → 0
+0 −199

File deleted.

Preview size limit exceeded, changes collapsed.

src/views/pdf/index.vue

deleted100644 → 0
+0 −9

File deleted.

Preview size limit exceeded, changes collapsed.

src/views/qiniu/upload.vue

deleted100644 → 0
+0 −39

File deleted.

Preview size limit exceeded, changes collapsed.

+5621 −5489

File changed.

Preview size limit exceeded, changes collapsed.