Support multiple Mastodon instances (#26)
The application handles multiple instances, and gets that information from configuration, making it much easier to bring in additional NA-affiliated instances in the future Fixes #22
This commit was merged in pull request #26.
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "jobs-jobs-jobs",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint",
|
||||
"apiserve": "vue-cli-service build && cd ../Api && dotnet run -c Debug"
|
||||
"apiserve": "vue-cli-service build && cd ../Api && dotnet run -c Debug",
|
||||
"publish": "vue-cli-service build --modern && cd ../Api && dotnet publish -c Release -r linux-x64 --self-contained false"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdi/js": "^5.9.55",
|
||||
|
||||
@@ -40,13 +40,13 @@ export function yesOrNo (cond : boolean) : string {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the display name for a citizen (the first available among real, display, or NAS handle)
|
||||
* Get the display name for a citizen (the first available among real, display, or Mastodon handle)
|
||||
*
|
||||
* @param cit The citizen
|
||||
* @returns The citizen's display name
|
||||
*/
|
||||
export function citizenName (cit : Citizen) : string {
|
||||
return cit.realName ?? cit.displayName ?? cit.naUser
|
||||
return cit.realName ?? cit.displayName ?? cit.mastodonUser
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
Citizen,
|
||||
Continent,
|
||||
Count,
|
||||
Instance,
|
||||
Listing,
|
||||
ListingExpireForm,
|
||||
ListingForm,
|
||||
@@ -25,7 +26,7 @@ import {
|
||||
* @param url The partial URL for the API
|
||||
* @returns A full URL for the API
|
||||
*/
|
||||
const apiUrl = (url : string) : string => `http://localhost:5000/api/${url}`
|
||||
const apiUrl = (url : string) : string => `/api/${url}`
|
||||
|
||||
/**
|
||||
* Create request init parameters
|
||||
@@ -100,11 +101,12 @@ export default {
|
||||
/**
|
||||
* Log a citizen on
|
||||
*
|
||||
* @param code The authorization code from No Agenda Social
|
||||
* @param abbr The abbreviation of the Mastodon instance that issued the code
|
||||
* @param code The authorization code from Mastodon
|
||||
* @returns The user result, or an error
|
||||
*/
|
||||
logOn: async (code : string) : Promise<LogOnSuccess | string> => {
|
||||
const resp = await fetch(apiUrl(`citizen/log-on/${code}`), { method: "GET", mode: "cors" })
|
||||
logOn: async (abbr : string, code : string) : Promise<LogOnSuccess | string> => {
|
||||
const resp = await fetch(apiUrl(`citizen/log-on/${abbr}/${code}`), { method: "GET", mode: "cors" })
|
||||
if (resp.status === 200) return await resp.json() as LogOnSuccess
|
||||
return `Error logging on - ${await resp.text()}`
|
||||
},
|
||||
@@ -141,6 +143,18 @@ export default {
|
||||
apiResult<Continent[]>(await fetch(apiUrl("continents"), { method: "GET" }), "retrieving continents")
|
||||
},
|
||||
|
||||
/** API functions for instances */
|
||||
instances: {
|
||||
|
||||
/**
|
||||
* Get all Mastodon instances we support
|
||||
*
|
||||
* @returns All instances, or an error
|
||||
*/
|
||||
all: async () : Promise<Instance[] | string | undefined> =>
|
||||
apiResult<Instance[]>(await fetch(apiUrl("instances"), { method: "GET" }), "retrieving Mastodon instances")
|
||||
},
|
||||
|
||||
/** API functions for job listings */
|
||||
listings: {
|
||||
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
export interface Citizen {
|
||||
/** The ID of the user */
|
||||
id : string
|
||||
/** The abbreviation of the instance where this citizen is based */
|
||||
instance : string
|
||||
/** The handle by which the user is known on Mastodon */
|
||||
naUser : string
|
||||
mastodonUser : string
|
||||
/** The user's display name from Mastodon (updated every login) */
|
||||
displayName : string | undefined
|
||||
/** The user's real name */
|
||||
@@ -31,6 +33,18 @@ export interface Count {
|
||||
count : number
|
||||
}
|
||||
|
||||
/** The Mastodon instance data provided via the Jobs, Jobs, Jobs API */
|
||||
export interface Instance {
|
||||
/** The name of the instance */
|
||||
name : string
|
||||
/** The URL for this instance */
|
||||
url : string
|
||||
/** The abbreviation used in the URL to distinguish this instance's return codes */
|
||||
abbr : string
|
||||
/** The client ID (assigned by the Mastodon server) */
|
||||
clientId : string
|
||||
}
|
||||
|
||||
/** A job listing */
|
||||
export interface Listing {
|
||||
/** The ID of the job listing */
|
||||
|
||||
@@ -10,7 +10,7 @@ import store from "@/store"
|
||||
import Home from "@/views/Home.vue"
|
||||
import LogOn from "@/views/citizen/LogOn.vue"
|
||||
|
||||
/** The URL to which the user should be pointed once they have authorized with NAS */
|
||||
/** The URL to which the user should be pointed once they have authorized with Mastodon */
|
||||
export const AFTER_LOG_ON_URL = "jjj-after-log-on-url"
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,7 @@ const routes: Array<RouteRecordRaw> = [
|
||||
component: LogOn
|
||||
},
|
||||
{
|
||||
path: "/citizen/authorized",
|
||||
path: "/citizen/:abbr/authorized",
|
||||
name: "CitizenAuthorized",
|
||||
component: () => import(/* webpackChunkName: "dashboard" */ "../views/citizen/Authorized.vue")
|
||||
},
|
||||
@@ -121,7 +121,7 @@ const routes: Array<RouteRecordRaw> = [
|
||||
component: () => import(/* webpackChunkName: "so-long" */ "../views/so-long/DeletionOptions.vue")
|
||||
},
|
||||
{
|
||||
path: "/so-long/success",
|
||||
path: "/so-long/success/:abbr",
|
||||
name: "DeletionSuccess",
|
||||
component: () => import(/* webpackChunkName: "so-long" */ "../views/so-long/DeletionSuccess.vue")
|
||||
},
|
||||
|
||||
8
src/JobsJobsJobs/App/src/store/actions.ts
Normal file
8
src/JobsJobsJobs/App/src/store/actions.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/** Logs a user on to Jobs, Jobs, Jobs */
|
||||
export const LogOn = "logOn"
|
||||
|
||||
/** Ensures that the continent list in the state has been populated */
|
||||
export const EnsureContinents = "ensureContinents"
|
||||
|
||||
/** Ensures that the Mastodon instance list in the state has been populated */
|
||||
export const EnsureInstances = "ensureInstances"
|
||||
@@ -1,6 +1,8 @@
|
||||
import { InjectionKey } from "vue"
|
||||
import { createStore, Store, useStore as baseUseStore } from "vuex"
|
||||
import api, { Continent, LogOnSuccess } from "../api"
|
||||
import api, { Continent, Instance, LogOnSuccess } from "../api"
|
||||
import * as Actions from "./actions"
|
||||
import * as Mutations from "./mutations"
|
||||
|
||||
/** The state tracked by the application */
|
||||
export interface State {
|
||||
@@ -10,6 +12,8 @@ export interface State {
|
||||
logOnState: string
|
||||
/** All continents (use `ensureContinents` action) */
|
||||
continents: Continent[]
|
||||
/** All instances (use `ensureInstances` action) */
|
||||
instances: Instance[]
|
||||
}
|
||||
|
||||
/** An injection key to identify this state with Vue */
|
||||
@@ -24,43 +28,51 @@ export default createStore({
|
||||
state: () : State => {
|
||||
return {
|
||||
user: undefined,
|
||||
logOnState: "<em>Welcome back! Verifying your No Agenda Social account…</em>",
|
||||
continents: []
|
||||
logOnState: "<em>Welcome back!</em>",
|
||||
continents: [],
|
||||
instances: []
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
setUser (state, user : LogOnSuccess) {
|
||||
state.user = user
|
||||
},
|
||||
clearUser (state) {
|
||||
state.user = undefined
|
||||
},
|
||||
setLogOnState (state, message : string) {
|
||||
state.logOnState = message
|
||||
},
|
||||
setContinents (state, continents : Continent[]) {
|
||||
state.continents = continents
|
||||
}
|
||||
[Mutations.SetUser]: (state, user : LogOnSuccess) => { state.user = user },
|
||||
[Mutations.ClearUser]: (state) => { state.user = undefined },
|
||||
[Mutations.SetLogOnState]: (state, message : string) => { state.logOnState = message },
|
||||
[Mutations.SetContinents]: (state, continents : Continent[]) => { state.continents = continents },
|
||||
[Mutations.SetInstances]: (state, instances : Instance[]) => { state.instances = instances }
|
||||
},
|
||||
actions: {
|
||||
async logOn ({ commit }, code: string) {
|
||||
const logOnResult = await api.citizen.logOn(code)
|
||||
[Actions.LogOn]: async ({ commit }, { abbr, code }) => {
|
||||
const logOnResult = await api.citizen.logOn(abbr, code)
|
||||
if (typeof logOnResult === "string") {
|
||||
commit("setLogOnState", logOnResult)
|
||||
commit(Mutations.SetLogOnState, logOnResult)
|
||||
} else {
|
||||
commit("setUser", logOnResult)
|
||||
commit(Mutations.SetUser, logOnResult)
|
||||
}
|
||||
},
|
||||
async ensureContinents ({ state, commit }) {
|
||||
[Actions.EnsureContinents]: async ({ state, commit }) => {
|
||||
if (state.continents.length > 0) return
|
||||
const theSeven = await api.continent.all()
|
||||
if (typeof theSeven === "string") {
|
||||
console.error(theSeven)
|
||||
} else {
|
||||
commit("setContinents", theSeven)
|
||||
commit(Mutations.SetContinents, theSeven)
|
||||
}
|
||||
},
|
||||
[Actions.EnsureInstances]: async ({ state, commit }) => {
|
||||
if (state.instances.length > 0) return
|
||||
const instResp = await api.instances.all()
|
||||
if (typeof instResp === "string") {
|
||||
console.error(instResp)
|
||||
} else if (typeof instResp === "undefined") {
|
||||
console.error("No instances were found; this should not happen")
|
||||
} else {
|
||||
commit(Mutations.SetInstances, instResp)
|
||||
}
|
||||
}
|
||||
},
|
||||
modules: {
|
||||
}
|
||||
})
|
||||
|
||||
export * as Actions from "./actions"
|
||||
export * as Mutations from "./mutations"
|
||||
|
||||
14
src/JobsJobsJobs/App/src/store/mutations.ts
Normal file
14
src/JobsJobsJobs/App/src/store/mutations.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/** Set the logged-on user */
|
||||
export const SetUser = "setUser"
|
||||
|
||||
/** Clear the logged-on user */
|
||||
export const ClearUser = "clearUser"
|
||||
|
||||
/** Set the status of the current log on action */
|
||||
export const SetLogOnState = "setLogOnState"
|
||||
|
||||
/** Set the list of continents */
|
||||
export const SetContinents = "setContinents"
|
||||
|
||||
/** Set the list of Mastodon instances */
|
||||
export const SetInstances = "setInstances"
|
||||
@@ -21,8 +21,8 @@ article
|
||||
p.
|
||||
Clicking the #[span.link View] link on a listing brings up the full view page for a listing. This page displays all
|
||||
of the information from the search results, along with the citizen who posted it, and the full details of the job.
|
||||
The citizen’s name is a link to their profile page at No Agenda Social; you can use that to get their handle,
|
||||
and use NAS’s communication facilites to inquire about the position.
|
||||
The citizen’s name is a link to their profile page at their Mastodon instance; you can use that to get their
|
||||
handle, and use Mastodon’s communication facilites to inquire about the position.
|
||||
p: em.text-muted.
|
||||
(If you know of a way to construct a link to Mastodon that would start a direct message, please reach out;
|
||||
I’ve searched and searched, and asked NAS, but have not yet determined how to do that.)
|
||||
@@ -43,9 +43,9 @@ article
|
||||
The #[span.link My Job Listings] page will show you all of your active job listings just below the
|
||||
#[span.button Add a Job Listing] button. Within this table, you can edit the listing, view it, or expire it (more on
|
||||
that below). The #[span.link View] link will show you the job listing just as other users will see it. You can share
|
||||
the link from your browser over on No Agenda Social, and those who click on it will be able to view it. (Existing
|
||||
users of Jobs, Jobs, Jobs will go right to it; others will need to authorize this site’s access, but then they
|
||||
will get there as well.)
|
||||
the link from your browser on any No Agenda-affiliated Mastodon instance, and those who click on it will be able to
|
||||
view it. (Existing users of Jobs, Jobs, Jobs will go right to it; others will need to authorize this site’s
|
||||
access, but then they will get there as well.)
|
||||
|
||||
h5 Expire a Job Listing
|
||||
p.
|
||||
@@ -68,7 +68,7 @@ article
|
||||
The #[span.link Employment Profiles] link at the side allows you to search for profiles by continent, the
|
||||
citizen’s desire for remote work, a skill, or any text in their professional biography and experience. If you
|
||||
find someone with whom you’d like to discuss potential opportunities, the name at the top of the profile links
|
||||
to their No Agenda Social account, where you can use its features to get in touch.
|
||||
to their Mastodon profile, where you can use its features to get in touch.
|
||||
|
||||
hr
|
||||
|
||||
@@ -76,8 +76,8 @@ article
|
||||
p.
|
||||
The employment profile is your résumé, visible to other citizens here. It also allows you to specify
|
||||
your real name, if you so desire; if that is filled in, that is how you will be identified in search results,
|
||||
profile views, etc. If not, you will be identified as you are on No Agenda Social; this system updates your current
|
||||
display name each time you log on.
|
||||
profile views, etc. If not, you will be identified as you are on your Mastodon instance; this system updates your
|
||||
current display name each time you log on.
|
||||
|
||||
h5 Completing Your Profile
|
||||
p.
|
||||
@@ -99,19 +99,19 @@ article
|
||||
li.
|
||||
If you check the #[span.link Allow my profile to be searched publicly] checkbox #[strong and] you are seeking
|
||||
employment, your continent, region, and skills fields will be searchable and displayed to public users of the
|
||||
site. They will not be tied to your No Agenda Social handle or real name; they are there to let people peek
|
||||
behind the curtain a bit, and hopefully inspire them to join us.
|
||||
site. They will not be tied to your Mastodon handle or real name; they are there to let people peek behind the
|
||||
curtain a bit, and hopefully inspire them to join us.
|
||||
|
||||
h5 Viewing and Sharing Your Profile
|
||||
p.
|
||||
Once your profile has been established, the #[span.link My Employment Profile] page will have a button at the bottom
|
||||
that will let you view your profile the way all other validated users will be able to see it. (There will also be a
|
||||
link to this page from the #[span.link Dashboard].) The URL of this page can be shared on No Agenda Social, if you
|
||||
would like to share it there. Just as with job listings, existing users will go straight there, while other No
|
||||
Agenda Social users will get there once they authorize this application.
|
||||
link to this page from the #[span.link Dashboard].) The URL of this page can be shared on any No Agenda-affiliated
|
||||
Mastodon instance, if you would like to share it there. Just as with job listings, existing users will go straight
|
||||
there, while others will get there once they authorize this application.
|
||||
p.
|
||||
The name on employment profiles is a link to that user’s profile on No Agenda Social; from there, others can
|
||||
communicate further with you using the tools Mastodon provides.
|
||||
The name on employment profiles is a link to that user’s profile on their Mastodon instance; from there,
|
||||
others can communicate further with you using the tools Mastodon provides.
|
||||
|
||||
h5 “I Found a Job!”
|
||||
p.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
article
|
||||
page-title(title="Privacy Policy")
|
||||
h3 Privacy Policy
|
||||
p: em (as of February 6#[sup th], 2021)
|
||||
p: em (as of September 6#[sup th], 2021)
|
||||
|
||||
p.
|
||||
{{name}} (“we,” “our,” or “us”) is committed to protecting your privacy. This
|
||||
@@ -58,7 +58,7 @@ article
|
||||
li Name / Username
|
||||
li Coarse Geographic Location
|
||||
li Employment History
|
||||
li No Agenda Social Account Name / Profile
|
||||
li Mastodon Account Name / Profile
|
||||
|
||||
h4 How Do We Use The Information We Collect?
|
||||
p Any of the information we collect from you may be used in one of the following ways:
|
||||
@@ -75,9 +75,9 @@ article
|
||||
p {{name}} will collect End User Data necessary to provide the {{name}} services to our customers.
|
||||
p.
|
||||
End users may voluntarily provide us with information they have made available on social media websites
|
||||
(specifically No Agenda Social). If you provide us with any such information, we may collect publicly available
|
||||
information from the social media websites you have indicated. You can control how much of your information social
|
||||
media websites make public by visiting these websites and changing your privacy settings.
|
||||
(specifically No Agenda-affiliated Mastodon instances). If you provide us with any such information, we may collect
|
||||
publicly available information from the social media websites you have indicated. You can control how much of your
|
||||
information social media websites make public by visiting these websites and changing your privacy settings.
|
||||
|
||||
h4 When does {{name}} use customer information from third parties?
|
||||
p We do not utilize third party information apart from the end-user data described above.
|
||||
@@ -223,10 +223,10 @@ article
|
||||
|
||||
h4 Tracking Technologies
|
||||
p.
|
||||
{{name}} does not use any tracking technologies. When an authorization code is received from No Agenda Social, that
|
||||
token is stored in the browser’s memory, and the Service uses tokens on each request for data. If the page is
|
||||
refreshed or the browser window/tab is closed, this token disappears, and a new one must be generated before the
|
||||
application can be used again.
|
||||
{{name}} does not use any tracking technologies. When an authorization code is received from Mastodon, that token is
|
||||
stored in the browser’s memory, and the Service uses tokens on each request for data. If the page is refreshed
|
||||
or the browser window/tab is closed, this token disappears, and a new one must be generated before the application
|
||||
can be used again.
|
||||
|
||||
h4 Information about General Data Protection Regulation (GDPR)
|
||||
p.
|
||||
@@ -335,6 +335,12 @@ article
|
||||
h4 Contact Us
|
||||
p Don’t hesitate to contact us if you have any questions.
|
||||
ul: li Via this Link: #[router-link(to="/how-it-works") https://noagendacareers.com/how-it-works]
|
||||
|
||||
hr
|
||||
|
||||
p: em.
|
||||
Change on September 6#[sup th], 2021 – replaced “No Agenda Social” with generic terms for any
|
||||
authorized Mastodon instance.
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
article
|
||||
page-title(title="Terms of Service")
|
||||
h3 Terms of Service
|
||||
p: em (as of February 6#[sup th], 2021)
|
||||
p: em (as of September 6#[sup th], 2021)
|
||||
|
||||
h4 Acceptance of Terms
|
||||
p.
|
||||
@@ -11,12 +11,19 @@ article
|
||||
acceptance of these terms.
|
||||
|
||||
h4 Description of Service and Registration
|
||||
p.
|
||||
Jobs, Jobs, Jobs is a service that allows individuals to enter and amend employment profiles, restricting access
|
||||
to the details of these profiles to other users of
|
||||
#[a(href="https://noagendasocial.com" target="_blank") No Agenda Social]. Registration is accomplished by allowing
|
||||
Jobs, Jobs, Jobs to read one’s No Agenda Social profile. See our
|
||||
#[router-link(to="/privacy-policy") privacy policy] for details on the personal (user) information we maintain.
|
||||
p
|
||||
| Jobs, Jobs, Jobs is a service that allows individuals to enter and amend employment profiles, restricting access
|
||||
| to the details of these profiles to other users of No Agenda-afilliated Mastodon sites (currently
|
||||
= " "
|
||||
template(v-for="(it, idx) in instances" :key="idx")
|
||||
a(:href="it.url" target="_blank") {{it.name}}
|
||||
template(v-if="idx + 2 < instances.length")= ", "
|
||||
template(v-else-if="idx + 1 < instances.length")= ", and "
|
||||
| ). Registration is accomplished by allowing Jobs, Jobs, Jobs to read one’s Mastodon profile. See our
|
||||
= " "
|
||||
router-link(to="/privacy-policy") privacy policy
|
||||
= " "
|
||||
| for details on the personal (user) information we maintain.
|
||||
|
||||
h4 Liability
|
||||
p.
|
||||
@@ -34,4 +41,23 @@ article
|
||||
p.
|
||||
You may also wish to review our #[router-link(to="/privacy-policy") privacy policy] to learn how we handle your
|
||||
data.
|
||||
|
||||
hr
|
||||
|
||||
p: em.
|
||||
Change on September 6#[sup th], 2021 – replaced “No Agenda Social” with a list of all No
|
||||
Agenda-affiliated Mastodon instances.
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted } from "vue"
|
||||
import { useStore, Actions } from "@/store"
|
||||
|
||||
const store = useStore()
|
||||
|
||||
/** All instances authorized to view Jobs, Jobs, Jobs */
|
||||
const instances = computed(() => store.state.instances)
|
||||
|
||||
onMounted(async () => { await store.dispatch(Actions.EnsureInstances) })
|
||||
|
||||
</script>
|
||||
|
||||
@@ -7,30 +7,43 @@ article
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted } from "vue"
|
||||
import { useRouter } from "vue-router"
|
||||
import { useStore } from "@/store"
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { useStore, Actions, Mutations } from "@/store"
|
||||
import { AFTER_LOG_ON_URL } from "@/router"
|
||||
|
||||
const router = useRouter()
|
||||
const store = useStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
/** The abbreviation of the instance from which we received the code */
|
||||
const abbr = route.params.abbr as string
|
||||
|
||||
/** Set the message for this component */
|
||||
const setMessage = (msg : string) => store.commit(Mutations.SetLogOnState, msg)
|
||||
|
||||
/** Pass the code to the API and exchange it for a user and a JWT */
|
||||
const logOn = async () => {
|
||||
const code = router.currentRoute.value.query.code
|
||||
if (code) {
|
||||
await store.dispatch("logOn", code)
|
||||
if (store.state.user !== undefined) {
|
||||
const afterLogOnUrl = window.localStorage.getItem(AFTER_LOG_ON_URL)
|
||||
if (afterLogOnUrl) {
|
||||
window.localStorage.removeItem(AFTER_LOG_ON_URL)
|
||||
router.push(afterLogOnUrl)
|
||||
} else {
|
||||
router.push("/citizen/dashboard")
|
||||
}
|
||||
}
|
||||
await store.dispatch(Actions.EnsureInstances)
|
||||
const instance = store.state.instances.find(it => it.abbr === abbr)
|
||||
if (typeof instance === "undefined") {
|
||||
setMessage(`Mastodon instance ${abbr} not found`)
|
||||
} else {
|
||||
store.commit("setLogOnState",
|
||||
"Did not receive a token from No Agenda Social (perhaps you clicked “Cancel”?)")
|
||||
setMessage(`<em>Welcome back! Verifying your ${instance.name} account…</em>`)
|
||||
const code = route.query.code
|
||||
if (code) {
|
||||
await store.dispatch(Actions.LogOn, { abbr, code })
|
||||
if (store.state.user !== undefined) {
|
||||
const afterLogOnUrl = window.localStorage.getItem(AFTER_LOG_ON_URL)
|
||||
if (afterLogOnUrl) {
|
||||
window.localStorage.removeItem(AFTER_LOG_ON_URL)
|
||||
router.push(afterLogOnUrl)
|
||||
} else {
|
||||
router.push("/citizen/dashboard")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setMessage(`Did not receive a token from ${instance.name} (perhaps you clicked “Cancel”?)`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ article.container
|
||||
.col: .card.h-100
|
||||
h5.card-header Your Profile
|
||||
.card-body
|
||||
h6.card-subtitle.mb-3.text-muted.fst-italic Last updated #[full-date-time(:date="profile.lastUpdatedOn")]
|
||||
h6.card-subtitle.mb-3.text-muted.fst-italic(v-if="profile").
|
||||
Last updated #[full-date-time(:date="profile.lastUpdatedOn")]
|
||||
p.card-text(v-if="profile")
|
||||
| Your profile currently lists {{profile.skills.length}}
|
||||
| skill#[template(v-if="profile.skills.length !== 1") s].
|
||||
|
||||
@@ -6,9 +6,9 @@ article
|
||||
.col-12.col-sm-10.col-md-8.col-lg-6
|
||||
.form-floating
|
||||
input.form-control(type="text" id="realName" v-model="v$.realName.$model" maxlength="255"
|
||||
placeholder="Leave blank to use your NAS display name")
|
||||
placeholder="Leave blank to use your Mastodon display name")
|
||||
label(for="realName") Real Name
|
||||
.form-text Leave blank to use your NAS display name
|
||||
.form-text Leave blank to use your Mastodon display name
|
||||
.col-12
|
||||
.form-check
|
||||
input.form-check-input(type="checkbox" id="isSeeking" v-model="v$.isSeekingEmployment.$model")
|
||||
|
||||
@@ -9,13 +9,13 @@ article
|
||||
import { onMounted } from "vue"
|
||||
import { useRouter } from "vue-router"
|
||||
import { toastSuccess } from "@/components/layout/AppToaster.vue"
|
||||
import { useStore } from "@/store"
|
||||
import { useStore, Mutations } from "@/store"
|
||||
|
||||
const store = useStore()
|
||||
const router = useRouter()
|
||||
|
||||
onMounted(() => {
|
||||
store.commit("clearUser")
|
||||
store.commit(Mutations.ClearUser)
|
||||
toastSuccess("Log Off Successful | <strong>Have a Nice Day!</strong>")
|
||||
router.push("/")
|
||||
})
|
||||
|
||||
@@ -1,24 +1,50 @@
|
||||
<template lang="pug">
|
||||
article
|
||||
p
|
||||
p.fst-italic Sending you over to No Agenda Social to log on; see you back in just a second…
|
||||
p.fst-italic(v-if="selected") Sending you over to {{selected.name}} to log on; see you back in just a second…
|
||||
template(v-else)
|
||||
p.text-center Please select your No Agenda-affiliated Mastodon instance
|
||||
p.text-center(v-for="it in instances" :key="it.abbr")
|
||||
button.btn.btn-primary(@click.prevent="select(it.abbr)") {{it.name}}
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* This component simply redirects the user to the No Agenda Social authorization page; it is separate here so that it
|
||||
* can be called from two different places, and allow the app to support direct links to authorized content.
|
||||
*/
|
||||
import { computed, onMounted, Ref, ref } from "vue"
|
||||
import { Instance } from "@/api"
|
||||
import { useStore, Actions } from "@/store"
|
||||
|
||||
import LoadData from "@/components/LoadData.vue"
|
||||
|
||||
const store = useStore()
|
||||
|
||||
/** The instances configured for Jobs, Jobs, Jobs */
|
||||
const instances = computed(() => store.state.instances)
|
||||
|
||||
/** Whether authorization is in progress */
|
||||
const selected : Ref<Instance | undefined> = ref(undefined)
|
||||
|
||||
/** The authorization URL to which the user should be directed */
|
||||
const authUrl = (() => {
|
||||
/** The client ID for Jobs, Jobs, Jobs at No Agenda Social */
|
||||
const id = "k_06zlMy0N451meL4AqlwMQzs5PYr6g3d2Q_dCT-OjU"
|
||||
const client = `client_id=${id}`
|
||||
const scope = "scope=read:accounts"
|
||||
const redirect = `redirect_uri=${document.location.origin}/citizen/authorized`
|
||||
const respType = "response_type=code"
|
||||
return `https://noagendasocial.com/oauth/authorize?${client}&${scope}&${redirect}&${respType}`
|
||||
})()
|
||||
document.location.assign(authUrl)
|
||||
const authUrl = computed(() => {
|
||||
if (selected.value) {
|
||||
const client = `client_id=${selected.value.clientId}`
|
||||
const scope = "scope=read:accounts"
|
||||
const redirect = `redirect_uri=${document.location.origin}/citizen/${selected.value.abbr}/authorized`
|
||||
const respType = "response_type=code"
|
||||
return `${selected.value.url}/oauth/authorize?${client}&${scope}&${redirect}&${respType}`
|
||||
}
|
||||
return ""
|
||||
})
|
||||
|
||||
/**
|
||||
* Select a given Mastodon instance
|
||||
*
|
||||
* @param abbr The abbreviation of the instance being selected
|
||||
*/
|
||||
const select = (abbr : string) => {
|
||||
selected.value = instances.value.find(it => it.abbr === abbr)
|
||||
document.location.assign(authUrl.value)
|
||||
}
|
||||
|
||||
onMounted(async () => { await store.dispatch(Actions.EnsureInstances) })
|
||||
|
||||
</script>
|
||||
|
||||
@@ -65,8 +65,8 @@ const title = computed(() => it.value ? `${it.value.listing.title} | Job Listing
|
||||
/** The HTML details of the job listing */
|
||||
const details = computed(() => toHtml(it.value?.listing.text ?? ""))
|
||||
|
||||
/** The NAS profile URL for the citizen who posted this job listing */
|
||||
const profileUrl = computed(() => citizen.value ? `https://noagendasocial.com/@${citizen.value.naUser}` : "")
|
||||
/** The Mastodon profile URL for the citizen who posted this job listing */
|
||||
const profileUrl = computed(() => citizen.value ? citizen.value.profileUrl : "")
|
||||
|
||||
/** The needed by date, formatted in SHOUTING MODE */
|
||||
const neededBy = (nb : string) => formatNeededBy(nb).toUpperCase()
|
||||
|
||||
@@ -13,28 +13,31 @@ article
|
||||
p.
|
||||
This option will make it like you never visited this site. It will delete your profile, skills, success stories, and
|
||||
account. This is what you want to use if you want to disappear from this application. Clicking the button below
|
||||
#[strong will not] affect your No Agenda Social account in any way; its effects are limited to Jobs, Jobs, Jobs.
|
||||
#[strong will not] affect your Mastodon account in any way; its effects are limited to Jobs, Jobs, Jobs.
|
||||
p: em.
|
||||
(This will not revoke this application’s permissions on No Agenda Social; you will have to remove this
|
||||
yourself. The confirmation message has a link where you can do this; once the page loads, find the
|
||||
(This will not revoke this application’s permissions on Mastodon; you will have to remove this yourself. The
|
||||
confirmation message has a link where you can do this; once the page loads, find the
|
||||
#[strong Jobs, Jobs, Jobs] entry, and click the #[strong × Revoke] link for that entry.)
|
||||
p.text-center: button.btn.btn-danger(@click.prevent="deleteAccount") Delete Your Entire Account
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { onMounted } from "vue"
|
||||
import { useRouter } from "vue-router"
|
||||
|
||||
import api, { LogOnSuccess } from "@/api"
|
||||
import { toastError, toastSuccess } from "@/components/layout/AppToaster.vue"
|
||||
import { useStore } from "@/store"
|
||||
</script>
|
||||
import { useStore, Actions, Mutations } from "@/store"
|
||||
|
||||
<script setup lang="ts">
|
||||
const store = useStore()
|
||||
const router = useRouter()
|
||||
|
||||
/** The currently logged-on user */
|
||||
const user = store.state.user as LogOnSuccess
|
||||
|
||||
/** Delete the profile only; redirect to home page on success */
|
||||
const deleteProfile = async () => {
|
||||
const resp = await api.profile.delete(store.state.user as LogOnSuccess)
|
||||
const resp = await api.profile.delete(user)
|
||||
if (typeof resp === "string") {
|
||||
toastError(resp, "Deleting Profile")
|
||||
} else {
|
||||
@@ -45,13 +48,28 @@ const deleteProfile = async () => {
|
||||
|
||||
/** Delete everything pertaining to the user's account */
|
||||
const deleteAccount = async () => {
|
||||
const resp = await api.citizen.delete(store.state.user as LogOnSuccess)
|
||||
if (typeof resp === "string") {
|
||||
toastError(resp, "Deleting Account")
|
||||
const citizenResp = await api.citizen.retrieve(user.citizenId, user)
|
||||
if (typeof citizenResp === "string") {
|
||||
toastError(citizenResp, "retrieving citizen")
|
||||
} else if (typeof citizenResp === "undefined") {
|
||||
toastError("Could not retrieve citizen record", undefined)
|
||||
} else {
|
||||
store.commit("clearUser")
|
||||
toastSuccess("Account Deleted Successfully")
|
||||
router.push("/so-long/success")
|
||||
const instance = store.state.instances.find(it => it.abbr === citizenResp.instance)
|
||||
if (typeof instance === "undefined") {
|
||||
toastError("Could not retrieve instance", undefined)
|
||||
} else {
|
||||
const resp = await api.citizen.delete(user)
|
||||
if (typeof resp === "string") {
|
||||
toastError(resp, "Deleting Account")
|
||||
} else {
|
||||
store.commit(Mutations.ClearUser)
|
||||
toastSuccess("Account Deleted Successfully")
|
||||
router.push(`/so-long/success/${instance.abbr}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => { await store.dispatch(Actions.EnsureInstances) })
|
||||
|
||||
</script>
|
||||
|
||||
@@ -4,8 +4,26 @@ article
|
||||
h3.pb-3 Account Deletion Success
|
||||
p.
|
||||
Your account has been successfully deleted. To revoke the permissions you have previously granted to this
|
||||
application, find it in #[a(href="https://noagendasocial.com/oauth/authorized_applications") this list] and click
|
||||
application, find it in #[a(:href="`${url}/oauth/authorized_applications`") this list] and click
|
||||
#[strong × Revoke]. Otherwise, clicking “Log On” in the left-hand menu will create a new, empty
|
||||
account without prompting you further.
|
||||
p Thank you for participating, and thank you for your courage. #GitmoNation
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted } from "vue"
|
||||
import { useRoute } from "vue-router"
|
||||
import { useStore, Actions } from "@/store"
|
||||
|
||||
const route = useRoute()
|
||||
const store = useStore()
|
||||
|
||||
/** The abbreviation of the instance from which the deleted user had authorized access */
|
||||
const abbr = route.params.abbr as string
|
||||
|
||||
/** The URL of that instance */
|
||||
const url = computed(() => store.state.instances.find(it => it.abbr === abbr)?.url ?? "")
|
||||
|
||||
onMounted(async () => { await store.dispatch(Actions.EnsureInstances) })
|
||||
|
||||
</script>
|
||||
|
||||
@@ -31,7 +31,7 @@ const user = store.state.user as LogOnSuccess
|
||||
/** The story to be displayed */
|
||||
const story : Ref<Success | undefined> = ref(undefined)
|
||||
|
||||
/** The citizen's name (real, display, or NAS, whichever is found first) */
|
||||
/** The citizen's name (real, display, or Mastodon, whichever is found first) */
|
||||
const citizenName = ref("")
|
||||
|
||||
/** Retrieve the success story */
|
||||
|
||||
Reference in New Issue
Block a user