fix!: remove esm package, use native Node ES modules (#2064)
BREAKING CHANGE: Node v12.20+, v14.14+, or v16.0+ is required * fix!: remove esm package, use native Node ES modules * fix: fix some CJS imports
This commit is contained in:
parent
c5de673990
commit
16e66346d7
|
@ -1,5 +1,7 @@
|
||||||
version: 2.1
|
version: 2.1
|
||||||
|
|
||||||
|
orbs:
|
||||||
|
browser-tools: circleci/browser-tools@1.1.3
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build_and_test:
|
build_and_test:
|
||||||
|
@ -15,13 +17,11 @@ executors:
|
||||||
node:
|
node:
|
||||||
working_directory: ~/pinafore
|
working_directory: ~/pinafore
|
||||||
docker:
|
docker:
|
||||||
# we want Node v12, not v14
|
- image: cimg/ruby:2.7.2-browsers
|
||||||
# see https://discuss.circleci.com/t/build-failed-the-engine-node-is-incompatible-with-this-module-expected-version-12-x-got-14-15-0/37921/7
|
|
||||||
- image: circleci/ruby@sha256:b018ec2a8f0bbf06880735d2801402bad316c465edb60663be83ac8f1086b805
|
|
||||||
node_and_ruby:
|
node_and_ruby:
|
||||||
working_directory: ~/pinafore
|
working_directory: ~/pinafore
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/ruby@sha256:b018ec2a8f0bbf06880735d2801402bad316c465edb60663be83ac8f1086b805
|
- image: cimg/ruby:2.7.2-browsers
|
||||||
- image: circleci/postgres:12.2
|
- image: circleci/postgres:12.2
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: pinafore
|
POSTGRES_USER: pinafore
|
||||||
|
@ -30,6 +30,45 @@ executors:
|
||||||
BROWSER: chrome:headless
|
BROWSER: chrome:headless
|
||||||
- image: circleci/redis:5-alpine
|
- image: circleci/redis:5-alpine
|
||||||
commands:
|
commands:
|
||||||
|
install_mastodon_system_dependencies:
|
||||||
|
description: Install system dependencies that Mastodon requires
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
name: Install system dependencies
|
||||||
|
command: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y \
|
||||||
|
ffmpeg \
|
||||||
|
fonts-noto-color-emoji \
|
||||||
|
imagemagick \
|
||||||
|
libicu-dev \
|
||||||
|
libidn11-dev \
|
||||||
|
libprotobuf-dev \
|
||||||
|
postgresql-contrib \
|
||||||
|
protobuf-compiler
|
||||||
|
install_browsers:
|
||||||
|
description: Install browsers and tools
|
||||||
|
steps:
|
||||||
|
- browser-tools/install-chrome:
|
||||||
|
chrome-version: 91.0.4472.114
|
||||||
|
- browser-tools/install-chromedriver
|
||||||
|
- run:
|
||||||
|
name: "Check browser version"
|
||||||
|
command: |
|
||||||
|
google-chrome --version
|
||||||
|
install_node:
|
||||||
|
description: Install Node.js
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
name: "Install Node.js"
|
||||||
|
# via https://circleci.com/docs/2.0/circleci-images/#notes-on-pinning-images
|
||||||
|
command: |
|
||||||
|
curl -sSL "https://nodejs.org/dist/v12.22.2/node-v12.22.2-linux-x64.tar.xz" \
|
||||||
|
| sudo tar --strip-components=2 -xJ -C /usr/local/bin/ node-v12.22.2-linux-x64/bin/node
|
||||||
|
- run:
|
||||||
|
name: Check current version of node
|
||||||
|
command: node -v
|
||||||
|
|
||||||
save_workspace:
|
save_workspace:
|
||||||
description: Persist workspace
|
description: Persist workspace
|
||||||
steps:
|
steps:
|
||||||
|
@ -47,13 +86,13 @@ commands:
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
name: Restore yarn cache
|
name: Restore yarn cache
|
||||||
key: yarn-v3-{{ checksum "yarn.lock" }}
|
key: yarn-v4-{{ checksum "yarn.lock" }}
|
||||||
save_yarn_cache:
|
save_yarn_cache:
|
||||||
description: Save yarn cache
|
description: Save yarn cache
|
||||||
steps:
|
steps:
|
||||||
- save_cache:
|
- save_cache:
|
||||||
name: Save yarn cache
|
name: Save yarn cache
|
||||||
key: yarn-v3-{{ checksum "yarn.lock" }}
|
key: yarn-v4-{{ checksum "yarn.lock" }}
|
||||||
paths:
|
paths:
|
||||||
- ~/.cache/yarn
|
- ~/.cache/yarn
|
||||||
restore_yarn_cache_mastodon:
|
restore_yarn_cache_mastodon:
|
||||||
|
@ -61,13 +100,13 @@ commands:
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
name: Restore yarn cache for Mastodon
|
name: Restore yarn cache for Mastodon
|
||||||
key: yarn-v3-{{ checksum "mastodon/yarn.lock" }}
|
key: yarn-v4-{{ checksum "mastodon/yarn.lock" }}
|
||||||
save_yarn_cache_mastodon:
|
save_yarn_cache_mastodon:
|
||||||
description: Save yarn cache for Mastodon
|
description: Save yarn cache for Mastodon
|
||||||
steps:
|
steps:
|
||||||
- save_cache:
|
- save_cache:
|
||||||
name: Save yarn cache for Mastodon
|
name: Save yarn cache for Mastodon
|
||||||
key: yarn-v3-{{ checksum "mastodon/yarn.lock" }}
|
key: yarn-v4-{{ checksum "mastodon/yarn.lock" }}
|
||||||
paths:
|
paths:
|
||||||
- ~/.cache/yarn
|
- ~/.cache/yarn
|
||||||
restore_bundler_cache:
|
restore_bundler_cache:
|
||||||
|
@ -75,23 +114,18 @@ commands:
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
name: Restore bundler cache
|
name: Restore bundler cache
|
||||||
key: bundler-v2-{{ checksum "mastodon/Gemfile.lock" }}
|
key: bundler-v4-{{ checksum "mastodon/Gemfile.lock" }}
|
||||||
save_bundler_cache:
|
save_bundler_cache:
|
||||||
description: Save bundler cache
|
description: Save bundler cache
|
||||||
steps:
|
steps:
|
||||||
- save_cache:
|
- save_cache:
|
||||||
name: Save bundler cache
|
name: Save bundler cache
|
||||||
key: bundler-v2-{{ checksum "mastodon/Gemfile.lock" }}
|
key: bundler-v4-{{ checksum "mastodon/Gemfile.lock" }}
|
||||||
paths:
|
paths:
|
||||||
- mastodon/vendor/bundle
|
- mastodon/vendor/bundle
|
||||||
install_mastodon:
|
install_mastodon:
|
||||||
description: Install Mastodon and set up Postgres/Redis
|
description: Install Mastodon and set up Postgres/Redis
|
||||||
steps:
|
steps:
|
||||||
- run:
|
|
||||||
name: Install system dependencies
|
|
||||||
command: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y ffmpeg fonts-noto-color-emoji libicu-dev libidn11-dev libprotobuf-dev postgresql-contrib protobuf-compiler
|
|
||||||
- run:
|
- run:
|
||||||
name: Clone mastodon
|
name: Clone mastodon
|
||||||
command: yarn clone-mastodon
|
command: yarn clone-mastodon
|
||||||
|
@ -127,6 +161,7 @@ jobs:
|
||||||
executor: node
|
executor: node
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
- install_node
|
||||||
- restore_yarn_cache
|
- restore_yarn_cache
|
||||||
- run:
|
- run:
|
||||||
name: Yarn install
|
name: Yarn install
|
||||||
|
@ -156,6 +191,9 @@ jobs:
|
||||||
integration_test_readonly:
|
integration_test_readonly:
|
||||||
executor: node_and_ruby
|
executor: node_and_ruby
|
||||||
steps:
|
steps:
|
||||||
|
- install_mastodon_system_dependencies
|
||||||
|
- install_browsers
|
||||||
|
- install_node
|
||||||
- load_workspace
|
- load_workspace
|
||||||
- install_mastodon
|
- install_mastodon
|
||||||
- run:
|
- run:
|
||||||
|
@ -164,6 +202,9 @@ jobs:
|
||||||
integration_test_readwrite:
|
integration_test_readwrite:
|
||||||
executor: node_and_ruby
|
executor: node_and_ruby
|
||||||
steps:
|
steps:
|
||||||
|
- install_mastodon_system_dependencies
|
||||||
|
- install_browsers
|
||||||
|
- install_node
|
||||||
- load_workspace
|
- load_workspace
|
||||||
- install_mastodon
|
- install_mastodon
|
||||||
- run:
|
- run:
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,3 +14,4 @@ yarn-error.log
|
||||||
|
|
||||||
.now
|
.now
|
||||||
.vercel
|
.vercel
|
||||||
|
/webpack/*.cjs
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import { promisify } from 'util'
|
import { promisify } from 'util'
|
||||||
import { LOCALE } from '../src/routes/_static/intl'
|
import { LOCALE } from '../src/routes/_static/intl.js'
|
||||||
import { getIntl, trimWhitespace } from './getIntl'
|
import { getIntl, trimWhitespace } from './getIntl.js'
|
||||||
|
|
||||||
|
const __dirname = path.dirname(new URL(import.meta.url).pathname)
|
||||||
const readFile = promisify(fs.readFile)
|
const readFile = promisify(fs.readFile)
|
||||||
const writeFile = promisify(fs.writeFile)
|
const writeFile = promisify(fs.writeFile)
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,12 @@ import path from 'path'
|
||||||
import { rollup } from 'rollup'
|
import { rollup } from 'rollup'
|
||||||
import { terser } from 'rollup-plugin-terser'
|
import { terser } from 'rollup-plugin-terser'
|
||||||
import replace from '@rollup/plugin-replace'
|
import replace from '@rollup/plugin-replace'
|
||||||
import fromPairs from 'lodash-es/fromPairs'
|
import { themes } from '../src/routes/_static/themes.js'
|
||||||
import { themes } from '../src/routes/_static/themes'
|
import terserOptions from './terserOptions.js'
|
||||||
import terserOptions from './terserOptions'
|
|
||||||
|
|
||||||
|
const __dirname = path.dirname(new URL(import.meta.url).pathname)
|
||||||
const writeFile = promisify(fs.writeFile)
|
const writeFile = promisify(fs.writeFile)
|
||||||
|
const themeColors = Object.fromEntries(themes.map(_ => ([_.name, _.color])))
|
||||||
const themeColors = fromPairs(themes.map(_ => ([_.name, _.color])))
|
|
||||||
|
|
||||||
export async function buildInlineScript () {
|
export async function buildInlineScript () {
|
||||||
const inlineScriptPath = path.join(__dirname, '../src/inline-script/inline-script.js')
|
const inlineScriptPath = path.join(__dirname, '../src/inline-script/inline-script.js')
|
||||||
|
@ -42,7 +41,7 @@ export async function buildInlineScript () {
|
||||||
const checksum = crypto.createHash('sha256').update(fullCode, 'utf8').digest('base64')
|
const checksum = crypto.createHash('sha256').update(fullCode, 'utf8').digest('base64')
|
||||||
|
|
||||||
await writeFile(path.resolve(__dirname, '../src/inline-script/checksum.js'),
|
await writeFile(path.resolve(__dirname, '../src/inline-script/checksum.js'),
|
||||||
`module.exports = ${JSON.stringify(checksum)}`, 'utf8')
|
`export default ${JSON.stringify(checksum)}`, 'utf8')
|
||||||
await writeFile(path.resolve(__dirname, '../static/inline-script.js.map'),
|
await writeFile(path.resolve(__dirname, '../static/inline-script.js.map'),
|
||||||
map.toString(), 'utf8')
|
map.toString(), 'utf8')
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,12 @@ import path from 'path'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import { promisify } from 'util'
|
import { promisify } from 'util'
|
||||||
import cssDedoupe from 'css-dedoupe'
|
import cssDedoupe from 'css-dedoupe'
|
||||||
import { TextDecoder } from 'text-encoding'
|
import textEncodingPackage from 'text-encoding'
|
||||||
|
const { TextDecoder } = textEncodingPackage
|
||||||
|
|
||||||
const writeFile = promisify(fs.writeFile)
|
const writeFile = promisify(fs.writeFile)
|
||||||
const readdir = promisify(fs.readdir)
|
const readdir = promisify(fs.readdir)
|
||||||
|
const __dirname = path.dirname(new URL(import.meta.url).pathname)
|
||||||
|
|
||||||
const globalScss = path.join(__dirname, '../src/scss/global.scss')
|
const globalScss = path.join(__dirname, '../src/scss/global.scss')
|
||||||
const defaultThemeScss = path.join(__dirname, '../src/scss/themes/_default.scss')
|
const defaultThemeScss = path.join(__dirname, '../src/scss/themes/_default.scss')
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
import svgs from './svgs'
|
import svgs from './svgs.js'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import { promisify } from 'util'
|
import { promisify } from 'util'
|
||||||
import { optimize } from 'svgo'
|
import { optimize } from 'svgo'
|
||||||
import $ from 'cheerio'
|
import cheerioPackage from 'cheerio'
|
||||||
|
|
||||||
|
const { default: $ } = cheerioPackage
|
||||||
|
|
||||||
|
const __dirname = path.dirname(new URL(import.meta.url).pathname)
|
||||||
const readFile = promisify(fs.readFile)
|
const readFile = promisify(fs.readFile)
|
||||||
const writeFile = promisify(fs.writeFile)
|
const writeFile = promisify(fs.writeFile)
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,18 @@ import chokidar from 'chokidar'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { promisify } from 'util'
|
import { promisify } from 'util'
|
||||||
import { buildSass } from './build-sass'
|
import { buildSass } from './build-sass.js'
|
||||||
import { buildInlineScript } from './build-inline-script'
|
import { buildInlineScript } from './build-inline-script.js'
|
||||||
import { buildSvg } from './build-svg'
|
import { buildSvg } from './build-svg.js'
|
||||||
import { performance } from 'perf_hooks'
|
import { performance } from 'perf_hooks'
|
||||||
import debounce from 'lodash-es/debounce'
|
import { debounce } from '../src/routes/_thirdparty/lodash/timers.js'
|
||||||
import applyIntl from '../webpack/svelte-intl-loader'
|
import applyIntl from '../webpack/svelte-intl-loader.js'
|
||||||
import { LOCALE } from '../src/routes/_static/intl'
|
import { LOCALE } from '../src/routes/_static/intl.js'
|
||||||
import { getLangDir } from 'rtl-detect'
|
import rtlDetectPackage from 'rtl-detect'
|
||||||
|
|
||||||
|
const { getLangDir } = rtlDetectPackage
|
||||||
|
|
||||||
|
const __dirname = path.dirname(new URL(import.meta.url).pathname)
|
||||||
const writeFile = promisify(fs.writeFile)
|
const writeFile = promisify(fs.writeFile)
|
||||||
const LOCALE_DIRECTION = getLangDir(LOCALE)
|
const LOCALE_DIRECTION = getLangDir(LOCALE)
|
||||||
const DEBOUNCE = 500
|
const DEBOUNCE = 500
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import { promisify } from 'util'
|
import { promisify } from 'util'
|
||||||
import { routes } from '../__sapper__/service-worker'
|
import { routes } from '../__sapper__/service-worker.js'
|
||||||
import cloneDeep from 'lodash-es/cloneDeep'
|
import { cloneDeep } from '../src/routes/_utils/lodash-lite.js'
|
||||||
import inlineScriptChecksum from '../src/inline-script/checksum'
|
import inlineScriptChecksum from '../src/inline-script/checksum.js'
|
||||||
import { sapperInlineScriptChecksums } from '../src/server/sapperInlineScriptChecksums'
|
import { sapperInlineScriptChecksums } from '../src/server/sapperInlineScriptChecksums.js'
|
||||||
|
|
||||||
|
const __dirname = path.dirname(new URL(import.meta.url).pathname)
|
||||||
const writeFile = promisify(fs.writeFile)
|
const writeFile = promisify(fs.writeFile)
|
||||||
|
|
||||||
const JSON_TEMPLATE = {
|
const JSON_TEMPLATE = {
|
||||||
|
|
|
@ -2,11 +2,13 @@ import { promisify } from 'util'
|
||||||
import childProcessPromise from 'child-process-promise'
|
import childProcessPromise from 'child-process-promise'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import { envFile, RUBY_VERSION } from './mastodon-config'
|
import { envFile, RUBY_VERSION } from './mastodon-config.js'
|
||||||
|
import esMain from 'es-main'
|
||||||
|
|
||||||
const exec = childProcessPromise.exec
|
const exec = childProcessPromise.exec
|
||||||
const stat = promisify(fs.stat)
|
const stat = promisify(fs.stat)
|
||||||
const writeFile = promisify(fs.writeFile)
|
const writeFile = promisify(fs.writeFile)
|
||||||
|
const __dirname = path.dirname(new URL(import.meta.url).pathname)
|
||||||
const dir = __dirname
|
const dir = __dirname
|
||||||
|
|
||||||
const GIT_URL = 'https://github.com/tootsuite/mastodon.git'
|
const GIT_URL = 'https://github.com/tootsuite/mastodon.git'
|
||||||
|
@ -25,7 +27,7 @@ export default async function cloneMastodon () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (require.main === module) {
|
if (esMain(import.meta)) {
|
||||||
cloneMastodon().catch(err => {
|
cloneMastodon().catch(err => {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
import { get } from 'lodash-es'
|
import { get } from '../src/routes/_utils/lodash-lite.js'
|
||||||
import { DEFAULT_LOCALE, LOCALE } from '../src/routes/_static/intl'
|
import { DEFAULT_LOCALE, LOCALE } from '../src/routes/_static/intl.js'
|
||||||
import path from 'path'
|
|
||||||
|
|
||||||
const intl = require(path.join(__dirname, '../src/intl', LOCALE + '.js')).default
|
import enUS from '../src/intl/en-US.js'
|
||||||
const defaultIntl = require(path.join(__dirname, '../src/intl', DEFAULT_LOCALE + '.js')).default
|
import fr from '../src/intl/fr.js'
|
||||||
|
import de from '../src/intl/de.js'
|
||||||
|
|
||||||
|
// TODO: make it so we don't have to explicitly list these out
|
||||||
|
const locales = {
|
||||||
|
'en-US': enUS,
|
||||||
|
fr,
|
||||||
|
de
|
||||||
|
}
|
||||||
|
|
||||||
|
const intl = locales[LOCALE]
|
||||||
|
const defaultIntl = locales[DEFAULT_LOCALE]
|
||||||
|
|
||||||
export function warningOrError (message) { // avoid crashing the whole server on `yarn dev`
|
export function warningOrError (message) { // avoid crashing the whole server on `yarn dev`
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
@ -14,6 +24,7 @@ export function warningOrError (message) { // avoid crashing the whole server on
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getIntl (path) {
|
export function getIntl (path) {
|
||||||
|
path = path.split('.')
|
||||||
const res = get(intl, path, get(defaultIntl, path))
|
const res = get(intl, path, get(defaultIntl, path))
|
||||||
if (typeof res !== 'string') {
|
if (typeof res !== 'string') {
|
||||||
return warningOrError('Unknown intl string: ' + JSON.stringify(path))
|
return warningOrError('Unknown intl string: ' + JSON.stringify(path))
|
||||||
|
|
|
@ -2,12 +2,14 @@ import { promisify } from 'util'
|
||||||
import childProcessPromise from 'child-process-promise'
|
import childProcessPromise from 'child-process-promise'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import { DB_NAME, DB_PASS, DB_USER, mastodonDir, env } from './mastodon-config'
|
import { DB_NAME, DB_PASS, DB_USER, mastodonDir, env } from './mastodon-config.js'
|
||||||
import mkdirp from 'mkdirp'
|
import mkdirp from 'mkdirp'
|
||||||
|
import esMain from 'es-main'
|
||||||
|
|
||||||
const exec = childProcessPromise.exec
|
const exec = childProcessPromise.exec
|
||||||
const stat = promisify(fs.stat)
|
const stat = promisify(fs.stat)
|
||||||
const writeFile = promisify(fs.writeFile)
|
const writeFile = promisify(fs.writeFile)
|
||||||
|
const __dirname = path.dirname(new URL(import.meta.url).pathname)
|
||||||
const dir = __dirname
|
const dir = __dirname
|
||||||
|
|
||||||
async function setupMastodonDatabase () {
|
async function setupMastodonDatabase () {
|
||||||
|
@ -69,7 +71,7 @@ export default async function installMastodon () {
|
||||||
await installMastodonDependencies()
|
await installMastodonDependencies()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (require.main === module) {
|
if (esMain(import.meta)) {
|
||||||
installMastodon().catch(err => {
|
installMastodon().catch(err => {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
|
|
|
@ -17,10 +17,9 @@ DB_NAME=${DB_NAME}
|
||||||
DB_PASS=${DB_PASS}
|
DB_PASS=${DB_PASS}
|
||||||
`
|
`
|
||||||
|
|
||||||
// Need a Ruby version that CircleCI bundles with Node v12, not Node v14 which doesn't
|
export const RUBY_VERSION = '2.7.2'
|
||||||
// work for streaming
|
|
||||||
export const RUBY_VERSION = '2.6.6'
|
|
||||||
|
|
||||||
|
const __dirname = path.dirname(new URL(import.meta.url).pathname)
|
||||||
export const mastodonDir = path.join(__dirname, '../mastodon')
|
export const mastodonDir = path.join(__dirname, '../mastodon')
|
||||||
|
|
||||||
export const env = Object.assign({}, process.env, {
|
export const env = Object.assign({}, process.env, {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import times from 'lodash-es/times'
|
import { times } from '../src/routes/_utils/lodash-lite.js'
|
||||||
|
|
||||||
function unrollThread (user, prefix, privacy, thread) {
|
function unrollThread (user, prefix, privacy, thread) {
|
||||||
const res = []
|
const res = []
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { actions } from './mastodon-data'
|
import { actions } from './mastodon-data.js'
|
||||||
import { users } from '../tests/users'
|
import { users } from '../tests/users.js'
|
||||||
import { postStatus } from '../src/routes/_api/statuses'
|
import { postStatus } from '../src/routes/_api/statuses.js'
|
||||||
import { followAccount } from '../src/routes/_api/follow'
|
import { followAccount } from '../src/routes/_api/follow.js'
|
||||||
import { favoriteStatus } from '../src/routes/_api/favorite'
|
import { favoriteStatus } from '../src/routes/_api/favorite.js'
|
||||||
import { reblogStatus } from '../src/routes/_api/reblog'
|
import { reblogStatus } from '../src/routes/_api/reblog.js'
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
import FileApi from 'file-api'
|
import FileApi from 'file-api'
|
||||||
import { pinStatus } from '../src/routes/_api/pin'
|
import { pinStatus } from '../src/routes/_api/pin.js'
|
||||||
import { submitMedia } from '../tests/submitMedia'
|
import { submitMedia } from '../tests/submitMedia.js'
|
||||||
|
|
||||||
global.File = FileApi.File
|
global.File = FileApi.File
|
||||||
global.FormData = FileApi.FormData
|
global.FormData = FileApi.FormData
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { restoreMastodonData } from './restore-mastodon-data'
|
import { restoreMastodonData } from './restore-mastodon-data.js'
|
||||||
import childProcessPromise from 'child-process-promise'
|
import childProcessPromise from 'child-process-promise'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import { waitForMastodonUiToStart, waitForMastodonApiToStart } from './wait-for-mastodon-to-start'
|
import { waitForMastodonUiToStart, waitForMastodonApiToStart } from './wait-for-mastodon-to-start.js'
|
||||||
import cloneMastodon from './clone-mastodon'
|
import cloneMastodon from './clone-mastodon.js'
|
||||||
import installMastodon from './install-mastodon'
|
import installMastodon from './install-mastodon.js'
|
||||||
import { mastodonDir, env } from './mastodon-config'
|
import { mastodonDir, env } from './mastodon-config.js'
|
||||||
|
|
||||||
const spawn = childProcessPromise.spawn
|
const spawn = childProcessPromise.spawn
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = [
|
export default [
|
||||||
{ id: 'pinafore-logo', src: 'src/static/sailboat.svg', inline: true },
|
{ id: 'pinafore-logo', src: 'src/static/sailboat.svg', inline: true },
|
||||||
{ id: 'fa-bell', src: 'src/thirdparty/font-awesome-svg-png/white/svg/bell.svg', inline: true },
|
{ id: 'fa-bell', src: 'src/thirdparty/font-awesome-svg-png/white/svg/bell.svg', inline: true },
|
||||||
{ id: 'fa-users', src: 'src/thirdparty/font-awesome-svg-png/white/svg/users.svg', inline: true },
|
{ id: 'fa-users', src: 'src/thirdparty/font-awesome-svg-png/white/svg/users.svg', inline: true },
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
export default {
|
||||||
ecma: 8,
|
ecma: 8,
|
||||||
mangle: true,
|
mangle: true,
|
||||||
compress: {
|
compress: {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
import { actions } from './mastodon-data'
|
import { actions } from './mastodon-data.js'
|
||||||
|
import esMain from 'es-main'
|
||||||
|
|
||||||
const numStatuses = actions
|
const numStatuses = actions
|
||||||
.map(_ => _.post || _.boost)
|
.map(_ => _.post || _.boost)
|
||||||
|
@ -26,7 +27,7 @@ async function waitForMastodonData () {
|
||||||
console.log('Mastodon data populated')
|
console.log('Mastodon data populated')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (require.main === module) {
|
if (esMain(import.meta)) {
|
||||||
waitForMastodonData().catch(err => {
|
waitForMastodonData().catch(err => {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
|
import esMain from 'es-main'
|
||||||
|
|
||||||
export async function waitForMastodonUiToStart () {
|
export async function waitForMastodonUiToStart () {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -30,7 +31,7 @@ export async function waitForMastodonApiToStart () {
|
||||||
console.log('Mastodon API started up')
|
console.log('Mastodon API started up')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (require.main === module) {
|
if (esMain(import.meta)) {
|
||||||
Promise.resolve()
|
Promise.resolve()
|
||||||
.then(waitForMastodonApiToStart)
|
.then(waitForMastodonApiToStart)
|
||||||
.then(waitForMastodonUiToStart).catch(err => {
|
.then(waitForMastodonUiToStart).catch(err => {
|
||||||
|
|
48
package.json
48
package.json
|
@ -2,24 +2,29 @@
|
||||||
"name": "pinafore",
|
"name": "pinafore",
|
||||||
"description": "Alternative web client for Mastodon",
|
"description": "Alternative web client for Mastodon",
|
||||||
"version": "1.24.5",
|
"version": "1.24.5",
|
||||||
|
"type": "module",
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "standard && standard --plugin html 'src/routes/**/*.html'",
|
"lint": "standard && standard --plugin html 'src/routes/**/*.html'",
|
||||||
"lint-fix": "standard --fix && standard --fix --plugin html 'src/routes/**/*.html'",
|
"lint-fix": "standard --fix && standard --fix --plugin html 'src/routes/**/*.html'",
|
||||||
"dev": "run-s build-template-html build-assets serve-dev",
|
"dev": "run-s before-build serve-dev",
|
||||||
"serve-dev": "run-p --race build-template-html-watch sapper-dev",
|
"serve-dev": "run-p --race build-template-html-watch sapper-dev",
|
||||||
"sapper-dev": "cross-env NODE_ENV=development PORT=4002 node -r esm ./node_modules/sapper/sapper dev",
|
"sapper-dev": "cross-env NODE_ENV=development PORT=4002 WEBPACK_CONFIG_FILE=webpack/webpack.config.cjs SERVER_FILE_EXT=cjs node ./node_modules/sapper/sapper dev",
|
||||||
"before-build": "run-s build-template-html build-assets",
|
"before-build": "run-p build-template-html build-assets build-webpack-config",
|
||||||
"build": "cross-env NODE_ENV=production run-s build-steps",
|
"build": "cross-env NODE_ENV=production run-s build-steps",
|
||||||
"build-steps": "run-s before-build sapper-export build-vercel-json",
|
"build-steps": "run-s before-build sapper-export build-vercel-json",
|
||||||
"sapper-build": "node -r esm ./node_modules/sapper/sapper build",
|
"sapper-build": "cross-env WEBPACK_CONFIG_FILE=webpack/webpack.config.cjs SERVER_FILE_EXT=cjs node ./node_modules/sapper/sapper build",
|
||||||
"start": "node server.js",
|
"start": "node server.js",
|
||||||
"build-and-start": "run-s build start",
|
"build-and-start": "run-s build start",
|
||||||
"build-template-html": "node -r esm ./bin/build-template-html.js",
|
"build-template-html": "node ./bin/build-template-html.js",
|
||||||
"build-template-html-watch": "node -r esm ./bin/build-template-html.js --watch",
|
"build-template-html-watch": "node ./bin/build-template-html.js --watch",
|
||||||
"build-assets": "node -r esm ./bin/build-assets.js",
|
"build-assets": "node ./bin/build-assets.js",
|
||||||
"clone-mastodon": "node -r esm ./bin/clone-mastodon.js",
|
"build-webpack-config": "rollup -c ./webpack/rollup.config.js",
|
||||||
"install-mastodon": "node -r esm ./bin/install-mastodon.js",
|
"clone-mastodon": "node ./bin/clone-mastodon.js",
|
||||||
"run-mastodon": "node -r esm ./bin/run-mastodon.js",
|
"install-mastodon": "node ./bin/install-mastodon.js",
|
||||||
|
"run-mastodon": "node ./bin/run-mastodon.js",
|
||||||
"test": "cross-env BROWSER=chrome:headless run-s test-browser",
|
"test": "cross-env BROWSER=chrome:headless run-s test-browser",
|
||||||
"test-browser": "run-p --race run-mastodon build-and-start test-mastodon",
|
"test-browser": "run-p --race run-mastodon build-and-start test-mastodon",
|
||||||
"test-mastodon": "run-s wait-for-mastodon-to-start wait-for-mastodon-data testcafe",
|
"test-mastodon": "run-s wait-for-mastodon-to-start wait-for-mastodon-data testcafe",
|
||||||
|
@ -28,25 +33,27 @@
|
||||||
"testcafe": "run-s testcafe-suite0 testcafe-suite1",
|
"testcafe": "run-s testcafe-suite0 testcafe-suite1",
|
||||||
"testcafe-suite0": "cross-env-shell testcafe -c 2 $BROWSER tests/spec/0*",
|
"testcafe-suite0": "cross-env-shell testcafe -c 2 $BROWSER tests/spec/0*",
|
||||||
"testcafe-suite1": "cross-env-shell testcafe $BROWSER tests/spec/1*",
|
"testcafe-suite1": "cross-env-shell testcafe $BROWSER tests/spec/1*",
|
||||||
"test-unit": "NODE_ENV=test mocha -r esm -r bin/browser-shim.js tests/unit/",
|
"test-unit": "NODE_ENV=test mocha -r bin/browser-shim.js tests/unit/",
|
||||||
"test-in-ci-suite0": "cross-env BROWSER=chrome:headless run-p --race run-mastodon start test-mastodon-suite0",
|
"test-in-ci-suite0": "cross-env BROWSER=chrome:headless run-p --race run-mastodon start test-mastodon-suite0",
|
||||||
"test-in-ci-suite1": "cross-env BROWSER=chrome:headless run-p --race run-mastodon start test-mastodon-suite1",
|
"test-in-ci-suite1": "cross-env BROWSER=chrome:headless run-p --race run-mastodon start test-mastodon-suite1",
|
||||||
"wait-for-mastodon-to-start": "node -r esm bin/wait-for-mastodon-to-start.js",
|
"wait-for-mastodon-to-start": "node bin/wait-for-mastodon-to-start.js",
|
||||||
"wait-for-mastodon-data": "node -r esm bin/wait-for-mastodon-data.js",
|
"wait-for-mastodon-data": "node bin/wait-for-mastodon-data.js",
|
||||||
"backup-mastodon-data": "./bin/backup-mastodon-data.sh",
|
"backup-mastodon-data": "./bin/backup-mastodon-data.sh",
|
||||||
"sapper-export": "cross-env PORT=22939 node -r esm ./node_modules/sapper/sapper export",
|
"sapper-export": "cross-env PORT=22939 WEBPACK_CONFIG_FILE=webpack/webpack.config.cjs SERVER_FILE_EXT=cjs node ./node_modules/sapper/sapper export",
|
||||||
"print-export-info": "node ./bin/print-export-info.js",
|
"print-export-info": "node ./bin/print-export-info.js",
|
||||||
"export-steps": "run-s before-build sapper-export print-export-info",
|
"export-steps": "run-s before-build sapper-export print-export-info",
|
||||||
"export": "cross-env NODE_ENV=production run-s export-steps",
|
"export": "cross-env NODE_ENV=production run-s export-steps",
|
||||||
"now-build": "run-s export",
|
"now-build": "run-s export",
|
||||||
"build-vercel-json": "node -r esm bin/build-vercel-json.js"
|
"build-vercel-json": "node bin/build-vercel-json.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@formatjs/intl-listformat": "^6.2.6",
|
"@formatjs/intl-listformat": "^6.2.6",
|
||||||
"@formatjs/intl-locale": "^2.4.33",
|
"@formatjs/intl-locale": "^2.4.33",
|
||||||
"@formatjs/intl-pluralrules": "^4.0.28",
|
"@formatjs/intl-pluralrules": "^4.0.28",
|
||||||
"@formatjs/intl-relativetimeformat": "^9.1.7",
|
"@formatjs/intl-relativetimeformat": "^9.1.7",
|
||||||
|
"@rollup/plugin-json": "^4.1.0",
|
||||||
"@rollup/plugin-replace": "^2.4.2",
|
"@rollup/plugin-replace": "^2.4.2",
|
||||||
|
"@stdlib/utils-noop": "^0.0.6",
|
||||||
"arrow-key-navigation": "^1.2.0",
|
"arrow-key-navigation": "^1.2.0",
|
||||||
"blurhash": "^1.1.3",
|
"blurhash": "^1.1.3",
|
||||||
"cheerio": "1.0.0-rc.10",
|
"cheerio": "1.0.0-rc.10",
|
||||||
|
@ -60,6 +67,7 @@
|
||||||
"emoji-picker-element-data": "^1.2.0",
|
"emoji-picker-element-data": "^1.2.0",
|
||||||
"emoji-regex": "^9.2.2",
|
"emoji-regex": "^9.2.2",
|
||||||
"encoding": "^0.1.13",
|
"encoding": "^0.1.13",
|
||||||
|
"es-main": "^1.0.2",
|
||||||
"escape-html": "^1.0.3",
|
"escape-html": "^1.0.3",
|
||||||
"esm": "^3.2.25",
|
"esm": "^3.2.25",
|
||||||
"events-light": "^1.0.5",
|
"events-light": "^1.0.5",
|
||||||
|
@ -75,8 +83,6 @@
|
||||||
"is-emoji-supported": "^0.0.5",
|
"is-emoji-supported": "^0.0.5",
|
||||||
"li": "^1.3.0",
|
"li": "^1.3.0",
|
||||||
"localstorage-memory": "^1.0.3",
|
"localstorage-memory": "^1.0.3",
|
||||||
"lodash-es": "4.17.15",
|
|
||||||
"lodash-webpack-plugin": "^0.11.6",
|
|
||||||
"mkdirp": "^1.0.4",
|
"mkdirp": "^1.0.4",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
|
@ -90,7 +96,7 @@
|
||||||
"rollup-plugin-terser": "^7.0.2",
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
"rtl-detect": "^1.0.3",
|
"rtl-detect": "^1.0.3",
|
||||||
"safari-14-idb-fix": "^1.0.3",
|
"safari-14-idb-fix": "^1.0.3",
|
||||||
"sapper": "nolanlawson/sapper#for-pinafore-25",
|
"sapper": "nolanlawson/sapper#for-pinafore-26",
|
||||||
"sass": "^1.35.1",
|
"sass": "^1.35.1",
|
||||||
"stringz": "^2.1.0",
|
"stringz": "^2.1.0",
|
||||||
"svelte": "^2.16.1",
|
"svelte": "^2.16.1",
|
||||||
|
@ -118,10 +124,10 @@
|
||||||
"standard": "^16.0.3",
|
"standard": "^16.0.3",
|
||||||
"testcafe": "^1.15.0-rc.3"
|
"testcafe": "^1.15.0-rc.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
|
||||||
"node": ">= 8"
|
|
||||||
},
|
|
||||||
"standard": {
|
"standard": {
|
||||||
|
"ignore": [
|
||||||
|
"webpack/*.cjs"
|
||||||
|
],
|
||||||
"globals": [
|
"globals": [
|
||||||
"AbortController",
|
"AbortController",
|
||||||
"Blob",
|
"Blob",
|
||||||
|
|
15
server.js
15
server.js
|
@ -1,9 +1,16 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
import express from 'express'
|
||||||
|
import compression from 'compression'
|
||||||
|
|
||||||
const path = require('path')
|
const __dirname = path.dirname(new URL(import.meta.url).pathname)
|
||||||
const express = require('express')
|
|
||||||
const compression = require('compression')
|
// JSON files not supported in ESM yet
|
||||||
const { routes: rawRoutes } = require('./vercel.json')
|
// https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-import-json
|
||||||
|
const vercelJson = JSON.parse(fs.readFileSync(path.join(__dirname, 'vercel.json'), 'utf8'))
|
||||||
|
|
||||||
|
const { routes: rawRoutes } = vercelJson
|
||||||
|
|
||||||
const { PORT = 4002 } = process.env
|
const { PORT = 4002 } = process.env
|
||||||
const app = express()
|
const app = express()
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import * as sapper from '../__sapper__/client.js'
|
import * as sapper from '../__sapper__/client.js'
|
||||||
import './routes/_utils/serviceWorkerClient'
|
import './routes/_utils/serviceWorkerClient.js'
|
||||||
import './routes/_utils/historyEvents'
|
import './routes/_utils/historyEvents.js'
|
||||||
import './routes/_utils/loadingMask'
|
import './routes/_utils/loadingMask.js'
|
||||||
import './routes/_utils/forceOnline'
|
import './routes/_utils/forceOnline.js'
|
||||||
import { mark, stop } from './routes/_utils/marks'
|
import { mark, stop } from './routes/_utils/marks.js'
|
||||||
import { loadPolyfills } from './routes/_utils/polyfills/loadPolyfills'
|
import { loadPolyfills } from './routes/_utils/polyfills/loadPolyfills.js'
|
||||||
import { loadNonCriticalPolyfills } from './routes/_utils/polyfills/loadNonCriticalPolyfills'
|
import { loadNonCriticalPolyfills } from './routes/_utils/polyfills/loadNonCriticalPolyfills.js'
|
||||||
import { idbReady } from './routes/_utils/idbReady'
|
import { idbReady } from './routes/_utils/idbReady.js'
|
||||||
|
|
||||||
Promise.all([idbReady(), loadPolyfills()]).then(() => {
|
Promise.all([idbReady(), loadPolyfills()]).then(() => {
|
||||||
mark('sapperStart')
|
mark('sapperStart')
|
||||||
|
@ -17,6 +17,6 @@ Promise.all([idbReady(), loadPolyfills()]).then(() => {
|
||||||
|
|
||||||
console.log('process.env.NODE_ENV', process.env.NODE_ENV)
|
console.log('process.env.NODE_ENV', process.env.NODE_ENV)
|
||||||
|
|
||||||
if (module.hot) {
|
if (import.meta.webpackHot) {
|
||||||
module.hot.accept()
|
import.meta.webpackHot.accept()
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
// To allow CSP to work correctly, we also calculate a sha256 hash during
|
// To allow CSP to work correctly, we also calculate a sha256 hash during
|
||||||
// the build process and write it to checksum.js.
|
// the build process and write it to checksum.js.
|
||||||
|
|
||||||
import { INLINE_THEME, DEFAULT_THEME, switchToTheme } from '../routes/_utils/themeEngine'
|
import { INLINE_THEME, DEFAULT_THEME, switchToTheme } from '../routes/_utils/themeEngine.js'
|
||||||
import { basename } from '../routes/_api/utils'
|
import { basename } from '../routes/_api/utils.js'
|
||||||
import { onUserIsLoggedOut } from '../routes/_actions/onUserIsLoggedOut'
|
import { onUserIsLoggedOut } from '../routes/_actions/onUserIsLoggedOut.js'
|
||||||
import { storeLite } from '../routes/_store/storeLite'
|
import { storeLite } from '../routes/_store/storeLite.js'
|
||||||
import { isIOSPre12Point2 } from '../routes/_utils/userAgent/isIOSPre12Point2'
|
import { isIOSPre12Point2 } from '../routes/_utils/userAgent/isIOSPre12Point2.js'
|
||||||
import { isMac } from '../routes/_utils/userAgent/isMac'
|
import { isMac } from '../routes/_utils/userAgent/isMac.js'
|
||||||
|
|
||||||
window.__themeColors = process.env.THEME_COLORS
|
window.__themeColors = process.env.THEME_COLORS
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { getAccountAccessibleName } from './getAccountAccessibleName'
|
import { getAccountAccessibleName } from './getAccountAccessibleName.js'
|
||||||
import { POST_PRIVACY_OPTIONS } from '../_static/statuses'
|
import { POST_PRIVACY_OPTIONS } from '../_static/statuses.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
function getNotificationText (notification, omitEmojiInDisplayNames) {
|
function getNotificationText (notification, omitEmojiInDisplayNames) {
|
||||||
if (!notification) {
|
if (!notification) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { removeEmoji } from '../_utils/removeEmoji'
|
import { removeEmoji } from '../_utils/removeEmoji.js'
|
||||||
|
|
||||||
export function getAccountAccessibleName (account, omitEmojiInDisplayNames) {
|
export function getAccountAccessibleName (account, omitEmojiInDisplayNames) {
|
||||||
const emojis = account.emojis
|
const emojis = account.emojis
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { getAccount } from '../_api/user'
|
import { getAccount } from '../_api/user.js'
|
||||||
import { getRelationship } from '../_api/relationships'
|
import { getRelationship } from '../_api/relationships.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
|
|
||||||
async function _updateAccount (accountId, instanceName, accessToken) {
|
async function _updateAccount (accountId, instanceName, accessToken) {
|
||||||
const localPromise = database.getAccount(instanceName, accountId)
|
const localPromise = database.getAccount(instanceName, accountId)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { getAccessTokenFromAuthCode, registerApplication, generateAuthLink } from '../_api/oauth'
|
import { getAccessTokenFromAuthCode, registerApplication, generateAuthLink } from '../_api/oauth.js'
|
||||||
import { getInstanceInfo } from '../_api/instance'
|
import { getInstanceInfo } from '../_api/instance.js'
|
||||||
import { goto } from '../../../__sapper__/client'
|
import { goto } from '../../../__sapper__/client.js'
|
||||||
import { DEFAULT_THEME, switchToTheme } from '../_utils/themeEngine'
|
import { DEFAULT_THEME, switchToTheme } from '../_utils/themeEngine.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { updateVerifyCredentialsForInstance } from './instances'
|
import { updateVerifyCredentialsForInstance } from './instances.js'
|
||||||
import { updateCustomEmojiForInstance } from './emoji'
|
import { updateCustomEmojiForInstance } from './emoji.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { DOMAIN_BLOCKS } from '../_static/blocks'
|
import { DOMAIN_BLOCKS } from '../_static/blocks.js'
|
||||||
|
|
||||||
const GENERIC_ERROR = `
|
const GENERIC_ERROR = `
|
||||||
Is this a valid Mastodon instance? Is a browser extension
|
Is this a valid Mastodon instance? Is a browser extension
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import { mark, stop } from '../_utils/marks'
|
import { mark, stop } from '../_utils/marks.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import uniqBy from 'lodash-es/uniqBy'
|
import { uniqBy, isEqual } from '../_thirdparty/lodash/objects.js'
|
||||||
import isEqual from 'lodash-es/isEqual'
|
import { database } from '../_database/database.js'
|
||||||
import { database } from '../_database/database'
|
import { concat } from '../_utils/arrays.js'
|
||||||
import { concat } from '../_utils/arrays'
|
import { scheduleIdleTask } from '../_utils/scheduleIdleTask.js'
|
||||||
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
|
import { timelineItemToSummary } from '../_utils/timelineItemToSummary.js'
|
||||||
import { timelineItemToSummary } from '../_utils/timelineItemToSummary'
|
|
||||||
|
|
||||||
function getExistingItemIdsSet (instanceName, timelineName) {
|
function getExistingItemIdsSet (instanceName, timelineName) {
|
||||||
const timelineItemSummaries = store.getForTimeline(instanceName, timelineName, 'timelineItemSummaries') || []
|
const timelineItemSummaries = store.getForTimeline(instanceName, timelineName, 'timelineItemSummaries') || []
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
|
|
||||||
const emojiMapper = emoji => emoji.unicode ? emoji.unicode : `:${emoji.shortcodes[0]}:`
|
const emojiMapper = emoji => emoji.unicode ? emoji.unicode : `:${emoji.shortcodes[0]}:`
|
||||||
const hashtagMapper = hashtag => `#${hashtag.name}`
|
const hashtagMapper = hashtag => `#${hashtag.name}`
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { search } from '../_api/search'
|
import { search } from '../_api/search.js'
|
||||||
import { SEARCH_RESULTS_LIMIT } from '../_static/autosuggest'
|
import { SEARCH_RESULTS_LIMIT } from '../_static/autosuggest.js'
|
||||||
import { concat } from '../_utils/arrays'
|
import { concat } from '../_utils/arrays.js'
|
||||||
import uniqBy from 'lodash-es/uniqBy'
|
import { uniqBy } from '../_thirdparty/lodash/objects.js'
|
||||||
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../_utils/scheduleIdleTask.js'
|
||||||
import { RequestThrottler } from '../_utils/RequestThrottler'
|
import { RequestThrottler } from '../_utils/RequestThrottler.js'
|
||||||
|
|
||||||
const DATABASE_SEARCH_RESULTS_LIMIT = 30
|
const DATABASE_SEARCH_RESULTS_LIMIT = 30
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../_utils/scheduleIdleTask.js'
|
||||||
import * as emojiDatabase from '../_utils/emojiDatabase'
|
import * as emojiDatabase from '../_utils/emojiDatabase.js'
|
||||||
import { SEARCH_RESULTS_LIMIT } from '../_static/autosuggest'
|
import { SEARCH_RESULTS_LIMIT } from '../_static/autosuggest.js'
|
||||||
import { testEmojiSupported } from '../_utils/testEmojiSupported'
|
import { testEmojiSupported } from '../_utils/testEmojiSupported.js'
|
||||||
import { mark, stop } from '../_utils/marks'
|
import { mark, stop } from '../_utils/marks.js'
|
||||||
|
|
||||||
async function searchEmoji (searchText) {
|
async function searchEmoji (searchText) {
|
||||||
let emojis = await emojiDatabase.findBySearchQuery(searchText)
|
let emojis = await emojiDatabase.findBySearchQuery(searchText)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { search } from '../_api/search'
|
import { search } from '../_api/search.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../_utils/scheduleIdleTask.js'
|
||||||
import { SEARCH_RESULTS_LIMIT } from '../_static/autosuggest'
|
import { SEARCH_RESULTS_LIMIT } from '../_static/autosuggest.js'
|
||||||
import { RequestThrottler } from '../_utils/RequestThrottler'
|
import { RequestThrottler } from '../_utils/RequestThrottler.js'
|
||||||
import { sum } from '../_utils/lodash-lite'
|
import { sum } from '../_utils/lodash-lite.js'
|
||||||
|
|
||||||
const HASHTAG_SEARCH_LIMIT = 10
|
const HASHTAG_SEARCH_LIMIT = 10
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { blockAccount, unblockAccount } from '../_api/block'
|
import { blockAccount, unblockAccount } from '../_api/block.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { updateLocalRelationship } from './accounts'
|
import { updateLocalRelationship } from './accounts.js'
|
||||||
import { emit } from '../_utils/eventBus'
|
import { emit } from '../_utils/eventBus.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function setAccountBlocked (accountId, block, toastOnSuccess) {
|
export async function setAccountBlocked (accountId, block, toastOnSuccess) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { bookmarkStatus, unbookmarkStatus } from '../_api/bookmark'
|
import { bookmarkStatus, unbookmarkStatus } from '../_api/bookmark.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function setStatusBookmarkedOrUnbookmarked (statusId, bookmarked) {
|
export async function setStatusBookmarkedOrUnbookmarked (statusId, bookmarked) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { postStatus as postStatusToServer } from '../_api/statuses'
|
import { postStatus as postStatusToServer } from '../_api/statuses.js'
|
||||||
import { addStatusOrNotification } from './addStatusOrNotification'
|
import { addStatusOrNotification } from './addStatusOrNotification.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { emit } from '../_utils/eventBus'
|
import { emit } from '../_utils/eventBus.js'
|
||||||
import { putMediaMetadata } from '../_api/media'
|
import { putMediaMetadata } from '../_api/media.js'
|
||||||
import uniqBy from 'lodash-es/uniqBy'
|
import { uniqBy } from '../_thirdparty/lodash/objects.js'
|
||||||
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../_utils/scheduleIdleTask.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function insertHandleForReply (statusId) {
|
export async function insertHandleForReply (statusId) {
|
||||||
const { currentInstance } = store.get()
|
const { currentInstance } = store.get()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
|
|
||||||
export function enablePoll (realm) {
|
export function enablePoll (realm) {
|
||||||
store.setComposeData(realm, {
|
store.setComposeData(realm, {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
|
|
||||||
export function toggleContentWarningShown (realm) {
|
export function toggleContentWarningShown (realm) {
|
||||||
const shown = store.getComposeData(realm, 'contentWarningShown')
|
const shown = store.getComposeData(realm, 'contentWarningShown')
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { importShowCopyDialog } from '../_components/dialog/asyncDialogs/importShowCopyDialog.js'
|
import { importShowCopyDialog } from '../_components/dialog/asyncDialogs/importShowCopyDialog.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
|
|
||||||
export async function copyText (text) {
|
export async function copyText (text) {
|
||||||
if (navigator.clipboard) { // not supported in all browsers
|
if (navigator.clipboard) { // not supported in all browsers
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { decode as decodeBlurhash, init as initBlurhash } from '../_utils/blurhash'
|
import { decode as decodeBlurhash, init as initBlurhash } from '../_utils/blurhash.js'
|
||||||
import { mark, stop } from '../_utils/marks'
|
import { mark, stop } from '../_utils/marks.js'
|
||||||
import { get } from '../_utils/lodash-lite'
|
import { get } from '../_utils/lodash-lite.js'
|
||||||
import { statusHtmlToPlainText } from '../_utils/statusHtmlToPlainText'
|
import { statusHtmlToPlainText } from '../_utils/statusHtmlToPlainText.js'
|
||||||
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../_utils/scheduleIdleTask.js'
|
||||||
|
|
||||||
async function getNotification (instanceName, timelineType, timelineValue, itemId) {
|
async function getNotification (instanceName, timelineType, timelineValue, itemId) {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { deleteStatus } from '../_api/delete'
|
import { deleteStatus } from '../_api/delete.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { deleteStatus as deleteStatusLocally } from './deleteStatuses'
|
import { deleteStatus as deleteStatusLocally } from './deleteStatuses.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function doDeleteStatus (statusId) {
|
export async function doDeleteStatus (statusId) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { statusHtmlToPlainText } from '../_utils/statusHtmlToPlainText'
|
import { statusHtmlToPlainText } from '../_utils/statusHtmlToPlainText.js'
|
||||||
import { importShowComposeDialog } from '../_components/dialog/asyncDialogs/importShowComposeDialog.js'
|
import { importShowComposeDialog } from '../_components/dialog/asyncDialogs/importShowComposeDialog.js'
|
||||||
import { doDeleteStatus } from './delete'
|
import { doDeleteStatus } from './delete.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
|
|
||||||
export async function deleteAndRedraft (status) {
|
export async function deleteAndRedraft (status) {
|
||||||
const deleteStatusPromise = doDeleteStatus(status.id)
|
const deleteStatusPromise = doDeleteStatus(status.id)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { getIdsThatRebloggedThisStatus, getNotificationIdsForStatuses } from './statuses'
|
import { getIdsThatRebloggedThisStatus, getNotificationIdsForStatuses } from './statuses.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import isEqual from 'lodash-es/isEqual'
|
import { isEqual } from '../_thirdparty/lodash/objects.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../_utils/scheduleIdleTask.js'
|
||||||
|
|
||||||
function filterItemIdsFromTimelines (instanceName, timelineFilter, idFilter) {
|
function filterItemIdsFromTimelines (instanceName, timelineFilter, idFilter) {
|
||||||
const keys = ['timelineItemSummaries', 'timelineItemSummariesToAdd']
|
const keys = ['timelineItemSummaries', 'timelineItemSummariesToAdd']
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// Used in the integration tests. Can't see a problem with exposing this publicly
|
// Used in the integration tests. Can't see a problem with exposing this publicly
|
||||||
// since you would have to know the access token anyway.
|
// since you would have to know the access token anyway.
|
||||||
|
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { goto } from '../../../__sapper__/client'
|
import { goto } from '../../../__sapper__/client.js'
|
||||||
|
|
||||||
export function doQuickLoginIfNecessary () {
|
export function doQuickLoginIfNecessary () {
|
||||||
const params = new URLSearchParams(location.search)
|
const params = new URLSearchParams(location.search)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import {
|
import {
|
||||||
cacheFirstUpdateAfter,
|
cacheFirstUpdateAfter,
|
||||||
cacheFirstUpdateOnlyIfNotInCache
|
cacheFirstUpdateOnlyIfNotInCache
|
||||||
} from '../_utils/sync'
|
} from '../_utils/sync.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { getCustomEmoji } from '../_api/emoji'
|
import { getCustomEmoji } from '../_api/emoji.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import isEqual from 'lodash-es/isEqual'
|
import { isEqual } from '../_thirdparty/lodash/objects.js'
|
||||||
|
|
||||||
async function syncEmojiForInstance (instanceName, syncMethod) {
|
async function syncEmojiForInstance (instanceName, syncMethod) {
|
||||||
await syncMethod(
|
await syncMethod(
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { favoriteStatus, unfavoriteStatus } from '../_api/favorite'
|
import { favoriteStatus, unfavoriteStatus } from '../_api/favorite.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function setFavorited (statusId, favorited) {
|
export async function setFavorited (statusId, favorited) {
|
||||||
const { online } = store.get()
|
const { online } = store.get()
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { createFilter, getFilters, updateFilter, deleteFilter as doDeleteFilter } from '../_api/filters'
|
import { createFilter, getFilters, updateFilter, deleteFilter as doDeleteFilter } from '../_api/filters.js'
|
||||||
import { cacheFirstUpdateAfter, cacheFirstUpdateOnlyIfNotInCache } from '../_utils/sync'
|
import { cacheFirstUpdateAfter, cacheFirstUpdateOnlyIfNotInCache } from '../_utils/sync.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { isEqual } from 'lodash-es'
|
import { isEqual } from '../_thirdparty/lodash/objects.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
import { emit } from '../_utils/eventBus'
|
import { emit } from '../_utils/eventBus.js'
|
||||||
|
|
||||||
async function syncFilters (instanceName, syncMethod) {
|
async function syncFilters (instanceName, syncMethod) {
|
||||||
const { loggedInInstances } = store.get()
|
const { loggedInInstances } = store.get()
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { followAccount, unfollowAccount } from '../_api/follow'
|
import { followAccount, unfollowAccount } from '../_api/follow.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { updateLocalRelationship } from './accounts'
|
import { updateLocalRelationship } from './accounts.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function setAccountFollowed (accountId, follow, toastOnSuccess) {
|
export async function setAccountFollowed (accountId, follow, toastOnSuccess) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { cacheFirstUpdateAfter } from '../_utils/sync'
|
import { cacheFirstUpdateAfter } from '../_utils/sync.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { getFollowRequests } from '../_api/followRequests'
|
import { getFollowRequests } from '../_api/followRequests.js'
|
||||||
import { get } from '../_utils/lodash-lite'
|
import { get } from '../_utils/lodash-lite.js'
|
||||||
|
|
||||||
export async function updateFollowRequestCountIfLockedAccount (instanceName) {
|
export async function updateFollowRequestCountIfLockedAccount (instanceName) {
|
||||||
const { verifyCredentials, loggedInInstances } = store.get()
|
const { verifyCredentials, loggedInInstances } = store.get()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { getTimeline } from '../_api/timelines'
|
import { getTimeline } from '../_api/timelines.js'
|
||||||
|
|
||||||
export async function getRecentStatusesForAccount (accountId) {
|
export async function getRecentStatusesForAccount (accountId) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { goto } from '../../../__sapper__/client'
|
import { goto } from '../../../__sapper__/client.js'
|
||||||
import { emit } from '../_utils/eventBus'
|
import { emit } from '../_utils/eventBus.js'
|
||||||
|
|
||||||
// Go to the search page, and also focus the search input. For accessibility
|
// Go to the search page, and also focus the search input. For accessibility
|
||||||
// and usability reasons, this only happens on pressing these particular hotkeys.
|
// and usability reasons, this only happens on pressing these particular hotkeys.
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { getVerifyCredentials } from '../_api/user'
|
import { getVerifyCredentials } from '../_api/user.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { switchToTheme } from '../_utils/themeEngine'
|
import { switchToTheme } from '../_utils/themeEngine.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { goto } from '../../../__sapper__/client'
|
import { goto } from '../../../__sapper__/client.js'
|
||||||
import { cacheFirstUpdateAfter } from '../_utils/sync'
|
import { cacheFirstUpdateAfter } from '../_utils/sync.js'
|
||||||
import { getInstanceInfo } from '../_api/instance'
|
import { getInstanceInfo } from '../_api/instance.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { importVirtualListStore } from '../_utils/asyncModules/importVirtualListStore.js'
|
import { importVirtualListStore } from '../_utils/asyncModules/importVirtualListStore.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export function changeTheme (instanceName, newTheme) {
|
export function changeTheme (instanceName, newTheme) {
|
||||||
const { instanceThemes } = store.get()
|
const { instanceThemes } = store.get()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { getLists } from '../_api/lists'
|
import { getLists } from '../_api/lists.js'
|
||||||
import { cacheFirstUpdateAfter, cacheFirstUpdateOnlyIfNotInCache } from '../_utils/sync'
|
import { cacheFirstUpdateAfter, cacheFirstUpdateOnlyIfNotInCache } from '../_utils/sync.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
|
|
||||||
async function syncLists (instanceName, syncMethod) {
|
async function syncLists (instanceName, syncMethod) {
|
||||||
const { loggedInInstances } = store.get()
|
const { loggedInInstances } = store.get()
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { uploadMedia } from '../_api/media'
|
import { uploadMedia } from '../_api/media.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../_utils/scheduleIdleTask.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
|
|
||||||
export async function doMediaUpload (realm, file) {
|
export async function doMediaUpload (realm, file) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { importShowComposeDialog } from '../_components/dialog/asyncDialogs/importShowComposeDialog.js'
|
import { importShowComposeDialog } from '../_components/dialog/asyncDialogs/importShowComposeDialog.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
|
|
||||||
export async function composeNewStatusMentioning (account) {
|
export async function composeNewStatusMentioning (account) {
|
||||||
store.setComposeData('dialog', { text: `@${account.acct} ` })
|
store.setComposeData('dialog', { text: `@${account.acct} ` })
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { muteAccount, unmuteAccount } from '../_api/mute'
|
import { muteAccount, unmuteAccount } from '../_api/mute.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { updateLocalRelationship } from './accounts'
|
import { updateLocalRelationship } from './accounts.js'
|
||||||
import { emit } from '../_utils/eventBus'
|
import { emit } from '../_utils/eventBus.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function setAccountMuted (accountId, mute, notifications, toastOnSuccess) {
|
export async function setAccountMuted (accountId, mute, notifications, toastOnSuccess) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { muteConversation, unmuteConversation } from '../_api/muteConversation'
|
import { muteConversation, unmuteConversation } from '../_api/muteConversation.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function setConversationMuted (statusId, mute, toastOnSuccess) {
|
export async function setConversationMuted (statusId, mute, toastOnSuccess) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { pinStatus, unpinStatus } from '../_api/pin'
|
import { pinStatus, unpinStatus } from '../_api/pin.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { emit } from '../_utils/eventBus'
|
import { emit } from '../_utils/eventBus.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function setStatusPinnedOrUnpinned (statusId, pinned, toastOnSuccess) {
|
export async function setStatusPinnedOrUnpinned (statusId, pinned, toastOnSuccess) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { cacheFirstUpdateAfter } from '../_utils/sync'
|
import { cacheFirstUpdateAfter } from '../_utils/sync.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import {
|
import {
|
||||||
getPinnedStatuses
|
getPinnedStatuses
|
||||||
} from '../_api/pinnedStatuses'
|
} from '../_api/pinnedStatuses.js'
|
||||||
|
|
||||||
export async function updatePinnedStatusesForAccount (accountId) {
|
export async function updatePinnedStatusesForAccount (accountId) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { getPoll as getPollApi, voteOnPoll as voteOnPollApi } from '../_api/polls'
|
import { getPoll as getPollApi, voteOnPoll as voteOnPollApi } from '../_api/polls.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function getPoll (pollId) {
|
export async function getPoll (pollId) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
|
|
||||||
export function setPostPrivacy (realm, postPrivacyKey) {
|
export function setPostPrivacy (realm, postPrivacyKey) {
|
||||||
store.setComposeData(realm, { postPrivacy: postPrivacyKey })
|
store.setComposeData(realm, { postPrivacy: postPrivacyKey })
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { getSubscription, deleteSubscription, postSubscription, putSubscription } from '../_api/pushSubscription'
|
import { getSubscription, deleteSubscription, postSubscription, putSubscription } from '../_api/pushSubscription.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { urlBase64ToUint8Array } from '../_utils/base64'
|
import { urlBase64ToUint8Array } from '../_utils/base64.js'
|
||||||
|
|
||||||
const dummyApplicationServerKey = 'BImgAz4cF_yvNFp8uoBJCaGpCX4d0atNIFMHfBvAAXCyrnn9IMAFQ10DW_ZvBCzGeR4fZI5FnEi2JVcRE-L88jY='
|
const dummyApplicationServerKey = 'BImgAz4cF_yvNFp8uoBJCaGpCX4d0atNIFMHfBvAAXCyrnn9IMAFQ10DW_ZvBCzGeR4fZI5FnEi2JVcRE-L88jY='
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { reblogStatus, unreblogStatus } from '../_api/reblog'
|
import { reblogStatus, unreblogStatus } from '../_api/reblog.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function setReblogged (statusId, reblogged) {
|
export async function setReblogged (statusId, reblogged) {
|
||||||
const online = store.get()
|
const online = store.get()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { report } from '../_api/report'
|
import { report } from '../_api/report.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function reportStatuses (account, statusIds, comment, forward) {
|
export async function reportStatuses (account, statusIds, comment, forward) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { approveFollowRequest, rejectFollowRequest } from '../_api/requests'
|
import { approveFollowRequest, rejectFollowRequest } from '../_api/requests.js'
|
||||||
import { emit } from '../_utils/eventBus'
|
import { emit } from '../_utils/eventBus.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function setFollowRequestApprovedOrRejected (accountId, approved, toastOnSuccess) {
|
export async function setFollowRequestApprovedOrRejected (accountId, approved, toastOnSuccess) {
|
||||||
const {
|
const {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { search } from '../_api/search'
|
import { search } from '../_api/search.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function doSearch () {
|
export async function doSearch () {
|
||||||
const { currentInstance, accessToken, queryInSearch } = store.get()
|
const { currentInstance, accessToken, queryInSearch } = store.get()
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { blockDomain, unblockDomain } from '../_api/blockDomain'
|
import { blockDomain, unblockDomain } from '../_api/blockDomain.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { updateRelationship } from './accounts'
|
import { updateRelationship } from './accounts.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function setDomainBlocked (accountId, domain, block, toastOnSuccess) {
|
export async function setDomainBlocked (accountId, domain, block, toastOnSuccess) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { setShowReblogs as setShowReblogsApi } from '../_api/showReblogs'
|
import { setShowReblogs as setShowReblogsApi } from '../_api/showReblogs.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { updateLocalRelationship } from './accounts'
|
import { updateLocalRelationship } from './accounts.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function setShowReblogs (accountId, showReblogs, toastOnSuccess) {
|
export async function setShowReblogs (accountId, showReblogs, toastOnSuccess) {
|
||||||
const { currentInstance, accessToken } = store.get()
|
const { currentInstance, accessToken } = store.get()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { statusHtmlToPlainText } from '../_utils/statusHtmlToPlainText'
|
import { statusHtmlToPlainText } from '../_utils/statusHtmlToPlainText.js'
|
||||||
import { formatIntl } from '../_utils/formatIntl'
|
import { formatIntl } from '../_utils/formatIntl.js'
|
||||||
|
|
||||||
export async function shareStatus (status) {
|
export async function shareStatus (status) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { importShowComposeDialog } from '../_components/dialog/asyncDialogs/importShowComposeDialog'
|
import { importShowComposeDialog } from '../_components/dialog/asyncDialogs/importShowComposeDialog.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { doMediaUpload } from './media'
|
import { doMediaUpload } from './media.js'
|
||||||
|
|
||||||
// show a compose dialog, typically invoked by the Web Share API or a PWA shortcut
|
// show a compose dialog, typically invoked by the Web Share API or a PWA shortcut
|
||||||
export async function showComposeDialog () {
|
export async function showComposeDialog () {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { showMoreItemsForCurrentTimeline } from './timeline'
|
import { showMoreItemsForCurrentTimeline } from './timeline.js'
|
||||||
import { scrollToTop } from '../_utils/scrollToTop'
|
import { scrollToTop } from '../_utils/scrollToTop.js'
|
||||||
import { createStatusOrNotificationUuid } from '../_utils/createStatusOrNotificationUuid'
|
import { createStatusOrNotificationUuid } from '../_utils/createStatusOrNotificationUuid.js'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { tryToFocusElement } from '../_utils/tryToFocusElement'
|
import { tryToFocusElement } from '../_utils/tryToFocusElement.js'
|
||||||
|
|
||||||
export function showMoreAndScrollToTop () {
|
export function showMoreAndScrollToTop () {
|
||||||
// Similar to Twitter, pressing "." will click the "show more" button and select
|
// Similar to Twitter, pressing "." will click the "show more" button and select
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
|
|
||||||
export async function getIdThatThisStatusReblogged (instanceName, statusId) {
|
export async function getIdThatThisStatusReblogged (instanceName, statusId) {
|
||||||
const status = await database.getStatus(instanceName, statusId)
|
const status = await database.getStatus(instanceName, statusId)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { addStatusesOrNotifications } from '../addStatusOrNotification'
|
import { addStatusesOrNotifications } from '../addStatusOrNotification.js'
|
||||||
import { getTimeline } from '../../_api/timelines'
|
import { getTimeline } from '../../_api/timelines.js'
|
||||||
|
|
||||||
const TIMELINE_GAP_BATCH_SIZE = 20 // Mastodon timeline API maximum limit
|
const TIMELINE_GAP_BATCH_SIZE = 20 // Mastodon timeline API maximum limit
|
||||||
const MAX_NUM_REQUESTS = 15 // to avoid getting caught in an infinite loop somehow
|
const MAX_NUM_REQUESTS = 15 // to avoid getting caught in an infinite loop somehow
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { mark, stop } from '../../_utils/marks'
|
import { mark, stop } from '../../_utils/marks.js'
|
||||||
import { deleteStatus } from '../deleteStatuses'
|
import { deleteStatus } from '../deleteStatuses.js'
|
||||||
import { addStatusOrNotification } from '../addStatusOrNotification'
|
import { addStatusOrNotification } from '../addStatusOrNotification.js'
|
||||||
import { emit } from '../../_utils/eventBus'
|
import { emit } from '../../_utils/eventBus.js'
|
||||||
|
|
||||||
const KNOWN_EVENTS = ['update', 'delete', 'notification', 'conversation', 'filters_changed']
|
const KNOWN_EVENTS = ['update', 'delete', 'notification', 'conversation', 'filters_changed']
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { TimelineStream } from '../../_api/stream/TimelineStream'
|
import { TimelineStream } from '../../_api/stream/TimelineStream.js'
|
||||||
import { processMessage } from './processMessage'
|
import { processMessage } from './processMessage.js'
|
||||||
import { fillStreamingGap } from './fillStreamingGap'
|
import { fillStreamingGap } from './fillStreamingGap.js'
|
||||||
import { store } from '../../_store/store'
|
import { store } from '../../_store/store.js'
|
||||||
|
|
||||||
export function createStream (api, instanceName, accessToken, timelineName, firstStatusId, firstNotificationId) {
|
export function createStream (api, instanceName, accessToken, timelineName, firstStatusId, firstNotificationId) {
|
||||||
console.log(`streaming ${instanceName} ${timelineName}: createStream`, 'firstStatusId', firstStatusId,
|
console.log(`streaming ${instanceName} ${timelineName}: createStream`, 'firstStatusId', firstStatusId,
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store.js'
|
||||||
import { getTimeline } from '../_api/timelines'
|
import { getTimeline } from '../_api/timelines.js'
|
||||||
import { toast } from '../_components/toast/toast'
|
import { toast } from '../_components/toast/toast.js'
|
||||||
import { mark, stop } from '../_utils/marks'
|
import { mark, stop } from '../_utils/marks.js'
|
||||||
import { concat, mergeArrays } from '../_utils/arrays'
|
import { concat, mergeArrays } from '../_utils/arrays.js'
|
||||||
import { compareTimelineItemSummaries } from '../_utils/statusIdSorting'
|
import { compareTimelineItemSummaries } from '../_utils/statusIdSorting.js'
|
||||||
import isEqual from 'lodash-es/isEqual'
|
import { uniqBy, isEqual } from '../_thirdparty/lodash/objects.js'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database.js'
|
||||||
import { getStatus, getStatusContext } from '../_api/statuses'
|
import { getStatus, getStatusContext } from '../_api/statuses.js'
|
||||||
import { emit } from '../_utils/eventBus'
|
import { emit } from '../_utils/eventBus.js'
|
||||||
import { TIMELINE_BATCH_SIZE } from '../_static/timelines'
|
import { TIMELINE_BATCH_SIZE } from '../_static/timelines.js'
|
||||||
import { timelineItemToSummary } from '../_utils/timelineItemToSummary'
|
import { timelineItemToSummary } from '../_utils/timelineItemToSummary.js'
|
||||||
import uniqBy from 'lodash-es/uniqBy'
|
import { addStatusesOrNotifications } from './addStatusOrNotification.js'
|
||||||
import { addStatusesOrNotifications } from './addStatusOrNotification'
|
import { scheduleIdleTask } from '../_utils/scheduleIdleTask.js'
|
||||||
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
|
import { sortItemSummariesForThread } from '../_utils/sortItemSummariesForThread.js'
|
||||||
import { sortItemSummariesForThread } from '../_utils/sortItemSummariesForThread'
|
|
||||||
import li from 'li'
|
import li from 'li'
|
||||||
|
|
||||||
const byId = _ => _.id
|
const byId = _ => _.id
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { importShowMuteDialog } from '../_components/dialog/asyncDialogs/importShowMuteDialog.js'
|
import { importShowMuteDialog } from '../_components/dialog/asyncDialogs/importShowMuteDialog.js'
|
||||||
import { setAccountMuted } from './mute'
|
import { setAccountMuted } from './mute.js'
|
||||||
|
|
||||||
export async function toggleMute (account, mute) {
|
export async function toggleMute (account, mute) {
|
||||||
if (mute) {
|
if (mute) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
import { post, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { post, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
|
|
||||||
export async function blockAccount (instanceName, accessToken, accountId) {
|
export async function blockAccount (instanceName, accessToken, accountId) {
|
||||||
const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/block`
|
const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/block`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { post, WRITE_TIMEOUT, paramsString, del } from '../_utils/ajax'
|
import { post, WRITE_TIMEOUT, paramsString, del } from '../_utils/ajax.js'
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
|
|
||||||
export async function blockDomain (instanceName, accessToken, domain) {
|
export async function blockDomain (instanceName, accessToken, domain) {
|
||||||
const url = `${basename(instanceName)}/api/v1/domain_blocks?${paramsString({ domain })}`
|
const url = `${basename(instanceName)}/api/v1/domain_blocks?${paramsString({ domain })}`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { DEFAULT_TIMEOUT, get, paramsString } from '../_utils/ajax'
|
import { DEFAULT_TIMEOUT, get, paramsString } from '../_utils/ajax.js'
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
|
|
||||||
export async function getBlockedAccounts (instanceName, accessToken, limit = 80) {
|
export async function getBlockedAccounts (instanceName, accessToken, limit = 80) {
|
||||||
let url = `${basename(instanceName)}/api/v1/blocks`
|
let url = `${basename(instanceName)}/api/v1/blocks`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { post, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { post, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
|
|
||||||
export async function bookmarkStatus (instanceName, accessToken, statusId) {
|
export async function bookmarkStatus (instanceName, accessToken, statusId) {
|
||||||
const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/bookmark`
|
const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/bookmark`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
import { del, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { del, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
|
|
||||||
export async function deleteStatus (instanceName, accessToken, statusId) {
|
export async function deleteStatus (instanceName, accessToken, statusId) {
|
||||||
const url = `${basename(instanceName)}/api/v1/statuses/${statusId}`
|
const url = `${basename(instanceName)}/api/v1/statuses/${statusId}`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
import { DEFAULT_TIMEOUT, get } from '../_utils/ajax'
|
import { DEFAULT_TIMEOUT, get } from '../_utils/ajax.js'
|
||||||
|
|
||||||
export function getCustomEmoji (instanceName, accessToken) {
|
export function getCustomEmoji (instanceName, accessToken) {
|
||||||
const url = `${basename(instanceName)}/api/v1/custom_emojis`
|
const url = `${basename(instanceName)}/api/v1/custom_emojis`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { post, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { post, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
import { basename, auth } from './utils'
|
import { basename, auth } from './utils.js'
|
||||||
|
|
||||||
export async function favoriteStatus (instanceName, accessToken, statusId) {
|
export async function favoriteStatus (instanceName, accessToken, statusId) {
|
||||||
const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/favourite`
|
const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/favourite`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { get, DEFAULT_TIMEOUT, post, WRITE_TIMEOUT, put, del } from '../_utils/ajax'
|
import { get, DEFAULT_TIMEOUT, post, WRITE_TIMEOUT, put, del } from '../_utils/ajax.js'
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
|
|
||||||
export function getFilters (instanceName, accessToken) {
|
export function getFilters (instanceName, accessToken) {
|
||||||
const url = `${basename(instanceName)}/api/v1/filters`
|
const url = `${basename(instanceName)}/api/v1/filters`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { post, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { post, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
|
|
||||||
export async function followAccount (instanceName, accessToken, accountId) {
|
export async function followAccount (instanceName, accessToken, accountId) {
|
||||||
const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/follow`
|
const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/follow`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { DEFAULT_TIMEOUT, get, post, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { DEFAULT_TIMEOUT, get, post, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
|
|
||||||
export async function getFollowRequests (instanceName, accessToken) {
|
export async function getFollowRequests (instanceName, accessToken) {
|
||||||
const url = `${basename(instanceName)}/api/v1/follow_requests`
|
const url = `${basename(instanceName)}/api/v1/follow_requests`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { get, paramsString, DEFAULT_TIMEOUT } from '../_utils/ajax'
|
import { get, paramsString, DEFAULT_TIMEOUT } from '../_utils/ajax.js'
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
|
|
||||||
export async function getFollows (instanceName, accessToken, accountId, limit = 80) {
|
export async function getFollows (instanceName, accessToken, accountId, limit = 80) {
|
||||||
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/following`
|
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/following`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { get, DEFAULT_TIMEOUT } from '../_utils/ajax'
|
import { get, DEFAULT_TIMEOUT } from '../_utils/ajax.js'
|
||||||
import { basename } from './utils'
|
import { basename } from './utils.js'
|
||||||
|
|
||||||
export function getInstanceInfo (instanceName) {
|
export function getInstanceInfo (instanceName) {
|
||||||
const url = `${basename(instanceName)}/api/v1/instance`
|
const url = `${basename(instanceName)}/api/v1/instance`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { get, DEFAULT_TIMEOUT, post, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { get, DEFAULT_TIMEOUT, post, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
|
|
||||||
export function getLists (instanceName, accessToken) {
|
export function getLists (instanceName, accessToken) {
|
||||||
const url = `${basename(instanceName)}/api/v1/lists`
|
const url = `${basename(instanceName)}/api/v1/lists`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
import { post, put, MEDIA_WRITE_TIMEOUT, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { post, put, MEDIA_WRITE_TIMEOUT, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
|
|
||||||
export async function uploadMedia (instanceName, accessToken, file, description) {
|
export async function uploadMedia (instanceName, accessToken, file, description) {
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
import { post, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { post, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
|
|
||||||
export async function muteAccount (instanceName, accessToken, accountId, notifications) {
|
export async function muteAccount (instanceName, accessToken, accountId, notifications) {
|
||||||
const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/mute`
|
const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/mute`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
import { post, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { post, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
|
|
||||||
export async function muteConversation (instanceName, accessToken, statusId) {
|
export async function muteConversation (instanceName, accessToken, statusId) {
|
||||||
const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/mute`
|
const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/mute`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { post, paramsString, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { post, paramsString, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
import { basename } from './utils'
|
import { basename } from './utils.js'
|
||||||
|
|
||||||
const WEBSITE = 'https://pinafore.social'
|
const WEBSITE = 'https://pinafore.social'
|
||||||
const SCOPES = 'read write follow push'
|
const SCOPES = 'read write follow push'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { post, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { post, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
|
|
||||||
export async function pinStatus (instanceName, accessToken, statusId) {
|
export async function pinStatus (instanceName, accessToken, statusId) {
|
||||||
const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/pin`
|
const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/pin`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { get, paramsString, DEFAULT_TIMEOUT } from '../_utils/ajax'
|
import { get, paramsString, DEFAULT_TIMEOUT } from '../_utils/ajax.js'
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
|
|
||||||
export async function getPinnedStatuses (instanceName, accessToken, accountId) {
|
export async function getPinnedStatuses (instanceName, accessToken, accountId) {
|
||||||
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/statuses`
|
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/statuses`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { get, post, DEFAULT_TIMEOUT, WRITE_TIMEOUT } from '../_utils/ajax'
|
import { get, post, DEFAULT_TIMEOUT, WRITE_TIMEOUT } from '../_utils/ajax.js'
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
|
|
||||||
export async function getPoll (instanceName, accessToken, pollId) {
|
export async function getPoll (instanceName, accessToken, pollId) {
|
||||||
const url = `${basename(instanceName)}/api/v1/polls/${pollId}`
|
const url = `${basename(instanceName)}/api/v1/polls/${pollId}`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
import { post, put, get, del } from '../_utils/ajax'
|
import { post, put, get, del } from '../_utils/ajax.js'
|
||||||
|
|
||||||
export async function postSubscription (instanceName, accessToken, subscription, alerts) {
|
export async function postSubscription (instanceName, accessToken, subscription, alerts) {
|
||||||
const url = `${basename(instanceName)}/api/v1/push/subscription`
|
const url = `${basename(instanceName)}/api/v1/push/subscription`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { post } from '../_utils/ajax'
|
import { post } from '../_utils/ajax.js'
|
||||||
import { basename, auth } from './utils'
|
import { basename, auth } from './utils.js'
|
||||||
|
|
||||||
export async function reblogStatus (instanceName, accessToken, statusId) {
|
export async function reblogStatus (instanceName, accessToken, statusId) {
|
||||||
const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/reblog`
|
const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/reblog`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { get, paramsString, DEFAULT_TIMEOUT } from '../_utils/ajax'
|
import { get, paramsString, DEFAULT_TIMEOUT } from '../_utils/ajax.js'
|
||||||
import { auth, basename } from './utils'
|
import { auth, basename } from './utils.js'
|
||||||
|
|
||||||
export async function getReblogs (instanceName, accessToken, statusId, limit = 80) {
|
export async function getReblogs (instanceName, accessToken, statusId, limit = 80) {
|
||||||
let url = `${basename(instanceName)}/api/v1/statuses/${statusId}/reblogged_by`
|
let url = `${basename(instanceName)}/api/v1/statuses/${statusId}/reblogged_by`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { basename, auth } from './utils'
|
import { basename, auth } from './utils.js'
|
||||||
import { get, paramsString, DEFAULT_TIMEOUT } from '../_utils/ajax'
|
import { get, paramsString, DEFAULT_TIMEOUT } from '../_utils/ajax.js'
|
||||||
|
|
||||||
export async function getRelationship (instanceName, accessToken, accountId) {
|
export async function getRelationship (instanceName, accessToken, accountId) {
|
||||||
const url = `${basename(instanceName)}/api/v1/accounts/relationships?${paramsString({ id: accountId })}`
|
const url = `${basename(instanceName)}/api/v1/accounts/relationships?${paramsString({ id: accountId })}`
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue