1
0
Fork 0
mirror of https://github.com/Luzifer/share.git synced 2024-12-20 18:41:17 +00:00
share/frontend/app.js

1 line
735 KiB
JavaScript
Raw Normal View History

!function(e){var t={};function a(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(n,r,function(t){return e[t]}.bind(null,r));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=5)}([function(e,t,a){"use strict";a.r(t);var n=a(1),r=a.n(n);for(var i in n)"default"!==i&&function(e){a.d(t,e,function(){return n[e]})}(i);t.default=r.a},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=s(a(7)),r=s(a(194)),i=s(a(195));function s(e){return e&&e.__esModule?e:{default:e}}t.default={name:"app",computed:{strings:function(){return i.default}},data:function(){return{error:null,fileType:null,fileName:"",loading:!0,path:"",text:""}},methods:{hashChange:function(){var e=window.location.hash;e.length>0?this.path=e.substring(1):(this.error=i.default.file_not_found,this.loading=!1)}},mounted:function(){window.onhashchange=this.hashChange,this.hashChange()},watch:{fileType:function(e){var t=this;r.default[e]?this.fileType=r.default[e]:e.startsWith("text/")&&(this.loading=!0,axios.get(this.path).then(function(a){t.text=a.data,t.text.length<204800&&"text/plain"!==e&&window.setTimeout(function(){return n.default.initHighlighting()},100),t.loading=!1}).catch(function(e){return console.log(e)}))},path:function(){var e=this;if(this.path.indexOf("://")>=0)return this.error=i.default.not_permitted,void(this.loading=!1);axios.head(this.path).then(function(t){var a="application/octet-stream";t&&t.headers&&t.headers["content-type"]&&(a=t.headers["content-type"]),e.loading=!1,e.fileType=a}).catch(function(t){switch(t.response.status){case 403:e.error=i.default.not_permitted;break;case 404:e.error=i.default.file_not_found;break;default:e.error="Something went wrong (Status "+t.response.status+")"}e.loading=!1})}}}},function(e,t,a){var n=a(197);"string"==typeof n&&(n=[[e.i,n,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};a(199)(n,r);n.locals&&(e.exports=n.locals)},function(e,t,a){"use strict";var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("b-navbar",{attrs:{variant:"primary",type:"dark"}},[a("b-navbar-brand",{attrs:{href:"#"}},[a("i",{staticClass:"fas fa-share-alt-square"}),e._v(" Share")])],1),e._v(" "),a("b-container",{staticClass:"mt-4"},[a("b-row",[a("b-col",[e.loading?a("b-card",[a("b-card-text",{staticClass:"text-center"},[a("h2",[a("i",{staticClass:"fas fa-spinner fa-pulse"})]),e._v("\n "+e._s(e.strings.loading)+"\n ")])],1):[e.error?a("b-card",{attrs:{"bg-variant":"danger","text-variant":"white"}},[a("b-card-text",{staticClass:"text-center"},[a("h2",[a("i",{staticClass:"fas fa-exclamation-circle"})]),e._v("\n "+e._s(e.error)+"\n ")])],1):e.fileType.startsWith("image/")?a("b-card",[a("b-card-text",{staticClass:"text-center"},[a("a",{attrs:{href:e.path}},[a("b-img",{attrs:{src:e.path,fluid:""}})],1)])],1):e.fileType.startsWith("video/")?a("b-card",[a("b-embed",{attrs:{type:"video",src:e.path,allowfullscreen:"",controls:""}})],1):e.fileType.startsWith("audio/")?a("b-card",[a("b-card-text",{staticClass:"text-center"},[a("audio",{attrs:{src:e.path,controls:""}})])],1):e.fileType.startsWith("text/")?a("b-card",[a("pre",[a("code",[e._v(e._s(e.text))])])]):a("b-card",[a("b-card-text",{staticClass:"text-center"},[a("h2",[a("i",{staticClass:"fas fa-cloud-download-alt"})]),e._v(" "),a("b-button",{attrs:{href:e.path,variant: