Merge branch 'main' into api_edit_separation

This commit is contained in:
Dessalines 2020-07-22 13:47:52 -04:00
commit b6a6d52a92
26 changed files with 155 additions and 48 deletions

2
ansible/VERSION vendored
View file

@ -1 +1 @@
v0.7.25
v0.7.26

View file

@ -1,4 +1,3 @@
proxy_cache_path /var/cache/lemmy_frontend levels=1:2 keys_zone=lemmy_frontend_cache:10m max_size=100m use_temp_path=off;
limit_req_zone $binary_remote_addr zone=lemmy_ratelimit:10m rate=1r/s;
server {
@ -65,13 +64,6 @@ server {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Proxy Cache
proxy_cache lemmy_frontend_cache;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_cache_revalidate on;
proxy_cache_lock on;
proxy_cache_min_uses 5;
}
# Redirect pictshare images to pictrs

View file

@ -12,8 +12,6 @@ third_semver=$(echo $new_tag | cut -d "." -f 3)
# Setting the version on the front end
cd ../../
echo "export const version: string = '$new_tag';" > "ui/src/version.ts"
git add "ui/src/version.ts"
# Setting the version on the backend
echo "pub const VERSION: &str = \"$new_tag\";" > "server/src/version.rs"
git add "server/src/version.rs"

View file

@ -12,7 +12,7 @@ services:
restart: always
lemmy:
image: dessalines/lemmy:v0.7.25
image: dessalines/lemmy:v0.7.26
ports:
- "127.0.0.1:8536:8536"
restart: always

View file

@ -35,6 +35,8 @@ Horizontal Rule <br>\--- | Horizontal Rule<br>\*\*\* | Horizontal Rule <br><hr>
\`Inline code\` with backticks | |`Inline code` with backticks
\`\`\`<br>\# code block <br>print '3 backticks or'<br>print 'indent 4 spaces' <br>\`\`\` | ····\# code block<br>····print '3 backticks or'<br>····print 'indent 4 spaces' | \# code block <br>print '3 backticks or'<br>print 'indent 4 spaces'
::: spoiler hidden or nsfw stuff<br>*a bunch of spoilers here*<br>::: | | <details><summary> hidden or nsfw stuff </summary><p><em>a bunch of spoilers here</em></p></details>
Some ~subscript~ text | | Some <sub>subscript</sub> text
Some ^superscript^ text | | Some <sup>superscript</sup> text
[CommonMark Tutorial](https://commonmark.org/help/tutorial/)

View file

@ -952,6 +952,8 @@ Search types are `All, Comments, Posts, Communities, Users, Url`
site: Option<SiteView>,
admins: Vec<UserView>,
banned: Vec<UserView>,
online: usize, // This is currently broken
version: String,
}
}
```

46
server/Cargo.lock generated vendored
View file

@ -3,7 +3,7 @@
[[package]]
name = "activitystreams-ext"
version = "0.1.0"
source = "git+https://git.asonix.dog/asonix/activitystreams-ext?branch=main#9acc466c7cb550ada31b669a1c47ea088f1c8471"
source = "git+https://yerbamate.dev/asonix/activitystreams-ext?branch=main#2799a4c606467a2f577e1f45f93c6828ec83cfdf"
dependencies = [
"activitystreams-new",
"serde 1.0.114",
@ -13,7 +13,7 @@ dependencies = [
[[package]]
name = "activitystreams-new"
version = "0.1.0"
source = "git+https://git.asonix.dog/asonix/activitystreams-sketch?branch=main#857d5167dfa13054dd0d21d3d54f8147eea0d546"
source = "git+https://yerbamate.dev/asonix/activitystreams-new?branch=main#857d5167dfa13054dd0d21d3d54f8147eea0d546"
dependencies = [
"chrono",
"mime",
@ -783,9 +783,9 @@ checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
[[package]]
name = "cpuid-bool"
version = "0.1.1"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec6763c20301ab0dc67051d1b6f4cc9132ad9e6eddcb1f10c6c53ea6d6ae2183"
checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"
[[package]]
name = "crc32fast"
@ -798,12 +798,12 @@ dependencies = [
[[package]]
name = "crossbeam-channel"
version = "0.4.2"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061"
checksum = "09ee0cc8804d5393478d743b035099520087a5186f3b93fa58cec08fa62407b6"
dependencies = [
"cfg-if",
"crossbeam-utils",
"maybe-uninit",
]
[[package]]
@ -1336,6 +1336,15 @@ dependencies = [
"tracing",
]
[[package]]
name = "hashbrown"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34f595585f103464d8d2f6e9864682d74c1601fed5e07d62b1c9058dba8246fb"
dependencies = [
"autocfg 1.0.0",
]
[[package]]
name = "heck"
version = "0.3.1"
@ -1448,11 +1457,12 @@ dependencies = [
[[package]]
name = "indexmap"
version = "1.4.0"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe"
checksum = "5b88cd59ee5f71fea89a62248fc8f387d44400cefe05ef548466d61ced9029a7"
dependencies = [
"autocfg 1.0.0",
"hashbrown",
]
[[package]]
@ -1671,9 +1681,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.72"
version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701"
checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9"
[[package]]
name = "linked-hash-map"
@ -1745,12 +1755,6 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
[[package]]
name = "maybe-uninit"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
[[package]]
name = "memchr"
version = "2.3.3"
@ -2178,9 +2182,9 @@ checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a"
[[package]]
name = "proc-macro2"
version = "1.0.18"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12"
dependencies = [
"unicode-xid",
]
@ -2834,9 +2838,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.34"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b"
checksum = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0"
dependencies = [
"proc-macro2",
"quote",

4
server/Cargo.toml vendored
View file

@ -18,8 +18,8 @@ lemmy_db = { path = "./lemmy_db" }
diesel = "1.4.4"
diesel_migrations = "1.4.0"
dotenv = "0.15.0"
activitystreams-new = { git = "https://git.asonix.dog/asonix/activitystreams-sketch", branch = "main" }
activitystreams-ext = { git = "https://git.asonix.dog/asonix/activitystreams-ext", branch = "main" }
activitystreams-new = { git = "https://yerbamate.dev/asonix/activitystreams-new", branch = "main" }
activitystreams-ext = { git = "https://yerbamate.dev/asonix/activitystreams-ext", branch = "main" }
bcrypt = "0.8.0"
chrono = { version = "0.4.7", features = ["serde"] }
serde_json = { version = "1.0.52", features = ["preserve_order"]}

View file

@ -3,6 +3,7 @@ use crate::{
api::{claims::Claims, APIError, Oper, Perform},
apub::fetcher::search_by_apub_id,
blocking,
version,
websocket::{server::SendAllMessage, UserOperation, WebsocketInfo},
DbPool,
LemmyError,
@ -110,6 +111,7 @@ pub struct GetSiteResponse {
admins: Vec<UserView>,
banned: Vec<UserView>,
pub online: usize,
version: String,
}
#[derive(Serialize, Deserialize)]
@ -424,6 +426,7 @@ impl Perform for Oper<GetSite> {
admins,
banned,
online,
version: version::VERSION.to_string(),
})
}
}
@ -666,6 +669,7 @@ impl Perform for Oper<TransferSite> {
admins,
banned,
online: 0,
version: version::VERSION.to_string(),
})
}
}

View file

@ -1 +1 @@
pub const VERSION: &str = "v0.7.25";
pub const VERSION: &str = "v0.7.26";

2
ui/package.json vendored
View file

@ -37,6 +37,8 @@
"markdown-it": "^10.0.0",
"markdown-it-container": "^2.0.0",
"markdown-it-emoji": "^1.4.0",
"markdown-it-sub": "^1.0.0",
"markdown-it-sup": "^1.0.0",
"moment": "^2.24.0",
"node-fetch": "^2.6.0",
"prettier": "^2.0.4",

View file

@ -46,6 +46,7 @@ export class AdminSettings extends Component<any, AdminSettingsState> {
admins: [],
banned: [],
online: null,
version: null,
},
siteConfigForm: {
config_hjson: null,

View file

@ -1,12 +1,41 @@
import { Component } from 'inferno';
import { Link } from 'inferno-router';
import { repoUrl } from '../utils';
import { version } from '../version';
import { i18n } from '../i18next';
import { Subscription } from 'rxjs';
import { retryWhen, delay, take } from 'rxjs/operators';
import { WebSocketService } from '../services';
import { repoUrl, wsJsonToRes } from '../utils';
import {
UserOperation,
WebSocketJsonResponse,
GetSiteResponse,
} from '../interfaces';
export class Footer extends Component<any, any> {
interface FooterState {
version: string;
}
export class Footer extends Component<any, FooterState> {
private wsSub: Subscription;
emptyState: FooterState = {
version: null,
};
constructor(props: any, context: any) {
super(props, context);
this.state = this.emptyState;
this.wsSub = WebSocketService.Instance.subject
.pipe(retryWhen(errors => errors.pipe(delay(3000), take(10))))
.subscribe(
msg => this.parseMessage(msg),
err => console.error(err),
() => console.log('complete')
);
}
componentWillUnmount() {
this.wsSub.unsubscribe();
}
render() {
@ -15,7 +44,7 @@ export class Footer extends Component<any, any> {
<div className="navbar-collapse">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<span class="navbar-text">{version}</span>
<span class="navbar-text">{this.state.version}</span>
</li>
<li class="nav-item">
<Link class="nav-link" to="/modlog">
@ -42,4 +71,12 @@ export class Footer extends Component<any, any> {
</nav>
);
}
parseMessage(msg: WebSocketJsonResponse) {
let res = wsJsonToRes(msg);
if (res.op == UserOperation.GetSite) {
let data = res.data as GetSiteResponse;
this.setState({ version: data.version });
}
}
}

View file

@ -107,6 +107,7 @@ export class Main extends Component<any, MainState> {
admins: [],
banned: [],
online: null,
version: null,
},
showEditSite: false,
loading: true,

View file

@ -267,6 +267,24 @@ export class MarkdownTextArea extends Component<
<use xlinkHref="#icon-code"></use>
</svg>
</button>
<button
class="btn btn-sm text-muted"
data-tippy-content={i18n.t('subscript')}
onClick={linkEvent(this, this.handleInsertSubscript)}
>
<svg class="icon icon-inline">
<use xlinkHref="#icon-subscript"></use>
</svg>
</button>
<button
class="btn btn-sm text-muted"
data-tippy-content={i18n.t('superscript')}
onClick={linkEvent(this, this.handleInsertSuperscript)}
>
<svg class="icon icon-inline">
<use xlinkHref="#icon-superscript"></use>
</svg>
</button>
<button
class="btn btn-sm text-muted"
data-tippy-content={i18n.t('spoiler')}
@ -470,6 +488,16 @@ export class MarkdownTextArea extends Component<
i.simpleInsert('#');
}
handleInsertSubscript(i: MarkdownTextArea, event: any) {
event.preventDefault();
i.simpleSurround('~');
}
handleInsertSuperscript(i: MarkdownTextArea, event: any) {
event.preventDefault();
i.simpleSurround('^');
}
simpleInsert(chars: string) {
if (!this.state.content) {
this.state.content = `${chars} `;

View file

@ -30,7 +30,6 @@ import {
messageToastify,
md,
} from '../utils';
import { version } from '../version';
import { i18n } from '../i18next';
interface NavbarState {
@ -41,6 +40,7 @@ interface NavbarState {
messages: Array<PrivateMessage>;
unreadCount: number;
siteName: string;
version: string;
admins: Array<UserView>;
searchParam: string;
toggleSearch: boolean;
@ -58,6 +58,7 @@ export class Navbar extends Component<any, NavbarState> {
messages: [],
expanded: false,
siteName: undefined,
version: undefined,
admins: [],
searchParam: '',
toggleSearch: false,
@ -150,7 +151,7 @@ export class Navbar extends Component<any, NavbarState> {
navbar() {
return (
<nav class="container-fluid navbar navbar-expand-md navbar-light shadow p-0 px-3">
<Link title={version} class="navbar-brand" to="/">
<Link title={this.state.version} class="navbar-brand" to="/">
{this.state.siteName}
</Link>
{this.state.isLoggedIn && (
@ -395,6 +396,7 @@ export class Navbar extends Component<any, NavbarState> {
if (data.site && !this.state.siteName) {
this.state.siteName = data.site.name;
this.state.version = data.version;
this.state.admins = data.admins;
this.setState(this.state);
}

View file

@ -92,6 +92,7 @@ export class Post extends Component<any, PostState> {
enable_nsfw: undefined,
},
online: null,
version: null,
},
};

File diff suppressed because one or more lines are too long

View file

@ -813,6 +813,7 @@ export interface GetSiteResponse {
admins: Array<UserView>;
banned: Array<UserView>;
online: number;
version: string;
}
export interface SiteResponse {

4
ui/src/utils.ts vendored
View file

@ -49,6 +49,8 @@ import { UserService, WebSocketService } from './services';
import Tribute from 'tributejs/src/Tribute.js';
import markdown_it from 'markdown-it';
import markdown_it_sub from 'markdown-it-sub';
import markdown_it_sup from 'markdown-it-sup';
import markdownitEmoji from 'markdown-it-emoji/light';
import markdown_it_container from 'markdown-it-container';
import emojiShortName from 'emoji-short-name';
@ -148,6 +150,8 @@ export const md = new markdown_it({
linkify: true,
typographer: true,
})
.use(markdown_it_sub)
.use(markdown_it_sup)
.use(markdown_it_container, 'spoiler', {
validate: function (params: any) {
return params.trim().match(/^spoiler\s+(.*)$/);

1
ui/src/version.ts vendored
View file

@ -1 +0,0 @@
export const version: string = 'v0.7.25';

View file

@ -53,6 +53,8 @@
"archive_link": "archive link",
"bold": "bold",
"italic": "italic",
"subscript": "subscript",
"superscript": "superscript",
"header": "header",
"strikethrough": "strikethrough",
"quote": "quote",

View file

@ -260,5 +260,6 @@
"invalid_post_title": "Titre du post invalide",
"must_login": "Vous devez vous être <1>connecté ou enregistré</1> pour commenter.",
"no_password_reset": "Vous ne pourrez pas réinitialiser votre mot de passe sans un e-mail.",
"what_is": "Combien font"
"what_is": "Combien font",
"cake_day_title": "Lemmyversaire:"
}

View file

@ -160,7 +160,7 @@
"yes": "sì",
"no": "no",
"powered_by": "Offerto da",
"landing": "Lemmy è un <1>aggregatore di link</1> / alternativa a reddit, creato per integrarsi con il <2>fediverso</2>. <3></3>È self-hosted, i commenti sono aggiornati in tempo reale ed è molto piccolo (<4>~80kB</4>). La federazione con la rete ActivityPub sarà implementata nel futuro. <5></5>Questa versione è una <6>beta molto giovane</6> e molte funzionalità sono incomplete o mancanti. <7></7>Suggerisci nuove funzionalità o segnala errori a <8>questa pagina.</8><9></9>Sviluppato con <10>Rust</10>, <11>Actix</11>, <12>Inferno</12>, <13>Typescript</13>.",
"landing": "Lemmy è un <1>aggregatore di link</1> / alternativa a reddit, creato per integrarsi con il <2>fediverso</2>. <3></3>È self-hosted, i commenti sono aggiornati in tempo reale ed è molto piccolo (<4>~80kB</4>). La federazione con la rete ActivityPub sarà implementata nel futuro. <5></5>Questa versione è una <6>beta molto giovane</6> e molte funzionalità sono incomplete o mancanti. <7></7>Suggerisci nuove funzionalità o segnala errori a <8>questa pagina.</8><9></9>Sviluppato con <10>Rust</10>, <11>Actix</11>, <12>Inferno</12>, <13>Typescript</13>.<14></14> <15>Un grazie ai nostri sostenitori: </15> dessalines, Nutomic, asonix, zacanger, and iav.",
"not_logged_in": "Non hai effettuato l'accesso.",
"community_ban": "Sei stato escluso da questa comunità.",
"site_ban": "Sei stato escluso dal sito",
@ -257,5 +257,10 @@
"picture_deleted": "Foto eliminata.",
"select_a_community": "Seleziona una comunità",
"invalid_username": "Nome utente non valido.",
"what_is": "Cos'è"
"what_is": "Cos'è",
"must_login": "Devi <1>effettuare l'accesso o registrarti</1> per commentare.",
"no_password_reset": "Non sarai in grado di resettare la tua password senza una email.",
"cake_day_title": "Cake day:",
"cake_day_info": "Oggi è il cake day di {{ creator_name }}!",
"invalid_post_title": "Titolo della pubblicazione non valido"
}

View file

@ -192,7 +192,7 @@
"yes": "sim",
"no": "não",
"powered_by": "Fornecido por",
"landing_0": "Lemmy é um <1>agregador de links</1> / alternativa ao reddit, com a intenção de funcionar junto ao <2>fediverso</2>.<3></3>Pode ser hospedado em servidor próprio, tem atualização de comentários em tempo real e é minúsculo (<4>~80kB</4>). A federação com a rede ActivityPub está no roteiro do projeto. <5></5>Esta é uma <6>versão beta bastante antecipada</6>, e muitas funcionalidades ainda estão quebradas ou ausentes. <7></7>Sugira novas funcionalidades ou reporte erros <8>aqui.</8><9></9>Feito com <10>Rust</10>, <11>Actix</11>, <12>Inferno</12>, <13>Typescript</13>.",
"landing": "Lemmy é um <1>agregador de links</1> / alternativa ao reddit, com a intenção de funcionar junto ao <2>fediverso</2>.<3></3>Pode ser hospedado em servidor próprio, tem atualização de comentários em tempo real e é minúsculo (<4>~80kB</4>). A federação com a rede ActivityPub está no roteiro do projeto. <5></5>Esta é uma <6>versão beta bastante antecipada</6>, e muitas funcionalidades ainda estão quebradas ou ausentes. <7></7>Sugira novas funcionalidades ou reporte erros <8>aqui.</8><9></9>Feito com <10>Rust</10>, <11>Actix</11>, <12>Inferno</12>, <13>Typescript</13>. <14></14> <15>Agradecemos aos nossos contribuidores: </15> dessalines, Nutomic, asonix, zacanger, e iav.",
"not_logged_in": "Não autenticado.",
"logged_in": "Autenticado.",
"community_ban": "Você foi banido desta comunidade.",
@ -256,5 +256,10 @@
"site_saved": "Site Salvo.",
"emoji_picker": "Selecionador de Emoji",
"select_a_community": "Selecione uma comunidade",
"invalid_username": "Nome de usuário inválido."
"invalid_username": "Nome de usuário inválido.",
"must_login": "Você precisa <1>entrar ou registrar-se</1> para comentar.",
"no_password_reset": "Você não conseguirá redefinir sua senha sem um e-mail.",
"invalid_post_title": "Título de publicação inválido",
"cake_day_info": "Hoje é o dia do bolo de {{ creator_name }}!",
"cake_day_title": "Dia do bolo:"
}

10
ui/yarn.lock vendored
View file

@ -4317,6 +4317,16 @@ markdown-it-emoji@^1.4.0:
resolved "https://registry.yarnpkg.com/markdown-it-emoji/-/markdown-it-emoji-1.4.0.tgz#9bee0e9a990a963ba96df6980c4fddb05dfb4dcc"
integrity sha1-m+4OmpkKljupbfaYDE/dsF37Tcw=
markdown-it-sub@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/markdown-it-sub/-/markdown-it-sub-1.0.0.tgz#375fd6026eae7ddcb012497f6411195ea1e3afe8"
integrity sha1-N1/WAm6ufdywEkl/ZBEZXqHjr+g=
markdown-it-sup@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/markdown-it-sup/-/markdown-it-sup-1.0.0.tgz#cb9c9ff91a5255ac08f3fd3d63286e15df0a1fc3"
integrity sha1-y5yf+RpSVawI8/09YyhuFd8KH8M=
markdown-it@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-10.0.0.tgz#abfc64f141b1722d663402044e43927f1f50a8dc"