feed.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <script>
  2. const api = require('./api')
  3. export default {
  4. props: {
  5. id: String
  6. },
  7. data() {
  8. return {
  9. confirming: false,
  10. loaded: false,
  11. error: null,
  12. justConfirmed: false,
  13. model: {
  14. url: null,
  15. name: null,
  16. confirmKey: null,
  17. confirmed: false
  18. }
  19. }
  20. },
  21. async beforeMount() {
  22. try {
  23. this.model = await api.get(`feeds/${this.$route.params.id}`)
  24. this.loaded = true
  25. } catch (err) {
  26. this.error = err
  27. }
  28. },
  29. methods: {
  30. async confirm() {
  31. try {
  32. this.confirming = true
  33. const result = await api.get(`feeds/${this.$route.params.id}/confirm`)
  34. if (result.error) this.confirmError = result.error
  35. else if (result.success) {
  36. this.model.confirmed = true
  37. this.justConfirmed = true
  38. }
  39. } catch (err) {
  40. this.error = error
  41. } finally {
  42. this.confirming = false
  43. }
  44. }
  45. }
  46. }
  47. </script>
  48. <template>
  49. <div>
  50. <v-alert :value="true" v-if="error" type="error" dismissible>{{error}}</v-alert>
  51. <div v-if="loaded">
  52. <h1>{{model.title || 'RSS Feed'}}</h1>
  53. <v-text-field v-model="model.url" label="URL to rss feed" />
  54. <v-card v-if="!model.confirmed">
  55. <v-card-title primary-title>
  56. <h2>Confirm feed ownership</h2>
  57. </v-card-title>
  58. <v-card-text>
  59. <p>
  60. Before we start archiving and serving your RSS feed, we need to verify it is yours.
  61. Please temporarily copy this text anywhere in your RSS feed, and click "Confirm". Once we have verified the
  62. RSS feed is yours, you can remove the text.
  63. </p>
  64. <p class="confirm-key">{{model.confirmKey}}</p>
  65. </v-card-text>
  66. <v-card-actions>
  67. <v-btn color="success" :disabled="confirming" @click="confirm">
  68. Confirm
  69. </v-btn>
  70. </v-card-actions>
  71. </v-card>
  72. <v-alert v-model="justConfirmed" type="success" dismissible>
  73. We have verified this is your feed. You may now remove the text.
  74. </v-alert>
  75. </div>
  76. </div>
  77. </template>
  78. <style scoped>
  79. .confirm-key {
  80. user-select: all;
  81. font-family: monospace;
  82. font-size: 14pt;
  83. text-align: center;
  84. }
  85. </style>