Przeglądaj źródła

Update web routes

Daniel Supernault 4 lat temu
rodzic
commit
5df6a34101

+ 12 - 8
resources/assets/js/components/Direct.vue

@@ -156,7 +156,6 @@
 								<input v-model="composeUsername" type="text" class="form-control" placeholder="dansup">
 								<input v-model="composeUsername" type="text" class="form-control" placeholder="dansup">
 							</div> -->
 							</div> -->
 							<autocomplete 
 							<autocomplete 
-							v-show="true"
 							:search="composeSearch"
 							:search="composeSearch"
 							placeholder="@dansup"
 							placeholder="@dansup"
 							aria-label="Search usernames"
 							aria-label="Search usernames"
@@ -186,7 +185,12 @@
 </style>
 </style>
 
 
 <script type="text/javascript">
 <script type="text/javascript">
+import Autocomplete from '@trevoreyre/autocomplete-vue'
+import '@trevoreyre/autocomplete-vue/dist/style.css'
 export default {
 export default {
+	components: { 
+		Autocomplete 
+	},
 	data() {
 	data() {
 		return {
 		return {
 			config: window.App.config,
 			config: window.App.config,
@@ -223,7 +227,7 @@ export default {
 	mounted() {
 	mounted() {
 		this.fetchProfile();
 		this.fetchProfile();
 		let self = this;
 		let self = this;
-		axios.get('/api/pixelfed/v1/direct/browse', {
+		axios.get('/api/direct/browse', {
 			params: {
 			params: {
 				a: 'inbox'
 				a: 'inbox'
 			}
 			}
@@ -298,7 +302,7 @@ export default {
 				break;
 				break;
 				case 'sent':
 				case 'sent':
 				if(this.messages.sent.length == 0) {
 				if(this.messages.sent.length == 0) {
-					axios.get('/api/pixelfed/v1/direct/browse', {
+					axios.get('/api/direct/browse', {
 						params: {
 						params: {
 							a: 'sent'
 							a: 'sent'
 						}
 						}
@@ -312,7 +316,7 @@ export default {
 				break;
 				break;
 				case 'filtered':
 				case 'filtered':
 					if(this.messages.filtered.length == 0) {
 					if(this.messages.filtered.length == 0) {
-						axios.get('/api/pixelfed/v1/direct/browse', {
+						axios.get('/api/direct/browse', {
 							params: {
 							params: {
 								a: 'filtered'
 								a: 'filtered'
 							}
 							}
@@ -344,7 +348,7 @@ export default {
 		getTagResultValue(result) {
 		getTagResultValue(result) {
 			return '@' + result.name;
 			return '@' + result.name;
 		},
 		},
-		
+
 		onTagSubmitLocation(result) {
 		onTagSubmitLocation(result) {
 			//this.$refs.autocomplete.value = '';
 			//this.$refs.autocomplete.value = '';
 			window.location.href = '/account/direct/t/' + result.id;
 			window.location.href = '/account/direct/t/' + result.id;
@@ -354,7 +358,7 @@ export default {
 		messagePagination(tab, dir) {
 		messagePagination(tab, dir) {
 			if(tab == 'inbox') {
 			if(tab == 'inbox') {
 				this.inboxPage = dir == 'prev' ? this.inboxPage - 1 : this.inboxPage + 1;
 				this.inboxPage = dir == 'prev' ? this.inboxPage - 1 : this.inboxPage + 1;
-				axios.get('/api/pixelfed/v1/direct/browse', {
+				axios.get('/api/direct/browse', {
 					params: {
 					params: {
 						a: 'inbox',
 						a: 'inbox',
 						page: this.inboxPage
 						page: this.inboxPage
@@ -368,7 +372,7 @@ export default {
 			}
 			}
 			if(tab == 'sent') {
 			if(tab == 'sent') {
 				this.sentPage = dir == 'prev' ? this.sentPage - 1 : this.sentPage + 1;
 				this.sentPage = dir == 'prev' ? this.sentPage - 1 : this.sentPage + 1;
-				axios.get('/api/pixelfed/v1/direct/browse', {
+				axios.get('/api/direct/browse', {
 					params: {
 					params: {
 						a: 'sent',
 						a: 'sent',
 						page: this.sentPage
 						page: this.sentPage
@@ -382,7 +386,7 @@ export default {
 			}
 			}
 			if(tab == 'filtered') {
 			if(tab == 'filtered') {
 				this.filteredPage = dir == 'prev' ? this.filteredPage - 1 : this.filteredPage + 1;
 				this.filteredPage = dir == 'prev' ? this.filteredPage - 1 : this.filteredPage + 1;
-				axios.get('/api/pixelfed/v1/direct/browse', {
+				axios.get('/api/direct/browse', {
 					params: {
 					params: {
 						a: 'filtered',
 						a: 'filtered',
 						page: this.filteredPage
 						page: this.filteredPage

+ 6 - 6
resources/assets/js/components/DirectMessage.vue

@@ -355,7 +355,7 @@
 		mounted() {
 		mounted() {
 			this.fetchProfile();
 			this.fetchProfile();
 			let self = this;
 			let self = this;
-			axios.get('/api/pixelfed/v1/direct/thread', {
+			axios.get('/api/direct/thread', {
 				params: {
 				params: {
 					pid: self.accountId
 					pid: self.accountId
 				}
 				}
@@ -383,13 +383,13 @@
 		watch: {
 		watch: {
 			mutedNotifications: function(v) {
 			mutedNotifications: function(v) {
 				if(v) {
 				if(v) {
-					axios.post('/api/pixelfed/v1/direct/mute', {
+					axios.post('/api/direct/mute', {
 						id: this.accountId
 						id: this.accountId
 					}).then(res => {
 					}).then(res => {
 
 
 					});
 					});
 				} else {
 				} else {
-					axios.post('/api/pixelfed/v1/direct/unmute', {
+					axios.post('/api/direct/unmute', {
 						id: this.accountId
 						id: this.accountId
 					}).then(res => {
 					}).then(res => {
 
 
@@ -414,7 +414,7 @@
 			sendMessage() {
 			sendMessage() {
 				let self = this;
 				let self = this;
 				let rt = this.replyText;
 				let rt = this.replyText;
-				axios.post('/api/pixelfed/v1/direct/create', {
+				axios.post('/api/direct/create', {
 					'to_id': this.threads[this.threadIndex].id,
 					'to_id': this.threads[this.threadIndex].id,
 					'message': rt,
 					'message': rt,
 					'type': self.isEmoji(rt) && rt.length < 10 ? 'emoji' : 'text'
 					'type': self.isEmoji(rt) && rt.length < 10 ? 'emoji' : 'text'
@@ -594,7 +594,7 @@
 				let self = this;
 				let self = this;
 				this.loadingMessages = true;
 				this.loadingMessages = true;
 
 
-				axios.get('/api/pixelfed/v1/direct/thread', {
+				axios.get('/api/direct/thread', {
 					params: {
 					params: {
 						pid: this.accountId,
 						pid: this.accountId,
 						max_id: this.min_id,
 						max_id: this.min_id,
@@ -630,7 +630,7 @@
 			messagePoll() {
 			messagePoll() {
 				let self = this;
 				let self = this;
 				setInterval(function() {
 				setInterval(function() {
-					axios.get('/api/pixelfed/v1/direct/thread', {
+					axios.get('/api/direct/thread', {
 						params: {
 						params: {
 							pid: self.accountId,
 							pid: self.accountId,
 							min_id: self.thread.messages[self.thread.messages.length - 1].id
 							min_id: self.thread.messages[self.thread.messages.length - 1].id

+ 14 - 0
routes/web.php

@@ -97,6 +97,18 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
         Route::get('search', 'SearchController@searchAPI');
         Route::get('search', 'SearchController@searchAPI');
         Route::get('nodeinfo/2.0.json', 'FederationController@nodeinfo');
         Route::get('nodeinfo/2.0.json', 'FederationController@nodeinfo');
 
 
+        Route::group(['prefix' => 'direct'], function () {
+            Route::get('browse', 'DirectMessageController@browse');
+            Route::post('create', 'DirectMessageController@create');
+            Route::get('thread', 'DirectMessageController@thread');
+            Route::post('mute', 'DirectMessageController@mute');
+            Route::post('unmute', 'DirectMessageController@unmute');
+            Route::delete('message', 'DirectMessageController@delete');
+            Route::post('media', 'DirectMessageController@mediaUpload');
+            Route::post('lookup', 'DirectMessageController@composeLookup');
+            Route::post('read', 'DirectMessageController@read');
+        });
+
         Route::group(['prefix' => 'v2'], function() {
         Route::group(['prefix' => 'v2'], function() {
             Route::get('config', 'ApiController@siteConfiguration');
             Route::get('config', 'ApiController@siteConfiguration');
             Route::get('discover', 'InternalApiController@discover');
             Route::get('discover', 'InternalApiController@discover');
@@ -287,6 +299,8 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
 
 
     Route::group(['prefix' => 'account'], function () {
     Route::group(['prefix' => 'account'], function () {
         Route::redirect('/', '/');
         Route::redirect('/', '/');
+        Route::get('direct', 'AccountController@direct');
+        Route::get('direct/t/{id}', 'AccountController@directMessage');
         Route::get('activity', 'AccountController@notifications')->name('notifications');
         Route::get('activity', 'AccountController@notifications')->name('notifications');
         Route::get('follow-requests', 'AccountController@followRequests')->name('follow-requests');
         Route::get('follow-requests', 'AccountController@followRequests')->name('follow-requests');
         Route::post('follow-requests', 'AccountController@followRequestHandle');
         Route::post('follow-requests', 'AccountController@followRequestHandle');