2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								<:Head>
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-08 22:38:33 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
										
									
								 | 
							
							
								  <title>Pinafore – Add an Instance</title>
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								</:Head>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								<Layout page='settings'>
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 12:12:17 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  <SettingsLayout page='settings/instances/add' label="Add an Instance">
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-18 23:37:43 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    <h1 id="add-an-instance-h1">Add an Instance</h1>
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 11:11:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    {{#if $isUserLoggedIn}}
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 12:12:17 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    <p>Connect to an instance to log in.</p>
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 11:11:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    {{else}}
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 12:12:17 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    <p>Log in to an instance to start using Pinafore.</p>
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 11:11:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    {{/if}}
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-18 23:37:43 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    <form class="add-new-instance" on:submit='onSubmit(event)' aria-labelledby="add-an-instance-h1">
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-21 01:19:28 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-18 14:31:28 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      {{#if $logInToInstanceError && $logInToInstanceErrorForText === $instanceNameInSearch}}
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-21 01:19:28 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      <div class="form-error" role="alert">
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-27 13:38:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        Error: {{$logInToInstanceError}}
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-21 01:19:28 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      </div>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      {{/if}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-27 13:17:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      <label for="instanceInput">Instance:</label>
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-06 21:20:33 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      <input class="new-instance-input" type="text" id="instanceInput"
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-27 13:17:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								             bind:value='$instanceNameInSearch' placeholder='' required
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      >
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-14 18:17:17 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      <button class="primary" type="submit" id="submitButton"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								              disabled="{{!$instanceNameInSearch || $logInToInstanceLoading}}">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        Add instance
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      </button>
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 12:12:17 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    </form>
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 11:11:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    {{#if !$isUserLoggedIn}}
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-28 19:01:51 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    <p>Don't have an instance? <ExternalLink href="https://joinmastodon.org">Join Mastodon!</ExternalLink></p>
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 11:11:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    {{/if}}
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-08 17:44:29 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  </SettingsLayout>
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								</Layout>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								<style>
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-21 01:19:28 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  .form-error {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    border: 2px solid red;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    border-radius: 2px;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    padding: 10px;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    font-size: 1.3em;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    margin: 5px;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    background-color: var(--main-bg);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-20 12:35:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  input.new-instance-input {
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-15 21:58:31 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    min-width: 50%;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    max-width: 100%;
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 11:11:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  form.add-new-instance {
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-12 09:01:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    background: var(--form-bg);
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    padding: 5px 10px 15px;
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-12 09:01:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    margin: 20px auto;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    border: 1px solid var(--form-border);
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-14 12:00:22 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    border-radius: 4px;
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 11:11:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  form.add-new-instance label, form.add-new-instance input, form.add-new-instance button {
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    display: block;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    margin: 20px 5px;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-20 15:37:40 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  @media (max-width: 767px) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    input.new-instance-input {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      max-width: 80%;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								</style>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								<script>
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 12:12:17 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  import Layout from '../../_components/Layout.html';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  import SettingsLayout from '../_components/SettingsLayout.html'
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-28 13:09:39 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  import { store } from '../../_store/store'
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-08 17:51:48 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  import { logInToInstance, handleOauthCode } from '../../_actions/addInstance'
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-28 19:01:51 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  import ExternalLink from '../../_components/ExternalLink.html'
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 19:23:05 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  export default {
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-21 01:19:28 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    async oncreate () {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      let params = new URLSearchParams(location.search)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      if (params.has('code')) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-27 13:38:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        handleOauthCode(params.get('code'))
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 22:00:16 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    },
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    components: {
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-08 17:44:29 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      Layout,
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-14 11:22:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      SettingsLayout,
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-28 19:01:51 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      ExternalLink
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    },
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-08 10:13:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    store: () => store,
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    methods: {
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-27 13:38:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      onSubmit(event) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-13 18:59:49 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        event.preventDefault()
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-27 13:38:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        logInToInstance()
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-14 11:22:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-07 16:00:42 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								</script>
							 |