Change asset path to /static-assets/akkomafe/

This commit is contained in:
fruye 2023-03-23 13:46:54 +01:00
parent 6eaeb0309d
commit 0ae85abfc3
13 changed files with 36 additions and 36 deletions

View File

@ -40,7 +40,7 @@ npm run unit
You can create file `/config/local.json` (see [example](https://git.pleroma.social/pleroma/pleroma-fe/blob/develop/config/local.example.json)) to enable some convenience dev options:
* `target`: makes local dev server redirect to some existing instance's BE instead of local BE, useful for testing things in near-production environment and searching for real-life use-cases.
* `staticConfigPreference`: makes FE's `/static/config.json` take preference of BE-served `/api/statusnet/config.json`. Only works in dev mode.
* `staticConfigPreference`: makes FE's `/static-assets/akkomafe/config.json` take preference of BE-served `/api/statusnet/config.json`. Only works in dev mode.
FE Build process also leaves current commit hash in global variable `___pleromafe_commit_hash` so that you can easily see which pleroma-fe commit instance is running, also helps pinpointing which commit was used when FE was bundled into BE.

View File

@ -21,7 +21,7 @@ module.exports = {
env: require('./prod.env'),
index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsSubDirectory: 'static-assets/akkomafe',
assetsPublicPath: '/',
productionSourceMap: true,
// Gzip off by default as many popular static hosts such as
@ -35,7 +35,7 @@ module.exports = {
env: require('./dev.env'),
port: 8080,
settings,
assetsSubDirectory: 'static',
assetsSubDirectory: 'static-assets/akkomafe',
assetsPublicPath: '/',
proxyTable: {
'/manifest.json': {
@ -67,12 +67,12 @@ module.exports = {
changeOrigin: true,
cookieDomainRewrite: 'localhost'
},
'/static/stickers.json': {
'/static-assets/akkomafe/stickers.json': {
target,
changeOrigin: true,
cookieDomainRewrite: 'localhost'
},
'/static/stickers': {
'/static-assets/akkomafe/stickers': {
target,
changeOrigin: true,
cookieDomainRewrite: 'localhost'

View File

@ -8,8 +8,8 @@
PleromaFE gets its configuration from several sources, in order of preference (the one above overrides ones below it)
1. `/api/statusnet/config.json` - this is generated on Backend and contains multiple things including instance name, char limit etc. It also contains FE/Client-specific data, PleromaFE uses `pleromafe` field of it. For more info on changing config on BE, look [here](https://docs.akkoma.dev/stable/configuration/cheatsheet.md#frontend_configurations)
2. `/static/config.json` - this is a static FE-provided file, containing only FE specific configuration. This file is completely optional and could be removed but is useful as a fallback if some configuration JSON property isn't present in BE-provided config. It's also a reference point to check what default configuration are and what JSON properties even exist. In local dev mode it could be used to override BE configuration, more about that in HACKING.md. File is located [here](https://akkoma.dev/AkkomaGang/pleroma-fe/src/branch/develop/static/config.json).
3. Built-in defaults. Those are hard-coded defaults that are used when `/static/config.json` is not available and BE-provided configuration JSON is missing some JSON properties. ( [Code](https://akkoma.dev/AkkomaGang/pleroma-fe/src/branch/develop/src/modules/instance.js) )
2. `/static-assets/akkomafe/config.json` - this is a static FE-provided file, containing only FE specific configuration. This file is completely optional and could be removed but is useful as a fallback if some configuration JSON property isn't present in BE-provided config. It's also a reference point to check what default configuration are and what JSON properties even exist. In local dev mode it could be used to override BE configuration, more about that in HACKING.md. File is located [here](https://akkoma.dev/AkkomaGang/pleroma-fe/src/branch/develop/static/config.json).
3. Built-in defaults. Those are hard-coded defaults that are used when `/static-assets/akkomafe/config.json` is not available and BE-provided configuration JSON is missing some JSON properties. ( [Code](https://akkoma.dev/AkkomaGang/pleroma-fe/src/branch/develop/src/modules/instance.js) )
## Instance-defaults

View File

@ -4,11 +4,11 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
<title>Akkoma</title>
<link rel="stylesheet" href="/static/font/tiresias.css">
<link rel="stylesheet" href="/static/font/css/lato.css">
<link rel="stylesheet" href="/static/mfm.css">
<link rel="stylesheet" href="/static/custom.css">
<link rel="stylesheet" href="/static/theme-holder.css" id="theme-holder">
<link rel="stylesheet" href="/static-assets/akkomafe/font/tiresias.css">
<link rel="stylesheet" href="/static-assets/akkomafe/font/css/lato.css">
<link rel="stylesheet" href="/static-assets/akkomafe/mfm.css">
<link rel="stylesheet" href="/static-assets/akkomafe/custom.css">
<link rel="stylesheet" href="/static-assets/akkomafe/theme-holder.css" id="theme-holder">
<!--server-generated-meta-->
<link rel="icon" type="image/png" href="/favicon.png">
<link rel="manifest" href="/manifest.json">

View File

@ -109,14 +109,14 @@ const getBackendProvidedConfig = async ({ store }) => {
const getStaticConfig = async () => {
try {
const res = await window.fetch('/static/config.json')
const res = await window.fetch('/static-assets/akkomafe/config.json')
if (res.ok) {
return res.json()
} else {
throw (res)
}
} catch (error) {
console.warn('Failed to load static/config.json, continuing without it.')
console.warn('Failed to load static-assets/akkomafe/config.json, continuing without it.')
console.warn(error)
return {}
}
@ -188,7 +188,7 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => {
const getTOS = async ({ store }) => {
try {
const res = await window.fetch('/static/terms-of-service.html')
const res = await window.fetch('/static-assets/akkomafe/terms-of-service.html')
if (res.ok) {
const html = await res.text()
store.dispatch('setInstanceOption', { name: 'tos', value: html })
@ -218,7 +218,7 @@ const getInstancePanel = async ({ store }) => {
const getStickers = async ({ store }) => {
try {
const res = await window.fetch('/static/stickers.json')
const res = await window.fetch('/static-assets/akkomafe/stickers.json')
if (res.ok) {
const values = await res.json()
const stickers = (await Promise.all(

View File

@ -47,7 +47,7 @@ export default {
const imageData = this.ctx.createImageData(this.width, this.height);
imageData.data.set(pixels);
this.ctx.putImageData(imageData, 0, 0);
fetch("/static/blurhash-overlay.png")
fetch("/static-assets/akkomafe/blurhash-overlay.png")
.then((response) => response.blob())
.then((blob) => {
const img = new Image();

View File

@ -156,7 +156,7 @@ const instance = {
},
async getStaticEmoji ({ commit }) {
try {
const res = await window.fetch('/static/emoji.json')
const res = await window.fetch('/static-assets/akkomafe/emoji.json')
if (res.ok) {
const values = await res.json()
const emoji = Object.keys(values).map((key) => {

View File

@ -11,7 +11,7 @@ const createRuffleService = () => {
window.RufflePlayer = {}
window.RufflePlayer.config = {
polyfills: false,
publicPath: '/static/ruffle'
publicPath: '/static-assets/akkomafe/ruffle'
}
// Currently it's seems like a better way of loading ruffle
@ -20,7 +20,7 @@ const createRuffleService = () => {
const script = document.createElement('script')
// see webpack config, using CopyPlugin to copy it from node_modules
// provided via ruffle-mirror
script.src = '/static/ruffle/ruffle.js'
script.src = '/static-assets/akkomafe/ruffle/ruffle.js'
script.type = 'text/javascript'
script.onerror = (e) => { reject(e) }
script.onabort = (e) => { reject(e) }

View File

@ -322,7 +322,7 @@ export const generatePreset = (input) => {
export const getThemes = () => {
const cache = 'no-store'
return window.fetch('/static/styles.json', { cache })
return window.fetch('/static-assets/akkomafe/styles.json', { cache })
.then((data) => data.json())
.then((themes) => {
return Object.entries(themes).map(([k, v]) => {

View File

@ -1,6 +1,6 @@
{
"alwaysShowSubjectInput": true,
"background": "/static/aurora_borealis.jpg",
"background": "/static-assets/akkomafe/aurora_borealis.jpg",
"collapseMessageWithSubject": false,
"greentext": false,
"hideFilteredStatuses": false,
@ -9,7 +9,7 @@
"hideSitename": false,
"hideUserStats": false,
"loginMethod": "token",
"logo": "/static/logo.svg",
"logo": "/static-assets/akkomafe/logo.svg",
"logoMargin": ".1em",
"logoMask": true,
"logoLeft": false,

View File

@ -1,18 +1,18 @@
{
"pleroma-dark": "/static/themes/pleroma-dark.json",
"pleroma-light": "/static/themes/pleroma-light.json",
"pleroma-dark": "/static-assets/akkomafe/themes/pleroma-dark.json",
"pleroma-light": "/static-assets/akkomafe/themes/pleroma-light.json",
"pleroma-amoled": [ "Pleroma Dark AMOLED", "#000000", "#111111", "#b0b0b1", "#d8a070", "#aa0000", "#0fa00f", "#0095ff", "#d59500"],
"classic-dark": [ "Classic Dark", "#161c20", "#282e32", "#b9b9b9", "#baaa9c", "#d31014", "#0fa00f", "#0095ff", "#ffa500" ],
"bird": [ "Bird", "#f8fafd", "#e6ecf0", "#14171a", "#0084b8", "#e0245e", "#17bf63", "#1b95e0", "#fab81e"],
"ir-black": [ "Ir Black", "#000000", "#242422", "#b5b3aa", "#ff6c60", "#FF6C60", "#A8FF60", "#96CBFE", "#FFFFB6" ],
"monokai": [ "Monokai", "#272822", "#383830", "#f8f8f2", "#f92672", "#F92672", "#a6e22e", "#66d9ef", "#f4bf75" ],
"redmond-xx": "/static/themes/redmond-xx.json",
"redmond-xx-se": "/static/themes/redmond-xx-se.json",
"redmond-xxi": "/static/themes/redmond-xxi.json",
"breezy-dark": "/static/themes/breezy-dark.json",
"breezy-light": "/static/themes/breezy-light.json",
"ihatebeingalive": "/static/themes/ihatebeingalive.json",
"paper": "/static/themes/paper.json",
"thekanata": "/static/themes/thekanata.json"
"redmond-xx": "/static-assets/akkomafe/themes/redmond-xx.json",
"redmond-xx-se": "/static-assets/akkomafe/themes/redmond-xx-se.json",
"redmond-xxi": "/static-assets/akkomafe/themes/redmond-xxi.json",
"breezy-dark": "/static-assets/akkomafe/themes/breezy-dark.json",
"breezy-light": "/static-assets/akkomafe/themes/breezy-light.json",
"ihatebeingalive": "/static-assets/akkomafe/themes/ihatebeingalive.json",
"paper": "/static-assets/akkomafe/themes/paper.json",
"thekanata": "/static-assets/akkomafe/themes/thekanata.json"
}

View File

@ -1,5 +1,5 @@
<h4>Terms of Service</h4>
<p>This is a placeholder, overwrite this by putting a file at <pre>$STATIC_DIR/static/terms-of-service.html</pre><p>
<p>This is a placeholder, overwrite this by putting a file at <pre>$STATIC_DIR/static-assets/akkomafe/terms-of-service.html</pre><p>
<p>See the <a href="https://docs.akkoma.dev/main/backend/configuration/static_dir/">Static Directory</a> docs for more info.</p>
<p>See the <a href="https://docs.akkoma.dev/main/backend/configuration/static_dir/">Static Directory</a> docs for more info.</p>

View File

@ -16,7 +16,7 @@ const checkColors = (output) => {
}
describe('Theme Data utility functions', () => {
const context = require.context('static/themes/', false, /\.json$/)
const context = require.context('static-assets/akkomafe/themes/', false, /\.json$/)
context.keys().forEach((key) => {
it(`Should render all colors for ${key} properly`, () => {
const { theme, source } = context(key)