| angular.module('xos.openVPNDashboard', [ |
| .config(($stateProvider) => { |
| template: '<vpn-list></vpn-list>' |
| .config(($compileProvider) => { |
| $compileProvider.aHrefSanitizationWhitelist( |
| /^\s*(https?|ftp|mailto|tel|file|blob):/); |
| .service('Vpn', function($http, $q){ |
| this.getOpenVpnTenants = () => { |
| let deferred = $q.defer(); |
| $http.get('/api/tenant/openvpn/list/') |
| deferred.resolve(res.data) |
| .config(function($httpProvider){ |
| $httpProvider.interceptors.push('NoHyperlinks'); |
| .directive('vpnList', function(){ |
| templateUrl: 'templates/openvpn-list.tpl.html', |
| controller: function(Vpn){ |
| for (var i = 0; i < this.vpns.length; i++) { |
| var blob = new Blob([this.vpns[i].script_text], {type: 'text/plain'}); |
| this.vpns[i].script_text = (window.URL || window.webkitURL).createObjectURL( blob ); |