This commit is contained in:
parent
31ca387339
commit
6da7a84cab
12
.idea/NeDvachAPI.iml
Normal file
12
.idea/NeDvachAPI.iml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/NeDvachAPI.iml" filepath="$PROJECT_DIR$/.idea/NeDvachAPI.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
45
.idea/workspace.xml
Normal file
45
.idea/workspace.xml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="afeb71ff-aaed-4a5b-8ece-55d4f78fc0c7" name="Changes" comment="" />
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
</component>
|
||||||
|
<component name="MarkdownSettingsMigration">
|
||||||
|
<option name="stateVersion" value="1" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectId" id="2HppPxAx0SVc4HMyQfWgDlfmGn2" />
|
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||||
|
<component name="ProjectViewState">
|
||||||
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
<option name="showLibraryContents" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
|
"keyToString": {
|
||||||
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
|
"WebServerToolWindowFactoryState": "false",
|
||||||
|
"vue.rearranger.settings.migration": "true"
|
||||||
|
}
|
||||||
|
}]]></component>
|
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="afeb71ff-aaed-4a5b-8ece-55d4f78fc0c7" name="Changes" comment="" />
|
||||||
|
<created>1668991859805</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1668991859805</updated>
|
||||||
|
<workItem from="1668991862249" duration="12000" />
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
<option name="version" value="3" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -12,10 +12,11 @@ namespace NeDvachAPI.Controllers
|
|||||||
{
|
{
|
||||||
[HttpGet(Name = "GetPosts")]
|
[HttpGet(Name = "GetPosts")]
|
||||||
public string Get([FromUri] string board, int thread)
|
public string Get([FromUri] string board, int thread)
|
||||||
{
|
{
|
||||||
|
string ipAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
|
||||||
List<Post> posts = DBchat.DbList(board, thread);
|
List<Post> posts = DBchat.DbList(board, thread);
|
||||||
string postsJson = JsonSerializer.Serialize(posts);
|
string postsJson = JsonSerializer.Serialize(posts);
|
||||||
Console.WriteLine("Запрошен список постов из борды " + board + " и треда# " + thread );
|
Console.WriteLine("С адреса " + ipAddress + " запрошен список постов из борды " + board + " и треда# " + thread);
|
||||||
return postsJson ;
|
return postsJson ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,8 @@ namespace NeDvachAPI.Controllers
|
|||||||
[HttpPost(Name = "PostPosts")]
|
[HttpPost(Name = "PostPosts")]
|
||||||
public JsonResult ReceivePost([FromBody] Post ReceivedPost)
|
public JsonResult ReceivePost([FromBody] Post ReceivedPost)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Принят пост");
|
string ipAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
|
||||||
|
ReceivedPost.Ip = ipAddress;
|
||||||
DBchat.SendPost(ReceivedPost);
|
DBchat.SendPost(ReceivedPost);
|
||||||
return new JsonResult("Posted Successfully!");
|
return new JsonResult("Posted Successfully!");
|
||||||
}
|
}
|
||||||
|
@ -127,13 +127,14 @@ namespace NeDvachAPI
|
|||||||
int postNum = 14;
|
int postNum = 14;
|
||||||
|
|
||||||
using (var command = new NpgsqlCommand(@"
|
using (var command = new NpgsqlCommand(@"
|
||||||
INSERT INTO posts (post_id, post_text, post_number, content, thread_id, post_timestamp)
|
INSERT INTO posts (post_id, post_text, post_number, content, thread_id, auth_ip, post_timestamp)
|
||||||
VALUES (
|
VALUES (
|
||||||
DEFAULT,
|
DEFAULT,
|
||||||
@postText,
|
@postText,
|
||||||
@postNum,
|
@postNum,
|
||||||
@postImgUrl,
|
@postImgUrl,
|
||||||
@threadId,
|
@threadId,
|
||||||
|
@ip,
|
||||||
(
|
(
|
||||||
SELECT date_trunc(
|
SELECT date_trunc(
|
||||||
'second',
|
'second',
|
||||||
@ -145,6 +146,7 @@ namespace NeDvachAPI
|
|||||||
command.Parameters.AddWithValue("postNum", postNum);
|
command.Parameters.AddWithValue("postNum", postNum);
|
||||||
command.Parameters.AddWithValue("postImgUrl", postToSend.ImgURL);
|
command.Parameters.AddWithValue("postImgUrl", postToSend.ImgURL);
|
||||||
command.Parameters.AddWithValue("threadId", postToSend.Thread_Id);
|
command.Parameters.AddWithValue("threadId", postToSend.Thread_Id);
|
||||||
|
command.Parameters.AddWithValue("ip", postToSend.Ip);
|
||||||
//command.Parameters.AddWithValue("postTimeStamp", DateTime.Now.ToString("dd/MM/yyyy HH:mm"));
|
//command.Parameters.AddWithValue("postTimeStamp", DateTime.Now.ToString("dd/MM/yyyy HH:mm"));
|
||||||
int nRows = command.ExecuteNonQuery();
|
int nRows = command.ExecuteNonQuery();
|
||||||
Console.Out.WriteLine("Добавлен пост с текстом " + postToSend.Text + " номером " + 22);
|
Console.Out.WriteLine("Добавлен пост с текстом " + postToSend.Text + " номером " + 22);
|
||||||
|
1
Post.cs
1
Post.cs
@ -9,5 +9,6 @@ namespace NeDvachAPI
|
|||||||
public int Thread_Id { get; set; }
|
public int Thread_Id { get; set; }
|
||||||
public bool Is_OP { get; set; }
|
public bool Is_OP { get; set; }
|
||||||
public bool Is_Deleted { get; set; }
|
public bool Is_Deleted { get; set; }
|
||||||
|
public string? Ip { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,8 +12,8 @@ builder.Services.AddCors(setup =>
|
|||||||
setup.AddDefaultPolicy(policyBuilder =>
|
setup.AddDefaultPolicy(policyBuilder =>
|
||||||
{
|
{
|
||||||
|
|
||||||
policyBuilder.WithOrigins("http://www.vdk2ch.ru:4200").WithMethods("GET", "POST").WithHeaders("*");
|
//policyBuilder.WithOrigins("http://www.vdk2ch.ru:4200").WithMethods("GET", "POST").WithHeaders("*");
|
||||||
//policyBuilder.WithOrigins("http://localhost:4200").WithMethods("GET", "POST").WithHeaders("*");
|
policyBuilder.WithOrigins("http://localhost:4200").WithMethods("GET", "POST").WithHeaders("*");
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user