Revert "Specify base URL at <base> element"

This reverts commit f8844cb549.
This commit is contained in:
Pig Fang 2019-11-27 23:55:25 +08:00
parent c75f4429ac
commit 84afc32d84
27 changed files with 60 additions and 67 deletions

View File

@ -367,7 +367,7 @@ class AdminController extends Controller
'type' => 'a', 'type' => 'a',
'class' => 'float-right', 'class' => 'float-right',
'style' => 'warning', 'style' => 'warning',
'href' => $request->url().'?clear-cache', 'href' => '?clear-cache',
]) ])
->addMessage(trans('options.cache.driver', ['driver' => config('cache.default')]), 'info'); ->addMessage(trans('options.cache.driver', ['driver' => config('cache.default')]), 'info');

View File

@ -98,7 +98,7 @@ export default {
} }
}, },
avatarUrl(player) { avatarUrl(player) {
return `${document.baseURI}avatar/35/${player.tid_skin}` return `${blessing.base_url}/avatar/35/${player.tid_skin}`
}, },
}, },
} }

View File

@ -23,7 +23,7 @@
<div> <div>
<img <img
class="captcha" class="captcha"
:src="`${baseUrl}auth/captcha?v=${time}`" :src="`${baseUrl}/auth/captcha?v=${time}`"
alt="CAPTCHA" alt="CAPTCHA"
:title="$t('auth.change-captcha')" :title="$t('auth.change-captcha')"
data-placement="top" data-placement="top"
@ -45,7 +45,7 @@ export default {
props: { props: {
baseUrl: { baseUrl: {
type: String, type: String,
default: document.baseURI, default: blessing.base_url,
}, },
}, },
data() { data() {

View File

@ -72,10 +72,10 @@ export default {
}, },
computed: { computed: {
previewLink() { previewLink() {
return `${document.baseURI}preview/${this.tid}.png` return `${blessing.base_url}/preview/${this.tid}.png`
}, },
linkToSkinlib() { linkToSkinlib() {
return `${document.baseURI}skinlib/show/${this.tid}` return `${blessing.base_url}/skinlib/show/${this.tid}`
}, },
}, },
methods: { methods: {

View File

@ -55,10 +55,10 @@ export default {
}, },
computed: { computed: {
urlToDetail() { urlToDetail() {
return `${document.baseURI}skinlib/show/${this.tid}` return `${blessing.base_url}/skinlib/show/${this.tid}`
}, },
urlToPreview() { urlToPreview() {
return `${document.baseURI}preview/${this.tid}.png` return `${blessing.base_url}/preview/${this.tid}.png`
}, },
likeActionText() { likeActionText() {
if (this.anonymous) { if (this.anonymous) {

View File

@ -8,11 +8,11 @@ const init: RequestInit = {
} }
export async function checkForUpdates(): Promise<void> { export async function checkForUpdates(): Promise<void> {
const response = await fetch(`${document.baseURI}admin/update/check`, init) const response = await fetch(`${blessing.base_url}/admin/update/check`, init)
if (response.ok) { if (response.ok) {
const data = await response.json() const data = await response.json()
const el = document.querySelector(`[href="${document.baseURI}admin/update"] p`) const el = document.querySelector(`[href="${blessing.base_url}/admin/update"] p`)
if (data.available && el) { if (data.available && el) {
el.innerHTML += '<span class="right badge badge-primary">New</span>' el.innerHTML += '<span class="right badge badge-primary">New</span>'
} }
@ -20,11 +20,11 @@ export async function checkForUpdates(): Promise<void> {
} }
export async function checkForPluginUpdates(): Promise<void> { export async function checkForPluginUpdates(): Promise<void> {
const response = await fetch(`${document.baseURI}admin/plugins/market/check`, init) const response = await fetch(`${blessing.base_url}/admin/plugins/market/check`, init)
if (response.ok) { if (response.ok) {
const data = await response.json() const data = await response.json()
const el = document.querySelector(`[href="${document.baseURI}admin/plugins/market"] p`) const el = document.querySelector(`[href="${blessing.base_url}/admin/plugins/market"] p`)
if (data.available && el) { if (data.available && el) {
const length = data.plugins.length as number const length = data.plugins.length as number
el.innerHTML += `<span class="right badge badge-success">${length}</span>` el.innerHTML += `<span class="right badge badge-success">${length}</span>`

View File

@ -6,12 +6,12 @@ import $ from 'jquery'
// @ts-ignore // @ts-ignore
declare let __webpack_public_path__: string declare let __webpack_public_path__: string
const url = new URL(document.baseURI) const url = new URL(blessing.base_url)
url.port = '8080' url.port = '8080'
__webpack_public_path__ = process.env.NODE_ENV === 'development' __webpack_public_path__ = process.env.NODE_ENV === 'development'
? url.toString() ? url.toString()
: `${document.baseURI}app/` : `${blessing.base_url}/app/`
// @ts-ignore // @ts-ignore
window.$ = window.jQuery = $ // eslint-disable-line window.$ = window.jQuery = $ // eslint-disable-line

View File

@ -12,7 +12,7 @@ export async function logout() {
} }
const { message } = await post('/auth/logout') const { message } = await post('/auth/logout')
setTimeout(() => (window.location.href = document.baseURI), 1000) setTimeout(() => (window.location.href = blessing.base_url), 1000)
Message.success(message) Message.success(message)
} }

View File

@ -79,9 +79,7 @@ export function get(url: string, params = empty): Promise<any> {
const qs = queryStringify(params) const qs = queryStringify(params)
return walkFetch( return walkFetch(new Request(`${blessing.base_url}${url}${qs && `?${qs}`}`, init))
new Request(`${document.baseURI.slice(0, -1)}${url}${qs && `?${qs}`}`, init),
)
} }
function nonGet(method: string, url: string, data: any): Promise<any> { function nonGet(method: string, url: string, data: any): Promise<any> {
@ -93,7 +91,7 @@ function nonGet(method: string, url: string, data: any): Promise<any> {
const isFormData = data instanceof FormData const isFormData = data instanceof FormData
const request = new Request(`${document.baseURI.slice(0, -1)}${url}`, { const request = new Request(`${blessing.base_url}${url}`, {
body: isFormData ? data : JSON.stringify(data), body: isFormData ? data : JSON.stringify(data),
method: method.toUpperCase(), method: method.toUpperCase(),
...init, ...init,

View File

@ -22,7 +22,7 @@
</span> </span>
<span v-else-if="props.column.field === 'uid'"> <span v-else-if="props.column.field === 'uid'">
<a <a
:href="`${baseUrl}admin/users?uid=${props.row.uid}`" :href="`${baseUrl}/admin/users?uid=${props.row.uid}`"
:title="$t('admin.inspectHisOwner')" :title="$t('admin.inspectHisOwner')"
data-toggle="tooltip" data-toggle="tooltip"
data-placement="right" data-placement="right"
@ -34,15 +34,15 @@
<span v-else-if="props.column.field === 'preview'"> <span v-else-if="props.column.field === 'preview'">
<a <a
v-if="props.row.tid_skin" v-if="props.row.tid_skin"
:href="`${baseUrl}skinlib/show/${props.row.tid_skin}`" :href="`${baseUrl}/skinlib/show/${props.row.tid_skin}`"
> >
<img :src="`${baseUrl}preview/64/${props.row.tid_skin}.png`" width="64"> <img :src="`${baseUrl}/preview/64/${props.row.tid_skin}.png`" width="64">
</a> </a>
<a <a
v-if="props.row.tid_cape" v-if="props.row.tid_cape"
:href="`${baseUrl}skinlib/show/${props.row.tid_cape}`" :href="`${baseUrl}/skinlib/show/${props.row.tid_cape}`"
> >
<img :src="`${baseUrl}preview/64/${props.row.tid_cape}.png`" width="64"> <img :src="`${baseUrl}/preview/64/${props.row.tid_cape}.png`" width="64">
</a> </a>
</span> </span>
<span v-else-if="props.column.field === 'operations'"> <span v-else-if="props.column.field === 'operations'">
@ -133,7 +133,7 @@ export default {
props: { props: {
baseUrl: { baseUrl: {
type: String, type: String,
default: document.baseURI, default: blessing.base_url,
}, },
}, },
data() { data() {

View File

@ -16,7 +16,7 @@
<a <a
v-t="'admin.configurePlugin'" v-t="'admin.configurePlugin'"
class="text-primary" class="text-primary"
:href="`${baseUrl}admin/plugins/config/${props.row.name}`" :href="`${baseUrl}/admin/plugins/config/${props.row.name}`"
/> | /> |
</template> </template>
<a <a
@ -94,7 +94,7 @@ export default {
props: { props: {
baseUrl: { baseUrl: {
type: String, type: String,
default: document.baseURI, default: blessing.base_url,
}, },
}, },
data() { data() {

View File

@ -16,7 +16,7 @@
<template #table-row="props"> <template #table-row="props">
<span v-if="props.column.field === 'tid'"> <span v-if="props.column.field === 'tid'">
{{ props.formattedRow[props.column.field] }} {{ props.formattedRow[props.column.field] }}
<a :href="`${baseUrl}skinlib/show/${props.row.tid}`">{{ $t('report.check') }}</a> <a :href="`${baseUrl}/skinlib/show/${props.row.tid}`">{{ $t('report.check') }}</a>
<a href="#" @click="deleteTexture(props.row)"> <a href="#" @click="deleteTexture(props.row)">
{{ $t('report.delete') }} {{ $t('report.delete') }}
</a> </a>
@ -66,7 +66,7 @@ export default {
props: { props: {
baseUrl: { baseUrl: {
type: String, type: String,
default: document.baseURI, default: blessing.base_url,
}, },
}, },
data() { data() {

View File

@ -77,7 +77,7 @@ export default {
return return
} }
await this.$alert(this.$t('admin.updateCompleted'), { type: 'success' }) await this.$alert(this.$t('admin.updateCompleted'), { type: 'success' })
window.location = document.baseURI window.location = blessing.base_url
}, },
async polling() { async polling() {
const percentage = await this.$http.get( const percentage = await this.$http.get(

View File

@ -113,7 +113,7 @@ export default {
} }
}, },
playersLink(user) { playersLink(user) {
return `${document.baseURI}admin/players?uid=${user.uid}` return `${blessing.base_url}/admin/players?uid=${user.uid}`
}, },
}, },
mixins: [ mixins: [

View File

@ -27,7 +27,7 @@
</div> </div>
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<a v-t="'auth.forgot.login-link'" :href="`${baseUrl}auth/login`" class="text-center" /> <a v-t="'auth.forgot.login-link'" :href="`${baseUrl}/auth/login`" class="text-center" />
<button <button
class="btn btn-primary" class="btn btn-primary"
type="submit" type="submit"
@ -57,7 +57,7 @@ export default {
props: { props: {
baseUrl: { baseUrl: {
type: String, type: String,
default: document.baseURI, default: blessing.base_url,
}, },
}, },
data: () => ({ data: () => ({

View File

@ -42,7 +42,7 @@
{{ $t('auth.keep') }} {{ $t('auth.keep') }}
</label> </label>
</div> </div>
<a v-t="'auth.forgot-link'" :href="`${baseUrl}auth/forgot`" /> <a v-t="'auth.forgot-link'" :href="`${baseUrl}/auth/forgot`" />
</div> </div>
<button <button
@ -73,7 +73,7 @@ export default {
props: { props: {
baseUrl: { baseUrl: {
type: String, type: String,
default: document.baseURI, default: blessing.base_url,
}, },
}, },
data() { data() {

View File

@ -101,7 +101,7 @@
</div> </div>
<div class="d-flex justify-content-between mb-3"> <div class="d-flex justify-content-between mb-3">
<a v-t="'auth.login-link'" :href="`${baseUrl}auth/login`" class="text-center" /> <a v-t="'auth.login-link'" :href="`${baseUrl}/auth/login`" class="text-center" />
<div> <div>
<button <button
class="btn btn-primary" class="btn btn-primary"
@ -133,7 +133,7 @@ export default {
props: { props: {
baseUrl: { baseUrl: {
type: String, type: String,
default: document.baseURI, default: blessing.base_url,
}, },
}, },
data: () => ({ data: () => ({
@ -171,7 +171,7 @@ export default {
if (code === 0) { if (code === 0) {
this.$message.success(message) this.$message.success(message)
setTimeout(() => { setTimeout(() => {
window.location = `${document.baseURI}user` window.location = `${blessing.base_url}/user`
}, 1000) }, 1000)
} else { } else {
this.infoMsg = '' this.infoMsg = ''

View File

@ -91,7 +91,7 @@ export default {
) )
if (code === 0) { if (code === 0) {
this.$message.success(message) this.$message.success(message)
window.location = `${document.baseURI}auth/login` window.location = `${blessing.base_url}/auth/login`
} else { } else {
this.infoMsg = '' this.infoMsg = ''
this.warningMsg = message this.warningMsg = message

View File

@ -121,7 +121,7 @@
<td v-t="'skinlib.show.uploader'" /> <td v-t="'skinlib.show.uploader'" />
<td v-if="uploaderNickName !== null"> <td v-if="uploaderNickName !== null">
<a <a
:href="`${baseUrl}skinlib?filter=${type === 'cape' ? 'cape' : 'skin'}&uploader=${uploader}`" :href="`${baseUrl}/skinlib?filter=${type === 'cape' ? 'cape' : 'skin'}&uploader=${uploader}`"
>{{ uploaderNickName }}</a> >{{ uploaderNickName }}</a>
</td> </td>
<td v-else><span v-t="'general.unexistent-user'" /></td> <td v-else><span v-t="'general.unexistent-user'" /></td>
@ -187,7 +187,7 @@ export default {
props: { props: {
baseUrl: { baseUrl: {
type: String, type: String,
default: document.baseURI, default: blessing.base_url,
}, },
}, },
data() { data() {
@ -220,7 +220,7 @@ export default {
return this.public ? 'skinlib.setAsPrivate' : 'skinlib.setAsPublic' return this.public ? 'skinlib.setAsPrivate' : 'skinlib.setAsPublic'
}, },
textureUrl() { textureUrl() {
return `${this.baseUrl}textures/${this.hash}` return `${this.baseUrl}/textures/${this.hash}`
}, },
}, },
beforeMount() { beforeMount() {
@ -248,7 +248,7 @@ export default {
}, },
download() { download() {
const a = document.createElement('a') const a = document.createElement('a')
a.href = `${this.baseUrl}raw/${this.tid}.png` a.href = `${this.baseUrl}/raw/${this.tid}.png`
a.download = `${this.name}.png` a.download = `${this.name}.png`
const event = new MouseEvent('click') const event = new MouseEvent('click')
a.dispatchEvent(event) a.dispatchEvent(event)
@ -345,7 +345,7 @@ export default {
) )
if (code === 0) { if (code === 0) {
this.$message.success(message) this.$message.success(message)
setTimeout(() => (window.location = `${this.baseUrl}skinlib`), 1000) setTimeout(() => (window.location = `${this.baseUrl}/skinlib`), 1000)
} else { } else {
this.$message.warning(message) this.$message.warning(message)
} }

View File

@ -189,7 +189,7 @@ export default {
if (code === 0) { if (code === 0) {
this.$message.success(message) this.$message.success(message)
setTimeout(() => { setTimeout(() => {
window.location = `${document.baseURI}skinlib/show/${tid}` window.location = `${blessing.base_url}/skinlib/show/${tid}`
}, 1000) }, 1000)
} else { } else {
this.$message.error(message) this.$message.error(message)

View File

@ -65,7 +65,7 @@ export default {
this.pending = false this.pending = false
if (code === 0) { if (code === 0) {
await this.$alert(message) await this.$alert(message)
window.location.href = `${document.baseURI}user` window.location.href = `${blessing.base_url}/user`
} else { } else {
this.message = message this.message = message
} }

View File

@ -32,7 +32,7 @@
<li class="nav-item d-none d-md-block"> <li class="nav-item d-none d-md-block">
<a <a
v-t="'user.closet.upload'" v-t="'user.closet.upload'"
:href="`${baseUrl}skinlib/upload`" :href="`${baseUrl}/skinlib/upload`"
class="nav-link" class="nav-link"
/> />
</li> </li>
@ -195,7 +195,7 @@ export default {
props: { props: {
baseUrl: { baseUrl: {
type: String, type: String,
default: document.baseURI, default: blessing.base_url,
}, },
}, },
data: () => ({ data: () => ({
@ -212,8 +212,8 @@ export default {
model: 'steve', model: 'steve',
selectedCape: 0, selectedCape: 0,
capeUrl: '', capeUrl: '',
linkToSkin: `${document.baseURI}skinlib?filter=skin`, linkToSkin: `${blessing.base_url}/skinlib?filter=skin`,
linkToCape: `${document.baseURI}skinlib?filter=cape`, linkToCape: `${blessing.base_url}/skinlib?filter=cape`,
}), }),
created() { created() {
this.search = debounce(this.loadCloset, 350) this.search = debounce(this.loadCloset, 350)

View File

@ -82,10 +82,10 @@
<div id="preview-2d"> <div id="preview-2d">
<p> <p>
{{ $t('general.skin') }} {{ $t('general.skin') }}
<a v-if="preview2d.skin" :href="`${baseUrl}skinlib/show/${preview2d.skin}`"> <a v-if="preview2d.skin" :href="`${baseUrl}/skinlib/show/${preview2d.skin}`">
<img <img
class="skin2d" class="skin2d"
:src="`${baseUrl}preview/64/${preview2d.skin}.png`" :src="`${baseUrl}/preview/64/${preview2d.skin}.png`"
> >
</a> </a>
<span v-else v-t="'user.player.texture-empty'" class="skin2d" /> <span v-else v-t="'user.player.texture-empty'" class="skin2d" />
@ -93,10 +93,10 @@
<p> <p>
{{ $t('general.cape') }} {{ $t('general.cape') }}
<a v-if="preview2d.cape" :href="`${baseUrl}skinlib/show/${preview2d.cape}`"> <a v-if="preview2d.cape" :href="`${baseUrl}/skinlib/show/${preview2d.cape}`">
<img <img
class="skin2d" class="skin2d"
:src="`${baseUrl}preview/64/${preview2d.cape}.png`" :src="`${baseUrl}/preview/64/${preview2d.cape}.png`"
> >
</a> </a>
<span v-else v-t="'user.player.texture-empty'" class="skin2d" /> <span v-else v-t="'user.player.texture-empty'" class="skin2d" />
@ -172,7 +172,7 @@ export default {
props: { props: {
baseUrl: { baseUrl: {
type: String, type: String,
default: document.baseURI, default: blessing.base_url,
}, },
}, },
data() { data() {
@ -214,7 +214,7 @@ export default {
if (player.tid_skin) { if (player.tid_skin) {
const { data: skin } = await this.$http.get(`/skinlib/info/${player.tid_skin}`) const { data: skin } = await this.$http.get(`/skinlib/info/${player.tid_skin}`)
this.skinUrl = `${this.baseUrl}textures/${skin.hash}` this.skinUrl = `${this.baseUrl}/textures/${skin.hash}`
this.model = skin.type this.model = skin.type
} else { } else {
this.skinUrl = '' this.skinUrl = ''
@ -222,7 +222,7 @@ export default {
} }
if (player.tid_cape) { if (player.tid_cape) {
const { data: cape } = await this.$http.get(`/skinlib/info/${player.tid_cape}`) const { data: cape } = await this.$http.get(`/skinlib/info/${player.tid_cape}`)
this.capeUrl = `${this.baseUrl}textures/${cape.hash}` this.capeUrl = `${this.baseUrl}/textures/${cape.hash}`
} else { } else {
this.capeUrl = '' this.capeUrl = ''
} }

View File

@ -265,7 +265,7 @@ export default {
) )
if (code === 0) { if (code === 0) {
await this.$alert(message) await this.$alert(message)
return (window.location = `${document.baseURI}auth/login`) return (window.location = `${blessing.base_url}/auth/login`)
} }
return this.$alert(message, { type: 'warning' }) return this.$alert(message, { type: 'warning' })
}, },
@ -304,7 +304,7 @@ export default {
) )
if (code === 0) { if (code === 0) {
await this.$message.success(message) await this.$message.success(message)
return (window.location = `${document.baseURI}auth/login`) return (window.location = `${blessing.base_url}/auth/login`)
} }
return this.$alert(message, { type: 'warning' }) return this.$alert(message, { type: 'warning' })
}, },
@ -317,7 +317,7 @@ export default {
) )
if (code === 0) { if (code === 0) {
await this.$alert(message, { type: 'success' }) await this.$alert(message, { type: 'success' })
window.location = `${document.baseURI}auth/login` window.location = `${blessing.base_url}/auth/login`
} else { } else {
return this.$alert(message, { type: 'warning' }) return this.$alert(message, { type: 'warning' })
} }

View File

@ -10,7 +10,7 @@
<template #table-row="props"> <template #table-row="props">
<span v-if="props.column.field === 'tid'"> <span v-if="props.column.field === 'tid'">
{{ props.formattedRow[props.column.field] }} {{ props.formattedRow[props.column.field] }}
<a :href="`${baseUrl}skinlib/show/${props.row.tid}`"> <a :href="`${baseUrl}/skinlib/show/${props.row.tid}`">
<i class="fa fa-share" /> <i class="fa fa-share" />
</a> </a>
</span> </span>
@ -43,7 +43,7 @@ export default {
props: { props: {
baseUrl: { baseUrl: {
type: String, type: String,
default: document.baseURI, default: blessing.base_url,
}, },
}, },
data() { data() {

View File

@ -8,10 +8,6 @@ import {
Switch, Switch,
} from 'element-ui' } from 'element-ui'
Object.defineProperty(document, 'baseURI', {
get: () => '/',
})
window.blessing = { window.blessing = {
base_url: '', base_url: '',
site_name: 'Blessing Skin', site_name: 'Blessing Skin',

View File

@ -1,4 +1,3 @@
<base href="{{ url('/') }}">
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">