-
+
-
{{r}}
@@ -90,6 +93,7 @@ import LoadingSpinner from "./LoadingSpinner.vue";
import CryptoJS from "crypto-js";
import hljs from "highlight.js";
import LANGUAGE_REPLACEMENTS from '../assets/data/langReplacements'
+import eventBus from '../eventBus.js';
const LANGUAGES = hljs.listLanguages()
const AUTOCOMPLETIONS = [
@@ -119,10 +123,6 @@ export default {
clientEncrypted: false,
friendList: [],
multiPastesSelected: null,
- footer: {
- IMPRINT: process.env.VUE_APP_API_IMPRINT_URL,
- PRIVACY: process.env.VUE_APP_API_PRIVACY_URL,
- },
loginBaseURL: process.env.VUE_APP_API_BASE +"/api/v2/auth/oauth2/",
inputFullscreen: false,
r:0,
@@ -131,11 +131,17 @@ export default {
currentLanguage: ""
}),
mounted(){
+ eventBus.$on("appInfoLoaded", ()=>{
+ if (this.$store.state.appInfo.encryption_is_default){
+ this.clientEncrypted = true
+ }
+ })
this.eventBus.$on("setMultiPasteTabTo0", ()=>{
this.selectTab(0)
})
codeEditor = new CodeEditor(this.$refs.editor)
+
let lastLength = 0
codeEditorInputListener = () => {
this.$store.state.currentPaste.content = codeEditor.value
@@ -191,7 +197,6 @@ export default {
this.updateEditorLang()
},
'$store.state.currentPaste.content'(to){
- console.log("SETTING");
codeEditor.value = to
codeEditor.update()
},
@@ -265,8 +270,8 @@ export default {
data.type = 'PASTE'
if (Object.keys(this.$store.state.currentPaste.multiPastes).length > 0) {
- this.$store.state.currentPaste.multiPastes[this.multiPastesSelected].contents = this.$store.state.currentPaste.content
-
+ this.$store.state.currentPaste.multiPastes[this.multiPastesSelected].contents = codeEditor.value
+
data.content = JSON.stringify(this.$store.state.currentPaste.multiPastes)
data.type = 'MULTI_PASTE'
}
@@ -337,6 +342,7 @@ export default {
}
},
clearInputs(){
+ console.log("CLEARING");
codeEditor.value = ""
this.$store.state.app.fullscreen = false
this.inputFullscreen = false
@@ -347,6 +353,7 @@ export default {
this.$store.state.currentPaste.editId = null
this.$store.state.currentPaste.multiPastes = []
this.multiPastesSelected = null
+ codeEditor.update()
},
isPWA(){
return window.matchMedia('(display-mode: standalone)').matches;
@@ -403,9 +410,6 @@ export default {
.replace(/"/g, """)
.replace(/'/g, "'");
},
- showImprintAndPrivacy(){
- return window.location.host == "pastefy.ga" || window.location.host == "www.pastefy.ga"
- },
onContentInputScroll(e){
this.contentInputScrolled = e.target.scrollTop > 30
}
@@ -574,16 +578,23 @@ export default {
background: var(--obj-background-color);
border-radius: 10px;
padding: 10px;
+ margin-top: 10px;
+ position: relative;
span {
vertical-align: middle;
+ max-width: calc(100% - 30px);
+ overflow: hidden;
+ display: inline-block;
+ white-space: nowrap;
}
svg {
height: 27px;
width: 27px;
vertical-align: middle;
- float: right;
+ position: absolute;
+ right: 10px;
cursor: pointer;
}
}
@@ -847,6 +858,29 @@ export default {
}
}
}
+
+ #login-required-info {
+ position: absolute;
+ top: 75px;
+ left: 0px;
+ height: 355px;
+ backdrop-filter: blur(5px);
+ background: #00000011;
+ width: 100%;
+ z-index: 10000;
+ h1 {
+ text-align: center;
+ color: var(--text-color);
+ padding: 10px;
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translateX(-50%) translateY(-50%);
+ }
+ @media screen and (max-width: 720px) {
+ height: 100%;
+ }
+ }
/*.input-scrolled {
#logo {
top: -100px !important;
diff --git a/frontend/src/main.js b/frontend/src/main.js
index 910fec6..46cc456 100644
--- a/frontend/src/main.js
+++ b/frontend/src/main.js
@@ -38,18 +38,25 @@ new Vue({
}).$mount("#app")
store.state.app.loadingUser = true
-pastefyAPI.get("/api/v2/user").then(res=>{
- store.state.user = res
- store.state.app.loadingUser = false
- if (worker !== null && store.state.user.logged_in) {
- console.log("worker is now working :)");
- worker.postMessage({
- action: 'registerUserLogin',
- user: store.state.user,
- session: localStorage["session"],
- baseUrl: pastefyAPI.baseUrl
- })
- }
+
+
+pastefyAPI.get("/api/v2/app/info").then(res=>{
+ store.state.appInfo = res
+ eventBus.$emit("appInfoLoaded")
+ pastefyAPI.get("/api/v2/user").then(res=>{
+ store.state.user = res
+ store.state.app.loadingUser = false
+ eventBus.$emit("userLoaded")
+ if (worker !== null && store.state.user.logged_in) {
+ console.log("worker is now working :)");
+ worker.postMessage({
+ action: 'registerUserLogin',
+ user: store.state.user,
+ session: localStorage["session"],
+ baseUrl: pastefyAPI.baseUrl
+ })
+ }
+ })
})
if (typeof navigator !== 'undefined') {
diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js
index 145e149..e7165ec 100644
--- a/frontend/src/store/index.js
+++ b/frontend/src/store/index.js
@@ -32,6 +32,14 @@ let store = new Vuex.Store({
newPasteEditorDisableAutocompletion: localStorage.getItem('new_paste_editor_disable_autocompletion') == 'true',
lastPastes: JSON.parse(localStorage['created_pastes'] || "[]").splice(0, 15),
loadingUser: false
+ },
+ appInfo: {
+ custom_logo: null,
+ custom_name: null,
+ custom_footer: {},
+ login_required_for_read: false,
+ login_required_for_create: false,
+ encryption_is_default: false
}
},
mutations: {
diff --git a/frontend/src/views/Homepage.vue b/frontend/src/views/Homepage.vue
index 8b01f7a..2391b5a 100644
--- a/frontend/src/views/Homepage.vue
+++ b/frontend/src/views/Homepage.vue
@@ -27,7 +27,7 @@