partly working

This commit is contained in:
Felix Ableitner 2024-11-26 11:24:31 +01:00
parent 9fd9df7076
commit 1324963fb9
4 changed files with 19 additions and 22 deletions

View file

@ -28,7 +28,7 @@
"eslint": "^9.14.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.5.0",
"lemmy-js-client": "0.20.0-alpha.18",
"lemmy-js-client": "0.20.0-instance-blocks.2",
"prettier": "^3.2.5",
"ts-jest": "^29.1.0",
"typescript": "^5.5.4",

View file

@ -30,8 +30,8 @@ importers:
specifier: ^29.5.0
version: 29.7.0(@types/node@22.9.0)
lemmy-js-client:
specifier: 0.20.0-alpha.18
version: 0.20.0-alpha.18
specifier: 0.20.0-instance-blocks.2
version: 0.20.0-instance-blocks.2
prettier:
specifier: ^3.2.5
version: 3.3.3
@ -1167,8 +1167,8 @@ packages:
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
engines: {node: '>=6'}
lemmy-js-client@0.20.0-alpha.18:
resolution: {integrity: sha512-oZy8DboTWfUar4mPWpi7SYrOEjTBJxkvd1e6QaVwoA5UhqQV1WhxEYbzrpi/gXnEokaVQ0i5sjtL/Y2PHMO3MQ==}
lemmy-js-client@0.20.0-instance-blocks.2:
resolution: {integrity: sha512-R7+O/jGSvl7URWy/Gp4WRdH9EjkDmo5GRbQwJMOSM2HmFi9PIzcMynYbrNC869pbnI8S/XsitVfv9sLTuthpDg==}
leven@3.1.0:
resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==}
@ -3077,7 +3077,7 @@ snapshots:
kleur@3.0.3: {}
lemmy-js-client@0.20.0-alpha.18: {}
lemmy-js-client@0.20.0-instance-blocks.2: {}
leven@3.1.0: {}

View file

@ -1,9 +1,8 @@
import {
AdminBlockInstanceParams,
ApproveCommunityPendingFollower,
BlockCommunity,
BlockCommunityResponse,
BlockInstance,
BlockInstanceResponse,
CommunityId,
CommunityVisibility,
CreatePrivateMessageReport,
@ -21,11 +20,13 @@ import {
PostView,
PrivateMessageReportResponse,
SuccessResponse,
UserBlockInstanceParams,
} from "lemmy-js-client";
import { CreatePost } from "lemmy-js-client/dist/types/CreatePost";
import { DeletePost } from "lemmy-js-client/dist/types/DeletePost";
import { EditPost } from "lemmy-js-client/dist/types/EditPost";
import { EditSite } from "lemmy-js-client/dist/types/EditSite";
import { AdminAllowInstanceParams } from "lemmy-js-client/dist/types/AdminAllowInstanceParams";
import { FeaturePost } from "lemmy-js-client/dist/types/FeaturePost";
import { GetComments } from "lemmy-js-client/dist/types/GetComments";
import { GetCommentsResponse } from "lemmy-js-client/dist/types/GetCommentsResponse";
@ -177,6 +178,12 @@ export async function setupLogins() {
"lemmy-epsilon",
];
await alpha.editSite(editSiteForm);
const params: AdminAllowInstanceParams = {
instance_id: 0,
allow: true,
reason: undefined
};
await alpha.adminAllowInstance(params);
editSiteForm.allowed_instances = betaAllowedInstances;
await beta.editSite(editSiteForm);
@ -854,16 +861,16 @@ export function getPosts(
return api.getPosts(form);
}
export function blockInstance(
export function userBlockInstance(
api: LemmyHttp,
instance_id: InstanceId,
block: boolean,
): Promise<BlockInstanceResponse> {
let form: BlockInstance = {
): Promise<SuccessResponse> {
let form: UserBlockInstanceParams = {
instance_id,
block,
};
return api.blockInstance(form);
return api.userBlockInstance(form);
}
export function blockCommunity(

View file

@ -269,10 +269,6 @@ pub struct CreateSite {
#[cfg_attr(feature = "full", ts(optional))]
pub captcha_difficulty: Option<String>,
#[cfg_attr(feature = "full", ts(optional))]
pub allowed_instances: Option<Vec<String>>,
#[cfg_attr(feature = "full", ts(optional))]
pub blocked_instances: Option<Vec<String>>,
#[cfg_attr(feature = "full", ts(optional))]
pub registration_mode: Option<RegistrationMode>,
#[cfg_attr(feature = "full", ts(optional))]
pub oauth_registration: Option<bool>,
@ -398,12 +394,6 @@ pub struct EditSite {
/// The captcha difficulty. Can be easy, medium, or hard
#[cfg_attr(feature = "full", ts(optional))]
pub captcha_difficulty: Option<String>,
/// A list of allowed instances. If none are set, federation is open.
#[cfg_attr(feature = "full", ts(optional))]
pub allowed_instances: Option<Vec<String>>,
/// A list of blocked instances.
#[cfg_attr(feature = "full", ts(optional))]
pub blocked_instances: Option<Vec<String>>,
/// A list of blocked URLs
#[cfg_attr(feature = "full", ts(optional))]
pub blocked_urls: Option<Vec<String>>,