commit
af97a6ac5a
650 changed files with 5956 additions and 9223 deletions
@ -0,0 +1,114 @@ |
|||||||
|
{ |
||||||
|
$schema: 'https://docs.renovatebot.com/renovate-schema.json', |
||||||
|
extends: [ |
||||||
|
'config:base', |
||||||
|
':dependencyDashboard', |
||||||
|
':labels(dependencies)', |
||||||
|
':maintainLockFilesMonthly', // update non-direct dependencies monthly |
||||||
|
':prConcurrentLimit10', // only 10 open PRs at the same time |
||||||
|
], |
||||||
|
stabilityDays: 3, // Wait 3 days after the package has been published before upgrading it |
||||||
|
// packageRules order is important, they are applied from top to bottom and are merged, |
||||||
|
// so for example grouping rules needs to be at the bottom |
||||||
|
packageRules: [ |
||||||
|
{ |
||||||
|
// Ignore major version bumps for these node packages |
||||||
|
matchManagers: ['npm'], |
||||||
|
matchPackageNames: [ |
||||||
|
'@rails/ujs', // Needs to match the major Rails version |
||||||
|
'tesseract.js', // Requires code changes |
||||||
|
'react-hotkeys', // Requires code changes |
||||||
|
|
||||||
|
// Requires Webpacker upgrade or replacement |
||||||
|
'@types/webpack', |
||||||
|
'babel-loader', |
||||||
|
'compression-webpack-plugin', |
||||||
|
'css-loader', |
||||||
|
'imports-loader', |
||||||
|
'mini-css-extract-plugin', |
||||||
|
'postcss-loader', |
||||||
|
'sass-loader', |
||||||
|
'terser-webpack-plugin', |
||||||
|
'webpack', |
||||||
|
'webpack-assets-manifest', |
||||||
|
'webpack-bundle-analyzer', |
||||||
|
'webpack-dev-server', |
||||||
|
'webpack-cli', |
||||||
|
|
||||||
|
// react-router: Requires manual upgrade |
||||||
|
'history', |
||||||
|
'react-router-dom', |
||||||
|
], |
||||||
|
matchUpdateTypes: ['major'], |
||||||
|
enabled: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
// Ignore major version bumps for these Ruby packages |
||||||
|
matchManagers: ['bundler'], |
||||||
|
matchPackageNames: [ |
||||||
|
'sprockets', // Requires manual upgrade https://github.com/rails/sprockets/blob/master/UPGRADING.md#guide-to-upgrading-from-sprockets-3x-to-4x |
||||||
|
'strong_migrations', // Requires manual upgrade |
||||||
|
'sidekiq', // Requires manual upgrade |
||||||
|
'sidekiq-unique-jobs', // Requires manual upgrades and sync with Sidekiq version |
||||||
|
'redis', // Requires manual upgrade and sync with Sidekiq version |
||||||
|
'fog-openstack', // TODO: was ignored in https://github.com/mastodon/mastodon/pull/13964 |
||||||
|
|
||||||
|
// Needs major Rails version bump |
||||||
|
'rack', |
||||||
|
'rails', |
||||||
|
'rails-i18n', |
||||||
|
], |
||||||
|
matchUpdateTypes: ['major'], |
||||||
|
enabled: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
// Update Github Actions and Docker images weekly |
||||||
|
matchManagers: ['github-actions', 'dockerfile', 'docker-compose'], |
||||||
|
extends: ['schedule:weekly'], |
||||||
|
}, |
||||||
|
{ |
||||||
|
// Ignore major & minor bumps for the ruby image, this needs to be synced with .ruby-version |
||||||
|
matchManagers: ['dockerfile'], |
||||||
|
matchPackageNames: ['moritzheiber/ruby-jemalloc'], |
||||||
|
matchUpdateTypes: ['minor', 'major'], |
||||||
|
enabled: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
// Ignore major bump for the node image, this needs to be synced with .nvmrc |
||||||
|
matchManagers: ['dockerfile'], |
||||||
|
matchPackageNames: ['node'], |
||||||
|
matchUpdateTypes: ['major'], |
||||||
|
enabled: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
// Ignore major postgres bumps in the docker-compose file, as those break dev environments |
||||||
|
matchManagers: ['docker-compose'], |
||||||
|
matchPackageNames: ['postgres'], |
||||||
|
matchUpdateTypes: ['major'], |
||||||
|
enabled: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
// Update devDependencies every week, with one grouped PR |
||||||
|
matchDepTypes: 'devDependencies', |
||||||
|
matchUpdateTypes: ['patch', 'minor'], |
||||||
|
excludePackageNames: [ |
||||||
|
'typescript', // Typescript has many changes in minor versions, needs to be checked every time |
||||||
|
], |
||||||
|
groupName: 'devDependencies (non-major)', |
||||||
|
extends: ['schedule:weekly'], |
||||||
|
}, |
||||||
|
{ |
||||||
|
// Update @types/* packages every week, with one grouped PR |
||||||
|
matchPackagePrefixes: '@types/', |
||||||
|
matchUpdateTypes: ['patch', 'minor'], |
||||||
|
groupName: 'DefinitelyTyped types (non-major)', |
||||||
|
extends: ['schedule:weekly'], |
||||||
|
addLabels: ['typescript'], |
||||||
|
}, |
||||||
|
// Add labels depending on package manager |
||||||
|
{ matchManagers: ['npm', 'nvm'], addLabels: ['javascript'] }, |
||||||
|
{ matchManagers: ['bundler', 'ruby-version'], addLabels: ['ruby'] }, |
||||||
|
{ matchManagers: ['docker-compose', 'dockerfile'], addLabels: ['docker'] }, |
||||||
|
{ matchManagers: ['github-actions'], addLabels: ['github_actions'] }, |
||||||
|
], |
||||||
|
} |
@ -0,0 +1,91 @@ |
|||||||
|
import PropTypes from 'prop-types'; |
||||||
|
import { PureComponent } from 'react'; |
||||||
|
|
||||||
|
import { FormattedNumber, FormattedMessage } from 'react-intl'; |
||||||
|
|
||||||
|
import classNames from 'classnames'; |
||||||
|
|
||||||
|
import api from 'flavours/glitch/api'; |
||||||
|
import { Skeleton } from 'flavours/glitch/components/skeleton'; |
||||||
|
|
||||||
|
export default class ImpactReport extends PureComponent { |
||||||
|
|
||||||
|
static propTypes = { |
||||||
|
domain: PropTypes.string.isRequired, |
||||||
|
}; |
||||||
|
|
||||||
|
state = { |
||||||
|
loading: true, |
||||||
|
data: null, |
||||||
|
}; |
||||||
|
|
||||||
|
componentDidMount () { |
||||||
|
const { domain } = this.props; |
||||||
|
|
||||||
|
const params = { |
||||||
|
domain: domain, |
||||||
|
include_subdomains: true, |
||||||
|
}; |
||||||
|
|
||||||
|
api().post('/api/v1/admin/measures', { |
||||||
|
keys: ['instance_accounts', 'instance_follows', 'instance_followers'], |
||||||
|
start_at: null, |
||||||
|
end_at: null, |
||||||
|
instance_accounts: params, |
||||||
|
instance_follows: params, |
||||||
|
instance_followers: params, |
||||||
|
}).then(res => { |
||||||
|
this.setState({ |
||||||
|
loading: false, |
||||||
|
data: res.data, |
||||||
|
}); |
||||||
|
}).catch(err => { |
||||||
|
console.error(err); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
render () { |
||||||
|
const { loading, data } = this.state; |
||||||
|
|
||||||
|
return ( |
||||||
|
<div className='dimension'> |
||||||
|
<h4><FormattedMessage id='admin.impact_report.title' defaultMessage='Impact summary' /></h4> |
||||||
|
|
||||||
|
<table> |
||||||
|
<tbody> |
||||||
|
<tr className='dimension__item'> |
||||||
|
<td className='dimension__item__key'> |
||||||
|
<FormattedMessage id='admin.impact_report.instance_accounts' defaultMessage='Accounts profiles this would delete' /> |
||||||
|
</td> |
||||||
|
|
||||||
|
<td className='dimension__item__value'> |
||||||
|
{loading ? <Skeleton width={60} /> : <FormattedNumber value={data[0].total} />} |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
|
||||||
|
<tr className={classNames('dimension__item', { negative: !loading && data[1].total > 0 })}> |
||||||
|
<td className='dimension__item__key'> |
||||||
|
<FormattedMessage id='admin.impact_report.instance_follows' defaultMessage='Followers their users would lose' /> |
||||||
|
</td> |
||||||
|
|
||||||
|
<td className='dimension__item__value'> |
||||||
|
{loading ? <Skeleton width={60} /> : <FormattedNumber value={data[1].total} />} |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
|
||||||
|
<tr className={classNames('dimension__item', { negative: !loading && data[2].total > 0 })}> |
||||||
|
<td className='dimension__item__key'> |
||||||
|
<FormattedMessage id='admin.impact_report.instance_followers' defaultMessage='Followers our users would lose' /> |
||||||
|
</td> |
||||||
|
|
||||||
|
<td className='dimension__item__value'> |
||||||
|
{loading ? <Skeleton width={60} /> : <FormattedNumber value={data[2].total} />} |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,28 +0,0 @@ |
|||||||
import PropTypes from 'prop-types'; |
|
||||||
import { PureComponent } from 'react'; |
|
||||||
|
|
||||||
import { FormattedMessage } from 'react-intl'; |
|
||||||
|
|
||||||
export default class LoadMore extends PureComponent { |
|
||||||
|
|
||||||
static propTypes = { |
|
||||||
onClick: PropTypes.func, |
|
||||||
disabled: PropTypes.bool, |
|
||||||
visible: PropTypes.bool, |
|
||||||
}; |
|
||||||
|
|
||||||
static defaultProps = { |
|
||||||
visible: true, |
|
||||||
}; |
|
||||||
|
|
||||||
render() { |
|
||||||
const { disabled, visible } = this.props; |
|
||||||
|
|
||||||
return ( |
|
||||||
<button className='load-more' disabled={disabled || !visible} style={{ visibility: visible ? 'visible' : 'hidden' }} onClick={this.props.onClick}> |
|
||||||
<FormattedMessage id='status.load_more' defaultMessage='Load more' /> |
|
||||||
</button> |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,24 @@ |
|||||||
|
import { FormattedMessage } from 'react-intl'; |
||||||
|
|
||||||
|
interface Props { |
||||||
|
onClick: (event: React.MouseEvent) => void; |
||||||
|
disabled?: boolean; |
||||||
|
visible?: boolean; |
||||||
|
} |
||||||
|
export const LoadMore: React.FC<Props> = ({ |
||||||
|
onClick, |
||||||
|
disabled, |
||||||
|
visible = true, |
||||||
|
}) => { |
||||||
|
return ( |
||||||
|
<button |
||||||
|
type='button' |
||||||
|
className='load-more' |
||||||
|
disabled={disabled || !visible} |
||||||
|
style={{ visibility: visible ? 'visible' : 'hidden' }} |
||||||
|
onClick={onClick} |
||||||
|
> |
||||||
|
<FormattedMessage id='status.load_more' defaultMessage='Load more' /> |
||||||
|
</button> |
||||||
|
); |
||||||
|
}; |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@ |
|||||||
|
export interface LocaleData { |
||||||
|
locale: string; |
||||||
|
messages: Record<string, string>; |
||||||
|
} |
||||||
|
|
||||||
|
let loadedLocale: LocaleData; |
||||||
|
|
||||||
|
export function setLocale(locale: LocaleData) { |
||||||
|
loadedLocale = locale; |
||||||
|
} |
||||||
|
|
||||||
|
export function getLocale() { |
||||||
|
if (!loadedLocale && process.env.NODE_ENV === 'development') { |
||||||
|
throw new Error('getLocale() called before any locale has been set'); |
||||||
|
} |
||||||
|
|
||||||
|
return loadedLocale; |
||||||
|
} |
||||||
|
|
||||||
|
export function isLocaleLoaded() { |
||||||
|
return !!loadedLocale; |
||||||
|
} |
@ -0,0 +1,5 @@ |
|||||||
|
export type { LocaleData } from './global_locale'; |
||||||
|
export { setLocale, getLocale, isLocaleLoaded } from './global_locale'; |
||||||
|
export { loadLocale } from './load_locale'; |
||||||
|
|
||||||
|
export { IntlProvider } from './intl_provider'; |
@ -0,0 +1,57 @@ |
|||||||
|
import { useEffect, useState } from 'react'; |
||||||
|
|
||||||
|
import { IntlProvider as BaseIntlProvider } from 'react-intl'; |
||||||
|
|
||||||
|
import { getLocale, isLocaleLoaded } from './global_locale'; |
||||||
|
import { loadLocale } from './load_locale'; |
||||||
|
|
||||||
|
function onProviderError(error: unknown) { |
||||||
|
// Silent the error, like upstream does
|
||||||
|
if (process.env.NODE_ENV === 'production') return; |
||||||
|
|
||||||
|
// This browser does not advertise Intl support for this locale, we only print a warning
|
||||||
|
// As-per the spec, the browser should select the best matching locale
|
||||||
|
if ( |
||||||
|
error && |
||||||
|
typeof error === 'object' && |
||||||
|
error instanceof Error && |
||||||
|
error.message.match('MISSING_DATA') |
||||||
|
) { |
||||||
|
console.warn(error.message); |
||||||
|
} |
||||||
|
|
||||||
|
console.error(error); |
||||||
|
} |
||||||
|
|
||||||
|
export const IntlProvider: React.FC< |
||||||
|
Omit<React.ComponentProps<typeof BaseIntlProvider>, 'locale' | 'messages'> |
||||||
|
> = ({ children, ...props }) => { |
||||||
|
const [localeLoaded, setLocaleLoaded] = useState(false); |
||||||
|
|
||||||
|
useEffect(() => { |
||||||
|
async function loadLocaleData() { |
||||||
|
if (!isLocaleLoaded()) { |
||||||
|
await loadLocale(); |
||||||
|
} |
||||||
|
|
||||||
|
setLocaleLoaded(true); |
||||||
|
} |
||||||
|
void loadLocaleData(); |
||||||
|
}, []); |
||||||
|
|
||||||
|
if (!localeLoaded) return null; |
||||||
|
|
||||||
|
const { locale, messages } = getLocale(); |
||||||
|
|
||||||
|
return ( |
||||||
|
<BaseIntlProvider |
||||||
|
locale={locale} |
||||||
|
messages={messages} |
||||||
|
onError={onProviderError} |
||||||
|
textComponent='span' |
||||||
|
{...props} |
||||||
|
> |
||||||
|
{children} |
||||||
|
</BaseIntlProvider> |
||||||
|
); |
||||||
|
}; |
@ -0,0 +1,37 @@ |
|||||||
|
import { Semaphore } from 'async-mutex'; |
||||||
|
|
||||||
|
import type { LocaleData } from './global_locale'; |
||||||
|
import { isLocaleLoaded, setLocale } from './global_locale'; |
||||||
|
|
||||||
|
const localeLoadingSemaphore = new Semaphore(1); |
||||||
|
|
||||||
|
export async function loadLocale() { |
||||||
|
const locale = document.querySelector<HTMLElement>('html')?.lang || 'en'; |
||||||
|
|
||||||
|
// We use a Semaphore here so only one thing can try to load the locales at
|
||||||
|
// the same time. If one tries to do it while its in progress, it will wait
|
||||||
|
// for the initial load to finish before it is resumed (and will see that locale
|
||||||
|
// data is already loaded)
|
||||||
|
await localeLoadingSemaphore.runExclusive(async () => { |
||||||
|
// if the locale is already set, then do nothing
|
||||||
|
if (isLocaleLoaded()) return; |
||||||
|
|
||||||
|
const upstreamLocaleData = await import( |
||||||
|
/* webpackMode: "lazy" */ |
||||||
|
/* webpackChunkName: "locales/vanilla/[request]" */ |
||||||
|
/* webpackInclude: /\.json$/ */ |
||||||
|
/* webpackPreload: true */ |
||||||
|
`mastodon/locales/${locale}.json` |
||||||
|
) as LocaleData['messages']; |
||||||
|
|
||||||
|
const localeData = await import( |
||||||
|
/* webpackMode: "lazy" */ |
||||||
|
/* webpackChunkName: "locales/glitch/[request]" */ |
||||||
|
/* webpackInclude: /\.json$/ */ |
||||||
|
/* webpackPreload: true */ |
||||||
|
`flavours/glitch/locales/${locale}.json` |
||||||
|
) as LocaleData['messages']; |
||||||
|
|
||||||
|
setLocale({ messages: { ...upstreamLocaleData, ...localeData }, locale }); |
||||||
|
}); |
||||||
|
} |
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
@ -1,2 +0,0 @@ |
|||||||
[ |
|
||||||
] |
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue