Compare commits

...

7 Commits

Author SHA1 Message Date
Nolan Lawson ed9a9f6539 2.6.0 2023-01-09 07:56:22 -08:00
Arnaldo Gabriel 452b34b3b4
fix: grayscale mode support for header images (#2354) 2023-01-09 07:55:41 -08:00
Thomas Preece fd4bb4d864
feat: add option to always expand posts marked with content warnings (#2342)
Co-authored-by: Nolan Lawson <nolan@nolanlawson.com>
2023-01-08 22:54:39 -08:00
vitalyster c426b7fe31
fix: OAuth2: use correct `Content-Type` as specified in RFC (#2343)
Co-authored-by: Nolan Lawson <nolan@nolanlawson.com>
2023-01-08 22:31:00 -08:00
Noelia Ruiz Martínez c2851ce104
docs: explain how to use the buildCommand for internationalization (#2344) 2023-01-08 20:02:17 -08:00
Nolan Lawson 2578d0964d
chore: pin bundler/foreman versions (#2353) 2023-01-08 20:01:31 -08:00
Noelia Ruiz Martínez ff53fcab10
Replace builds with buildCommand in vercel.json (#2329)
Co-authored-by: Nolan Lawson <nolan@nolanlawson.com>
2022-12-31 08:56:03 -08:00
14 changed files with 62 additions and 30 deletions

View File

@ -21,15 +21,8 @@ const JSON_TEMPLATE = {
github: { github: {
silent: true silent: true
}, },
builds: [ buildCommand: 'yarn build',
{ outputDirectory: '__sapper__/export',
src: 'package.json',
use: '@now/static-build',
config: {
distDir: '__sapper__/export'
}
}
],
routes: [ routes: [
{ {
src: '^/service-worker\\.js$', src: '^/service-worker\\.js$',

View File

@ -43,8 +43,8 @@ async function setupMastodonDatabase () {
async function installMastodonDependencies () { async function installMastodonDependencies () {
const cwd = mastodonDir const cwd = mastodonDir
const installCommands = [ const installCommands = [
'gem update --system', 'gem install bundler -v 2.3.26 --no-document',
'gem install bundler foreman', 'gem install foreman -v 0.87.2 --no-document',
'bundle config set --local frozen \'true\'', 'bundle config set --local frozen \'true\'',
'bundle install', 'bundle install',
'yarn --pure-lockfile' 'yarn --pure-lockfile'

View File

@ -16,5 +16,4 @@ or
LOCALE=fr yarn dev LOCALE=fr yarn dev
There is also an experimental `LOCALE_DIRECTION` environment variable for the direction (LTR versus RTL) which is To host a localized version of Pinafore using Vercel, you can see this example: [buildCommand in vercel.json for Spanish](https://github.com/nvdaes/vercelPinafore/blob/45c70fb2088fe5f2380a729dab83e6f3ab4e6291/vercel.json#L9).
exposed to the source code while building.

View File

@ -1,7 +1,7 @@
{ {
"name": "pinafore", "name": "pinafore",
"description": "Alternative web client for Mastodon", "description": "Alternative web client for Mastodon",
"version": "2.5.1", "version": "2.6.0",
"type": "module", "type": "module",
"engines": { "engines": {
"node": "^12.20.0 || ^14.13.1 || ^16.0.0 || ^18.0.0" "node": "^12.20.0 || ^14.13.1 || ^16.0.0 || ^18.0.0"

View File

@ -55,7 +55,7 @@
*/ */
img, svg, video, img, svg, video,
input[type="checkbox"], input[type="radio"], input[type="checkbox"], input[type="radio"],
.inline-emoji, .theme-preview { .inline-emoji, .theme-preview, .account-profile {
filter: grayscale(100%); filter: grayscale(100%);
} }
</style> </style>

View File

@ -368,6 +368,7 @@ export default {
general: 'General', general: 'General',
generalSettings: 'General settings', generalSettings: 'General settings',
showSensitive: 'Show sensitive media by default', showSensitive: 'Show sensitive media by default',
showAllSpoilers: 'Expand content warnings by default',
showPlain: 'Show a plain gray color for sensitive media', showPlain: 'Show a plain gray color for sensitive media',
allSensitive: 'Treat all media as sensitive', allSensitive: 'Treat all media as sensitive',
largeMedia: 'Show large inline images and videos', largeMedia: 'Show large inline images and videos',

View File

@ -27,11 +27,13 @@ export function generateAuthLink (instanceName, clientId, redirectUri) {
export function getAccessTokenFromAuthCode (instanceName, clientId, clientSecret, code, redirectUri) { export function getAccessTokenFromAuthCode (instanceName, clientId, clientSecret, code, redirectUri) {
const url = `${basename(instanceName)}/oauth/token` const url = `${basename(instanceName)}/oauth/token`
return post(url, { // Using URLSearchParams here guarantees a content type of application/x-www-form-urlencoded
// See https://fetch.spec.whatwg.org/#bodyinit-unions
return post(url, new URLSearchParams({
client_id: clientId, client_id: clientId,
client_secret: clientSecret, client_secret: clientSecret,
redirect_uri: redirectUri, redirect_uri: redirectUri,
grant_type: 'authorization_code', grant_type: 'authorization_code',
code code
}, null, { timeout: WRITE_TIMEOUT }) }), null, { timeout: WRITE_TIMEOUT })
} }

View File

@ -260,7 +260,7 @@
notification && notification.status && notification && notification.status &&
notification.type !== 'mention' && notification.status.id === originalStatusId notification.type !== 'mention' && notification.status.id === originalStatusId
), ),
spoilerShown: ({ $spoilersShown, uuid }) => !!$spoilersShown[uuid], spoilerShown: ({ $spoilersShown, uuid, $showAllSpoilers }) => (typeof $spoilersShown[uuid] === 'undefined' ? !!$showAllSpoilers : !!$spoilersShown[uuid]),
replyShown: ({ $repliesShown, uuid }) => !!$repliesShown[uuid], replyShown: ({ $repliesShown, uuid }) => !!$repliesShown[uuid],
showCard: ({ originalStatus, isStatusInNotification, showMedia, $hideCards }) => ( showCard: ({ originalStatus, isStatusInNotification, showMedia, $hideCards }) => (
!$hideCards && !$hideCards &&

View File

@ -76,8 +76,9 @@
methods: { methods: {
toggleSpoilers (shown) { toggleSpoilers (shown) {
const { uuid } = this.get() const { uuid } = this.get()
const { spoilersShown } = this.store.get() const { spoilersShown, showAllSpoilers } = this.store.get()
spoilersShown[uuid] = typeof shown === 'undefined' ? !spoilersShown[uuid] : !!shown const currentValue = typeof spoilersShown[uuid] === 'undefined' ? !!showAllSpoilers : spoilersShown[uuid]
spoilersShown[uuid] = typeof shown === 'undefined' ? !currentValue : !!shown
this.store.set({ spoilersShown }) this.store.set({ spoilersShown })
requestAnimationFrame(() => { requestAnimationFrame(() => {
mark('clickSpoilerButton') mark('clickSpoilerButton')

View File

@ -8,6 +8,11 @@
bind:checked="$neverMarkMediaAsSensitive" on:change="onChange(event)"> bind:checked="$neverMarkMediaAsSensitive" on:change="onChange(event)">
{intl.showSensitive} {intl.showSensitive}
</label> </label>
<label class="setting-group">
<input type="checkbox" id="choice-show-all-spoilers"
bind:checked="$showAllSpoilers" on:change="onChange(event)">
{intl.showAllSpoilers}
</label>
<label class="setting-group"> <label class="setting-group">
<input type="checkbox" id="choice-use-blurhash" <input type="checkbox" id="choice-use-blurhash"
bind:checked="$ignoreBlurhash" on:change="onChange(event)"> bind:checked="$ignoreBlurhash" on:change="onChange(event)">

View File

@ -35,6 +35,7 @@ const persistedState = {
loggedInInstances: {}, loggedInInstances: {},
loggedInInstancesInOrder: [], loggedInInstancesInOrder: [],
markMediaAsSensitive: false, markMediaAsSensitive: false,
showAllSpoilers: false,
neverMarkMediaAsSensitive: false, neverMarkMediaAsSensitive: false,
ignoreBlurhash: false, ignoreBlurhash: false,
omitEmojiInDisplayNames: undefined, omitEmojiInDisplayNames: undefined,

View File

@ -51,7 +51,7 @@ async function _fetch (url, fetchOptions, options) {
async function _putOrPostOrPatch (method, url, body, headers, options) { async function _putOrPostOrPatch (method, url, body, headers, options) {
const fetchOptions = makeFetchOptions(method, headers, options) const fetchOptions = makeFetchOptions(method, headers, options)
if (body) { if (body) {
if (body instanceof FormData) { if (body instanceof FormData || body instanceof URLSearchParams) {
fetchOptions.body = body fetchOptions.body = body
} else { } else {
fetchOptions.body = JSON.stringify(body) fetchOptions.body = JSON.stringify(body)

View File

@ -0,0 +1,37 @@
import {
getUrl,
scrollToStatus,
getNthStatusSpoiler,
settingsNavButton,
generalSettingsButton,
homeNavButton,
getNthStatus,
getNthShowOrHideButton
} from '../utils'
import { loginAsFoobar } from '../roles'
import { homeTimeline } from '../fixtures.js'
import { Selector as $ } from 'testcafe'
fixture`043-content-warnings.js`
.page`http://localhost:4002`
test('Can set content warnings to auto-expand', async t => {
await loginAsFoobar(t)
await t
.expect(getUrl()).eql('http://localhost:4002/')
.click(settingsNavButton)
.click(generalSettingsButton)
.click($('#choice-show-all-spoilers'))
.click(homeNavButton)
.expect(getUrl()).eql('http://localhost:4002/')
.expect(getNthStatus(1).exists).ok()
const idx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW')
await scrollToStatus(t, idx + 1)
await t
.expect(getNthStatusSpoiler(1 + idx).innerText).contains('kitten CW')
.expect(getNthStatus(1 + idx).innerText).contains('here\'s a kitten with a CW')
.click(getNthShowOrHideButton(1 + idx))
.expect(getNthStatus(1 + idx).innerText).notContains('here\'s a kitten with a CW')
.click(getNthShowOrHideButton(1 + idx))
.expect(getNthStatus(1 + idx).innerText).contains('here\'s a kitten with a CW')
})

View File

@ -6,15 +6,8 @@
"github": { "github": {
"silent": true "silent": true
}, },
"builds": [ "buildCommand": "yarn build",
{ "outputDirectory": "__sapper__/export",
"src": "package.json",
"use": "@now/static-build",
"config": {
"distDir": "__sapper__/export"
}
}
],
"routes": [ "routes": [
{ {
"src": "^/service-worker\\.js$", "src": "^/service-worker\\.js$",