cleanup
This commit is contained in:
		
							parent
							
								
									48e4f8eea4
								
							
						
					
					
						commit
						d0f02d1ad6
					
				
					 3 changed files with 10 additions and 14 deletions
				
			
		|  | @ -38,9 +38,10 @@ Response readAuthcode(Request request) { | |||
|     String code = params["code"].toString(); | ||||
|     settings.saveAuthCode(code); | ||||
|   } | ||||
|   return Response(200, | ||||
|   return Response(308, | ||||
|       headers: {"Content-Type": "text/html; charset=UTF-8"}, | ||||
|       body: | ||||
|           "<html><head><meta http-equiv='Refresh' content='0; URL=https://example.com/'></head></html>"); | ||||
|           "<html><head><meta http-equiv='Refresh' content='0; URL=https://git.kittycat.homes/zoe/slothmu'></head></html>"); | ||||
| } | ||||
| 
 | ||||
| // returns status code | ||||
|  | @ -54,7 +55,6 @@ Future<int> handleFullOauth() async { | |||
|     await settings.saveAuthCode(""); | ||||
|     var handler = const Pipeline().addHandler(readAuthcode); | ||||
|     var server = await shelf_io.serve(handler, 'localhost', 1312); | ||||
|     server.idleTimeout = const Duration(minutes: 5); | ||||
|     await pollCode(); | ||||
|     server.close(); | ||||
|     return 200; | ||||
|  | @ -66,10 +66,9 @@ Future<int> handleFullOauth() async { | |||
| Future<String> pollCode() async { | ||||
|   String code = ""; | ||||
|   while (code == "") { | ||||
|     await Future.delayed(const Duration(seconds: 1)); | ||||
|     await Future.delayed(const Duration(seconds: 3)); | ||||
|     code = await settings.loadAuthCode(); | ||||
|   } | ||||
|   print(code); | ||||
|   return code; | ||||
| } | ||||
| 
 | ||||
|  | @ -77,7 +76,6 @@ Future<http.Response> doOauthFlow() async { | |||
|   String url = await settings.loadInstanceUrl(); | ||||
|   try { | ||||
|     http.Response response = await registerApp(url); | ||||
|     print(response.body); | ||||
|     openBrowserForAuthCode(url, App.fromJson(jsonDecode(response.body))); | ||||
|     return response; | ||||
|   } catch (e) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue