@@ -27,9 +27,6 @@ export default {
|
|||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0', // default: localhost
|
host: '0.0.0.0', // default: localhost
|
||||||
},
|
},
|
||||||
serverMiddleware: [
|
|
||||||
'~/proxy/index.js'
|
|
||||||
],
|
|
||||||
head: {
|
head: {
|
||||||
title: `${meta.name} \u2022 ${meta.shortDescription}`,
|
title: `${meta.name} \u2022 ${meta.shortDescription}`,
|
||||||
meta: [
|
meta: [
|
||||||
|
|||||||
@@ -976,7 +976,7 @@ export default {
|
|||||||
const config = this.$store.state.postwoman.settings.PROXY_ENABLED
|
const config = this.$store.state.postwoman.settings.PROXY_ENABLED
|
||||||
? {
|
? {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: `${window.location.protocol}//${window.location.host}/proxy`,
|
url: `https://postwoman.apollotv.xyz/`,
|
||||||
data: requestOptions
|
data: requestOptions
|
||||||
}
|
}
|
||||||
: requestOptions;
|
: requestOptions;
|
||||||
|
|||||||
@@ -48,6 +48,9 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</pw-section>
|
</pw-section>
|
||||||
<pw-section class="blue" icon="public" label="Proxy">
|
<pw-section class="blue" icon="public" label="Proxy">
|
||||||
|
<ul class="info">
|
||||||
|
<li><p>Postwoman's Proxy is hosted by ApolloTV.<br>You can read the ApolloTV privacy policy by clicking <a href="https://apollotv.xyz/legal" target="_blank">here</a/>.</p></li>
|
||||||
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<pw-toggle
|
<pw-toggle
|
||||||
@@ -75,6 +78,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.info {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import section from "../components/section";
|
import section from "../components/section";
|
||||||
import swatch from "../components/settings/swatch";
|
import swatch from "../components/settings/swatch";
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
import express from 'express';
|
|
||||||
import bodyParser from 'body-parser';
|
|
||||||
import axios from 'axios';
|
|
||||||
|
|
||||||
const app = express();
|
|
||||||
|
|
||||||
app.use(bodyParser.json());
|
|
||||||
|
|
||||||
app.use((req, res, next) => {
|
|
||||||
res.header('Access-Control-Allow-Origin', '*');
|
|
||||||
res.header('Access-Control-Allow-Headers', '*');
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
app.post('/', async (req, res) => {
|
|
||||||
const {
|
|
||||||
method,
|
|
||||||
url,
|
|
||||||
auth,
|
|
||||||
headers,
|
|
||||||
data
|
|
||||||
} = req.body;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const payload = await axios({
|
|
||||||
method,
|
|
||||||
url,
|
|
||||||
auth,
|
|
||||||
headers,
|
|
||||||
data
|
|
||||||
});
|
|
||||||
|
|
||||||
return await res.json({
|
|
||||||
data: payload.data,
|
|
||||||
status: payload.status,
|
|
||||||
statusText: payload.statusText,
|
|
||||||
headers: payload.headers,
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
if (error.response) {
|
|
||||||
const errorResponse = error.response;
|
|
||||||
return await res.json({
|
|
||||||
data: errorResponse.data,
|
|
||||||
status: errorResponse.status,
|
|
||||||
statusText: errorResponse.statusText,
|
|
||||||
headers: errorResponse.headers,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return res.status(500).send();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default {
|
|
||||||
path: '/proxy',
|
|
||||||
handler: app
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user