cc998e7c61
- Add a default App and ApiToken for each user, that is used by the front-end - Add an API route to update an article (CSRF had to be disabled because of a bug in rocket_csrf) - Use AJAX to publish and edit articles in the new editor, instead of weird hacks with HTML forms
36 lines
1.1 KiB
SQL
36 lines
1.1 KiB
SQL
-- Your SQL goes here
|
|
--#!|conn: &Connection, path: &Path| {
|
|
--#! use plume_common::utils::random_hex;
|
|
--#!
|
|
--#! let client_id = random_hex();
|
|
--#! let client_secret = random_hex();
|
|
--#! let app = crate::apps::App::insert(
|
|
--#! &*conn,
|
|
--#! crate::apps::NewApp {
|
|
--#! name: "Plume web interface".into(),
|
|
--#! client_id,
|
|
--#! client_secret,
|
|
--#! redirect_uri: None,
|
|
--#! website: Some("https://joinplu.me".into()),
|
|
--#! },
|
|
--#! ).unwrap();
|
|
--#!
|
|
--#! for i in 0..=(crate::users::User::count_local(conn).unwrap() as i32 / 20) {
|
|
--#! if let Ok(page) = crate::users::User::get_local_page(conn, (i * 20, (i + 1) * 20)) {
|
|
--#! for user in page {
|
|
--#! crate::api_tokens::ApiToken::insert(
|
|
--#! conn,
|
|
--#! crate::api_tokens::NewApiToken {
|
|
--#! app_id: app.id,
|
|
--#! user_id: user.id,
|
|
--#! value: random_hex(),
|
|
--#! scopes: "read+write".into(),
|
|
--#! },
|
|
--#! ).unwrap();
|
|
--#! }
|
|
--#! }
|
|
--#! }
|
|
--#!
|
|
--#! Ok(())
|
|
--#!}
|