Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
JosephK
framatalk
Commits
0fb62ed5
Commit
0fb62ed5
authored
Nov 17, 2021
by
JosephK
Browse files
⚔
️
parents
f27cd68e
9202f878
Pipeline
#458362
passed with stages
in 1 minute and 26 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
0fb62ed5
...
...
@@ -46,7 +46,7 @@ production:
-
cd public/abc && for f in $(find -type l);do cp --remove-destination $(readlink -f $f) $f;done;
-
eval `ssh-agent -s`
-
ssh-add <(echo "${DEPLOYMENT_KEY}" | base64 --decode -i);
-
echo "put -r .
${DEPLOYMENT_USER}/
" | sftp -o "VerifyHostKeyDNS yes" ${DEPLOYMENT_USER}@${DEPLOYMENT_HOST}:framatalk/abc/;
-
echo "put -r ." | sftp -o "VerifyHostKeyDNS yes" ${DEPLOYMENT_USER}@${DEPLOYMENT_HOST}:framatalk/abc/;
# - rsync -a --rsh='ssh -o "VerifyHostKeyDNS yes"' --delete . ${DEPLOYMENT_USER}@${DEPLOYMENT_HOST}:framatalk/abc/;
only
:
refs
:
...
...
app/components/pages/Home.vue
deleted
100644 → 0
View file @
f27cd68e
<
template
>
<main>
<b-row>
<Carousel
/>
</b-row>
<b-row>
<b-col
class=
"mx-auto text-center"
md=
"8"
>
<b-dropdown
split
:split-href=
"`$
{instance.endpoint}${prefix}${name}`"
split-variant="primary"
size="lg"
variant="outline-primary"
offset="-80"
>
<template
v-slot:button-content
>
<svg-icon
name=
"video"
/>
<span
v-html=
"$t('public.create')"
></span>
<span
v-html=
"$t('public.atalk')"
></span>
</
template
>
<b-dropdown-form
class=
"px-3"
style=
"width: 400px"
@
submit=
"create"
>
<b-form-group
label-for=
"name"
:label=
"$t('public.link')"
>
<b-input-group
size=
"sm"
:prepend=
"`${instance.endpoint}${prefix}`"
>
<b-form-input
id=
"name"
v-model=
"name"
type=
"text"
maxlength=
"50"
@
focusout=
"name = $t(` ${name}`, '-L@').replace(/[^a-zA-Z0-9]/g, '')"
/>
</b-input-group>
</b-form-group>
<div
class=
"text-right"
>
<b-button
variant=
"outline-primary"
size=
"sm"
@
click=
"anotherInstance()"
>
<svg-icon
name=
"random"
/>
<span
v-html=
"$t('public.change')"
></span>
<span
class=
"sr-only"
v-html=
"$t('public.atalk')"
></span>
</b-button>
<b-button
variant=
"primary"
size=
"sm"
:href=
"`${instance.endpoint}${prefix}${name}`"
>
<span
v-html=
"$t('public.create')"
></span>
<span
class=
"sr-only"
v-html=
"$t('public.atalk')"
></span>
</b-button>
</div>
</b-dropdown-form>
</b-dropdown>
<b-form>
<b-form-group
label-for=
"name"
class=
"sr-only"
:label-sr-only=
"true"
:label=
"$t('public.name')"
>
<b-input-group
size=
"lg"
:prepend=
"`${instance.endpoint}${prefix}`"
>
<b-form-input
id=
"name"
v-model=
"name"
type=
"text"
maxlength=
"50"
@
focusout=
"name = $t(` ${name}`, '-L@').replace(/[^a-zA-Z0-9]/g, '')"
/>
<b-input-group-append>
<b-button
variant=
"primary"
type=
"submit"
@
click=
"create"
>
<svg-icon
name=
"video"
size=
"lg"
/>
<span
v-html=
"$t('public.create')"
></span>
<span
class=
"sr-only"
v-html=
"$t('public.atalk')"
></span>
</b-button>
</b-input-group-append>
</b-input-group>
</b-form-group>
</b-form>
</b-col>
</b-row>
<b-row
class=
"justify-content-md-center mb-4"
>
<b-col
v-if=
"!instance.endpoint.includes('framatalk')"
class=
"mt-2"
lg=
"6"
md=
"8"
>
<span
class=
"text-muted"
v-html=
"$t('public.external', {
title: instance.title,
website: instance.website
})"
></span>
<span
v-if=
"instance.chatons"
class=
"text-muted"
v-html=
"$t('public.chatons')"
></span>
.
<br
/>
<router-link
:to=
"`/${$t('lang')}/info`"
class=
"text-muted"
v-html=
"$t('public.full_list', { nbinstances: nbInstances })"
/>
</b-col>
<b-col
v-else
id=
"frama_other_message"
class=
"mt-2"
lg=
"6"
md=
"8"
>
<span
class=
"text-muted"
v-html=
"$t('public.frama_other')"
></span><br
/>
<router-link
:to=
"`/${$t('lang')}/info`"
class=
"text-muted"
v-html=
"$t('public.full_list', { nbinstances: nbInstances })"
/>
</b-col>
</b-row>
<b-row>
<b-col
class=
"py-2"
md=
"6"
v-html=
"$t('what.md')"
/>
<b-col
class=
"py-2"
md=
"6"
>
<b-alert
show
v-html=
"$t('tip', {
icon: `<span class='svg-icon'><svg xmlns='http://www.w3.org/2000/svg' class='fa-fw' fill='#677890' viewBox='0 0 576 512'><path d='M336.2 64H47.8A47.8 47.8 0 000 111.8v288.4A47.8 47.8 0 0047.8 448h288.4a47.8 47.8 0 0047.8-47.8V111.8A47.8 47.8 0 00336.2 64zm189.4 37.7L416 177.3v157.4l109.6 75.5c21.2 14.6 50.4-.3 50.4-25.8V127.5c0-25.4-29.1-40.4-50.4-25.8z'/></svg></span>`
})"
/>
</b-col>
</b-row>
<b-row
class=
"mt-4"
>
<!-- Help -->
<b-col
md=
"4"
>
<h2
v-html=
"$t('help.title')"
></h2>
<svg-icon
name=
"question-circle"
size=
"3x"
variant=
"d-block text-center mb-3 fc-g6"
/>
<div
v-html=
"$t('help.md', {
icon: `<i class='fa fa-info-circle' aria-hidden='true'></i>`
})"
></div>
</b-col>
<!-- About software -->
<b-col
md=
"4"
>
<h2
v-html=
"$t('software.title')"
></h2>
<svg-icon
name=
"cloud"
size=
"3x"
variant=
"d-block text-center mb-3 fc-g6"
/>
<div
v-html=
"$t('software.md', { link: 'https://meet.jit.si' })"
></div>
</b-col>
<!-- Garden -->
<b-col
md=
"4"
>
<h2
v-html=
"$t('garden.title')"
></h2>
<svg-icon
name=
"leaf"
size=
"3x"
variant=
"d-block text-center mb-3 fc-g6"
/>
<div
v-html=
"$t('garden.md')"
></div>
<b-button
:href=
"`${$t('link.cloud')}/${$t('cloud.talk')}`"
variant=
"outline-success"
>
<svg-icon
label=
"framacloud.org"
name=
"leaf"
/>
</b-button>
</b-col>
</b-row>
</main>
</template>
<
script
>
import
Carousel
from
'
../partials/Carousel.vue
'
;
import
instanceStatus
from
'
../../mixins/instanceStatus
'
;
const
DEFAULT_WEIGHT
=
2
;
export
default
{
components
:
{
Carousel
,
},
mixins
:
[
instanceStatus
],
data
()
{
/* Random alphanumeric name with 10 chars */
const
name
=
[...
Array
(
10
)].
map
(()
=>
Math
.
random
().
toString
(
36
)[
3
]).
join
(
''
)
.
replace
(
/
(
.|$
)
/g
,
c
=>
c
[
!
Math
.
round
(
Math
.
random
())
?
'
toString
'
:
'
toLowerCase
'
]());
return
{
prefix
:
Math
.
trunc
(
new
Date
().
getTime
()
/
3600000
).
toString
(
36
),
status
:
{},
name
,
instance
:
this
.
$t
(
'
instances.framatalk
'
),
instances
:
this
.
$t
(
'
instances
'
),
};
},
computed
:
{
nbInstances
()
{
return
Object
.
keys
(
this
.
instances
).
length
;
},
},
async
mounted
()
{
this
.
status
=
await
(
await
fetch
(
'
https://framatalk.org/accueil/instances_check.json
'
)).
json
();
this
.
anotherInstance
();
while
(
this
.
keyForEndpoint
(
this
.
instance
.
endpoint
)
in
this
.
status
.
failed
)
{
this
.
anotherInstance
();
}
},
methods
:
{
create
(
event
)
{
event
.
preventDefault
();
this
.
name
=
this
.
$t
(
this
.
name
,
'
-kL@
'
).
replace
(
/
[^
a-zA-Z0-9
]
/g
,
''
);
window
.
location
=
`
${
this
.
instance
.
endpoint
}${
this
.
prefix
}${
this
.
name
}
`
;
},
randomInstance
()
{
const
remoteInstancesSelected
=
Object
.
entries
(
this
.
instances
)
.
filter
(([,
value
])
=>
(
!
(
value
.
trust
===
false
)))
.
map
(([
key
,
instance
])
=>
[
key
,
(
instance
.
weight
||
DEFAULT_WEIGHT
)]);
return
this
.
instances
[
this
.
weightedRand
(
remoteInstancesSelected
)];
},
weightedRand
(
data
)
{
// First, we loop the main dataset to count up the total weight.
// We're starting the counter at one because the upper boundary of Math.random() is exclusive.
let
total
=
1
;
for
(
let
i
=
0
;
i
<
data
.
length
;
i
+=
1
)
{
total
+=
data
[
i
][
1
];
}
// Total in hand, we can now pick a random value akin to our
// random index from before.
const
threshold
=
Math
.
floor
(
Math
.
random
()
*
total
);
// Now we just need to loop through the main data one more time
// until we discover which value would live within this
// particular threshold. We need to keep a running count of
// weights as we go, so let's just reuse the "total" variable
// since it was already declared.
total
=
0
;
for
(
let
i
=
0
;
i
<
data
.
length
;
i
+=
1
)
{
// Add the weight to our running total.
total
+=
data
[
i
][
1
];
// If this value falls within the threshold, we're done!
if
(
total
>=
threshold
)
{
return
data
[
i
][
0
];
}
}
// Should never happen
return
data
[
0
][
0
];
},
anotherInstance
()
{
let
newInstance
=
this
.
instance
;
while
(
newInstance
===
this
.
instance
)
{
newInstance
=
this
.
randomInstance
();
}
this
.
instance
=
newInstance
;
},
},
};
</
script
>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment